ErrorCode.php 735 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: 思维定制
  5. * Date: 2018/10/27
  6. * Time: 11:58
  7. */
  8. namespace App\Library;
  9. class ErrorCode
  10. {
  11. const VERIFY_CODE_SEND_FAIL = 3000;
  12. const CLIENT_WRONG_PARAMS = 1000;
  13. const NO_AUTH = 1001;
  14. const SAVE_FALL = 1002;
  15. //错误常量枚举
  16. private static $_msg = [
  17. self::VERIFY_CODE_SEND_FAIL => '验证码发送失败',
  18. self::CLIENT_WRONG_PARAMS => '传入参数不正确',
  19. self::NO_AUTH => '用户未登录',
  20. self::SAVE_FALL => '数据保存失败',
  21. ];
  22. public static function message($code) {
  23. if (isset(self::$_msg[$code])) {
  24. return self::$_msg[$code];
  25. } else {
  26. return null;
  27. }
  28. }
  29. }