This commit is contained in:
2025-10-14 15:10:13 +08:00
parent 8aed3e5aac
commit d2a46c4738
15 changed files with 512 additions and 15 deletions

View 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);
}
}
}