errcode.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. class errcode extends SplEnum
  3. {
  4. const __default = self::Success;
  5. const Success = 200;
  6. const ErrProtocolDisabled = 300;
  7. const ErrApptype = 10000;
  8. const ErrParamter = 10001;
  9. const ErrLogin = 10002;
  10. const ErrGenuser = 10003;
  11. const ErrUsertype = 10004;
  12. const ErrTokenExpire = 10005;
  13. const ErrSmscodeExpire = 10006;
  14. const ErrSmscode = 10007;
  15. const ErrIDbinded = 10008;
  16. const ErrUserExisted = 10009;
  17. const ErrPasswd = 10010;
  18. const ErrMobileNotBinded = 10011;
  19. const ErrSpecial = 10100;
  20. const ErrCart = 10200;
  21. // 订单错误内容
  22. const ErrOrder = 10300;
  23. const ErrOrderCanNotCancel = 10301;
  24. const ErrOrderNotExist = 10301;
  25. const ErrAddress = 10400;
  26. const ErrInvoice = 10500;
  27. const ErrPayment = 10600;
  28. // 快递内容
  29. const ErrExpress = 10700;
  30. const ErrExpressNotExist = 10701;
  31. const ErrDB = 11000;
  32. const ErrSms = 12000;
  33. const ErrGoodsNotExist = 13000;
  34. const ErrMemberNotExist = 13001;
  35. const ErrInputParam = 13002;
  36. const ErrVerifyCode = 13003;
  37. const ErrMemberExist = 13004;
  38. const ErrWxNotExist = 13005;
  39. const ErrLoginType = 13006;
  40. static function msg($code)
  41. {
  42. switch ($code) {
  43. case errcode::Success: return 'Success';
  44. case errcode::ErrProtocolDisabled: return 'ErrProtocolDisabled';
  45. case errcode::ErrApptype : return 'ErrApptype';
  46. case errcode::ErrLogin : return 'ErrLogin error password or phone';
  47. case errcode::ErrGenuser : return 'ErrGenuser';
  48. case errcode::ErrUsertype : return 'ErrUsertype';
  49. case errcode::ErrTokenExpire : return 'ErrTokenExpire';
  50. case errcode::ErrSmscodeExpire : return 'ErrSmscodeExpire';
  51. case errcode::ErrSmscode: return 'ErrSmscode';
  52. case errcode::ErrIDbinded: return 'ErrIDbinded id has been binded.';
  53. case errcode::ErrMobileNotBinded: return 'mobile has been binded.';
  54. case errcode::ErrSpecial: return 'ErrSpecial.';
  55. case errcode::ErrPayment: return 'ErrPayment.';
  56. case errcode::ErrGoodsNotExist: return 'ErrGoodsNotExist.';
  57. case errcode::ErrMemberNotExist: return 'ErrMemberExist.';
  58. case errcode::ErrInputParam: return 'error input param';
  59. case errcode::ErrVerifyCode: return 'error verify code';
  60. case errcode::ErrMemberExist: return '用户已经存在';
  61. case errcode::ErrPasswd: return '密码错误';
  62. case errcode::ErrWxNotExist: return '微信账号不存在';
  63. case errcode::ErrLoginType: return '登陆类型错误';
  64. case errcode::ErrOrderCanNotCancel: return '订单已支付或已发送,不能取消';
  65. case errcode::ErrOrderNotExist: return '订单不存在';
  66. case errcode::ErrExpress: return '查询快递出错';
  67. case errcode::ErrDB : return 'ErrorDB';
  68. case errcode::ErrSms : return 'ErrSms,Send sms error.';
  69. default : return 'Unknown Error.';
  70. }
  71. }
  72. }
  73. ?>