<?php

class errcode extends SplEnum
{
    const __default = self::Success;

    const Success = 200;

    const ErrProtocolDisabled = 300;

    const ErrApptype = 10000;
    const ErrParamter = 10001;
    const ErrLogin = 10002;
    const ErrHasLogined = 10003;
    const ErrUsertype = 10004;
    const ErrTokenExpire = 10005;
    const ErrSmscodeExpire = 10006;
    const ErrSmscode = 10007;
    const ErrIDbinded = 10008;
    const ErrUserExisted = 10009;
    const ErrPasswd = 10010;
    const ErrMobileNotBinded = 10011;
    const ErrOperRepeat = 10012;
    const ErrAccountStop = 10013;
    const ErrUnLogin = 10014;
    const ErrRegister = 10015;
    const ErrUserOrPass = 10016;

    const ErrFrequentlyRequest = 10017;//请求频繁
    const ErrUploadFileFailed = 10018; //上传文件失败
    const ErrSpecial = 10100;

    // 购物车模块（10200-10299）
    const ErrCart = 10200;
    const ErrGoodsOff = 10201;
    const ErrCanNotBuyOwn = 10202;
    const ErrStorageShort = 10203;
    const ErrAddCart = 10204;
    const ErrGoodsOutofStock = 10205;
    const ErrGoodsSpecial = 10206;
    const ErrCartDelError = 10207;

    // 订单错误内容
    const ErrOrder = 10300;
    const ErrOrderCanNotCancel = 10301;
    const ErrOrderNotExist = 10302;
    const ErrOrderState = 10303;
    const ErrOrderRefundError = 10304;
    const ErrRefundNotExist = 10305;


    const ErrAddress = 10400;
    const ErrInvoice = 10500;
    const ErrPayment = 10600;
    // 快递内容
    const ErrExpress = 10700;
    const ErrExpressNotExist = 10701;

    const ErrBonus = 10800;
    const ErrBonusType = 10801;
    const ErrBonusMake = 10802;
    const ErrBonusGrabNull = 10803;
    const ErrBonusNotEnough = 10804;
    const ErrBonusSN = 10805;
    const ErrBonusBinded = 10806;
    const ErrBonusComment = 10807;
    const ErrBonusShake = 10808;
    const ErrBonusDailyRank = 10809;

    //套装
    const ErrBLUnExist = 10900;

    const ErrDB = 11000;
    const ErrShake = 11100;
    const ErrRelation = 11200;
    const ErrSms = 12000;
    const ErrSmsLessRepeateMinTime = 12001;

    const ErrGoodsNotExist = 13000;
    const ErrMemberNotExist = 13001;
    const ErrInputParam = 13002;
    const ErrVerifyCode = 13003;
    const ErrMemberExist = 13004;
    const ErrWxNotExist = 13005;
    const ErrLoginType = 13006;
    const ErrGetConfig = 14000;
    const ErrUpfile = 15000;
    const ErrAuthor = 16000;
    const ErrUGC = 17000;

    static function msg($code)
    {
        switch ($code) {
            case errcode::Success:
                return '成功';
            case errcode::ErrProtocolDisabled:
                return '协议未启用';
            case errcode::ErrApptype :
                return '应用类型错误';
            case errcode::ErrParamter :
                return '错误的参数.';
            case errcode::ErrLogin :
                return '用户名或密码错误';
            case errcode::ErrHasLogined :
                return '当前在登录状态，请先登出再登录.';
            case errcode::ErrUsertype :
                return '用户类型错误';
            case errcode::ErrTokenExpire :
                return 'token过期';
            case errcode::ErrSmscodeExpire :
                return '验证码过期';
            case errcode::ErrSmscode:
                return '验证码错误';
            case errcode::ErrIDbinded:
                return '用户已经绑定';
            case errcode::ErrMobileNotBinded :
                return '手机号尚未绑定';
            case errcode::ErrOperRepeat :
                return '抱歉,您登录重试次数超过限制，请十分钟后再试~';
            case errcode::ErrAccountStop :
                return '该帐号已经被停用';
            case errcode::ErrUnLogin :
                return '您没有登录不能做此操作.';
            case errcode::ErrSpecial:
                return 'ErrSpecial.';
            case errcode::ErrPayment:
                return '支付错误.';
            case errcode::ErrGoodsNotExist:
                return '商品库存不足或已下架.';
            case errcode::ErrMemberNotExist:
                return '用户不存在.';
            case errcode::ErrInputParam:
                return '输入参数错误';
            case errcode::ErrVerifyCode:
                return '验证码错误';
            case errcode::ErrMemberExist:
                return '用户已经存在';
            case errcode::ErrPasswd:
                return '账号或密码错误';
            case errcode::ErrWxNotExist:
                return '该微信账号还没有注册';
            case errcode::ErrLoginType:
                return '登陆类型错误';
            case errcode::ErrOrderCanNotCancel:
                return '订单已支付或已发送，不能取消';
            case errcode::ErrOrderNotExist:
                return '订单不存在';
            case errcode::ErrExpress:
                return '查询快递出错';
            case errcode::ErrGoodsOff:
                return '商品下架';
            case errcode::ErrCanNotBuyOwn:
                return '不能购买自己商品';
            case errcode::ErrStorageShort:
                return '商品库存不足';
            case errcode::ErrAddCart:
                return '添加购物车失败';
            case errcode::ErrGoodsOutofStock :
                return '商品缺货.';
            case errcode::ErrGoodsSpecial :
                return '该商品不允许加入购物车，请直接购买';
            case errcode::ErrCartDelError :
                return '购物车删除失败.';
            case errcode::ErrGetConfig:
                return '获取配置文件出错';

            case errcode::ErrBLUnExist:
                return '该优惠套装已不存在，建议您单独购买';

            case errcode::ErrDB :
                return '系统错误';
            case errcode::ErrSms :
                return '验证码发送错误';
            case errcode::ErrSmsLessRepeateMinTime:
                return '一分钟内只能发送一次验证码，请稍后再试.';
            default :
                return '系统错误.';
        }
    }
}

?>