ErrorCode.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace app\common\library\cloudapi;
/**
* 错误码管理类
* Class ErrorCode
* @package app\common\library\cloudapi
*/
class ErrorCode {
const NOT_HAVE_SIGN = 40001;
const NOT_HAVE_TIMESTAMP = 40002;
const FAILED_SIGN = 40003;
const VERIFICATION_FAILED = 40004;
const INVALID_SIGN = 40005;
const NOT_HAVE_APP_SECRET = 40006;
const NOT_HAVE_APP_ID = 40007;
const INVALID_TOKEN = 40008;
const TOKEN_EXPIRATION_DATE = 40009;
const NO_ACCESS_PERMISSIONS = 40010;
const ID_OR_SECRET_INCORRECT = 40011;
const SUCCESS = 1;
const ERROR = 0;
const MESSAGE = [
self::NOT_HAVE_SIGN => '缺少签名',
self::NOT_HAVE_TIMESTAMP => '缺少时间戳',
self::FAILED_SIGN => '签名失败',
self::VERIFICATION_FAILED => '验签失败',
self::INVALID_SIGN => '签名失效',
self::NOT_HAVE_APP_SECRET => '缺少app_secret参数',
self::NOT_HAVE_APP_ID => '缺少app_id参数',
self::INVALID_TOKEN => 'token无效',
self::TOKEN_EXPIRATION_DATE => 'token时效过期',
self::NO_ACCESS_PERMISSIONS => '没有访问权限',
self::ID_OR_SECRET_INCORRECT => 'app_id或app_secret不正确',
self::SUCCESS => 'success',
self::ERROR => 'error',
];
public static function getMessage($errorCode){
return self::MESSAGE[$errorCode];
}
}