作者 root

gx

... ... @@ -5,7 +5,23 @@ namespace App\Enums\Common;
use BenSampo\Enum\Contracts\LocalizedEnum;
use BenSampo\Enum\Enum;
/**
* 状态码类
* @method static static SUCCESS()
* @method static static USER_ERROR()
* @method static static USER_REGISTER_ERROE()
* @method static static USER_LOGIN_ERROE()
* @method static static USER_PERMISSION_ERROE()
* @method static static USER_PARAMS_ERROE()
* @method static static USER_UPLOAD_ERROE()
* @method static static USER_VERSION_ERROE()
* @method static static SYSTEM_ERROR()
* @method static static SYSTEM_TIMEOUT_ERROR()
* @method static static SERVER_ERROR()
* @method static static SERVER_MYSQL_ERROR()
* @method static static SERVER_REDIS_ERROR()
* @method static static USER_MODEL_NOTFOUND_ERROE()
*/
final class Code extends Enum implements LocalizedEnum
{
public $statusTexts = [
... ...
... ... @@ -32,8 +32,6 @@ class BaseController extends Controller
$this->token = $this->request->header('token');
$this->get_param();
$this->auth_token();
return $this->success();
}
/**
... ... @@ -47,7 +45,6 @@ class BaseController extends Controller
if(isset($info) && !empty($info)){
$this->uid = $info['id'];
}
}
/**
* 成功返回
... ...
... ... @@ -34,7 +34,7 @@ class ComController extends BaseController
];
$validate = Validator::make($this->param, $rules, $message);
if($validate->errors()->first()){
return $this->response($validate->errors()->first(),'b00001',$this->param);
return $this->response($validate->errors()->first(),Code::USER_ERROR,$this->param);
}
//TODO::参数验
$comLogic = new ComLogic();
... ...
... ... @@ -4,6 +4,8 @@ namespace App\Http\Controllers\Bside;
use App\Enums\Common\Code;
class MenuController extends BaseController
{
public function lists(){
... ... @@ -11,7 +13,7 @@ class MenuController extends BaseController
$userLogic = new UserLogic();
$lists = $userLogic->lists($this->map,$this->p,$this->row,$this->order,['id','name','mobile']);
if(empty($lists)){
$this->response('请求失败','b00001',[]);
$this->response('请求失败',Code::USER_ERROR,[]);
}
$this->result($lists);
}
... ...
... ... @@ -22,7 +22,7 @@ class UserController extends BaseController
$userLogic = new UserLogic();
$lists = $userLogic->lists($this->map,$this->p,$this->row,$this->order,['id','name','mobile']);
if(empty($lists)){
$this->response('请求失败','b00001',[]);
$this->response('请求失败',Code::USER_ERROR,[]);
}
$this->result($lists);
}
... ...