12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App;
- /**
- * API服务端 - 错误码
- * @author Flc <2016-7-31 11:27:09>
- */
- class Error
- {
- /**
- * 错误码
- * @var [type]
- */
- public static $errCodes = [
- 0 => "成功",
- 200 =>'请求成功',
- 1001 => '未分配销售',
- 2000 =>'请求参数不合法',
- 2001 =>'未查询到有效数据',
- 2002 =>'密码错误',
- 2003 =>'充值卡余额不足',
- 2014 =>'该用户还不是会员',
- 2015 =>'不能领取当月礼包',
- ];
- /**
- * 返回错误码
- * @var string
- */
- public static function getError($code = "400", $_ = false)
- {
- if (! isset(self::$errCodes[$code])) {
- $code = "400";
- }
- return ($_ ? "[{$code}]" : "")
- . self::$errCodes[$code];
- }
- }
|