初步MQ
This commit is contained in:
21
app/common/controller/ApiController.php
Normal file
21
app/common/controller/ApiController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\controller;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user