chat_add
This commit is contained in:
@@ -5,17 +5,15 @@ use app\exception\MyBusinessException;
|
||||
use support\exception\BusinessException;
|
||||
class ApiController
|
||||
{
|
||||
protected static $token = 'kiy7s194DXKSpP8CJtRpnYn5r5HrHQTf';
|
||||
public function __construct()
|
||||
{
|
||||
$request = request();
|
||||
$get_token = $request->header('token');
|
||||
// 基类
|
||||
if(empty($get_token)) {
|
||||
throw new MyBusinessException('参数错误', 500);
|
||||
}
|
||||
if($get_token != self::$token) {
|
||||
throw new MyBusinessException('参数错误', 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function success($data = [])
|
||||
{
|
||||
return json(['code' => 1, 'msg' => 'success', 'data' => $data]);
|
||||
}
|
||||
|
||||
public function error($msg = 'fail')
|
||||
{
|
||||
return json(['code' => 0, 'msg' => $msg]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user