webman迁移-优化
This commit is contained in:
@@ -105,6 +105,11 @@ class Backend extends Api
|
||||
*/
|
||||
protected string $withJoinType = 'LEFT';
|
||||
|
||||
/**
|
||||
* 输入过滤函数名(如 clean_xss,CRUD 含 editor 字段时自动设置)
|
||||
*/
|
||||
protected string $inputFilter = '';
|
||||
|
||||
/**
|
||||
* 后台初始化(需在控制器方法开头调用,在 initializeApi 之后)
|
||||
* @return Response|null 需直接返回时返回 Response,否则 null
|
||||
@@ -116,6 +121,9 @@ class Backend extends Api
|
||||
return $response;
|
||||
}
|
||||
|
||||
// 调用子类 initialize(CRUD 生成的控制器在此设置 model)
|
||||
$this->initialize();
|
||||
|
||||
$action = $this->getActionFromPath($request->path());
|
||||
$needLogin = !action_in_arr($this->noNeedLogin, $action);
|
||||
$needPermission = !action_in_arr($this->noNeedPermission, $action);
|
||||
@@ -207,7 +215,7 @@ class Backend extends Api
|
||||
{
|
||||
$response = $this->initializeBackend($request);
|
||||
if ($response !== null) return $response;
|
||||
$this->select();
|
||||
$this->_select();
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class Frontend extends Api
|
||||
$needLogin = !action_in_arr($this->noNeedLogin, $action);
|
||||
|
||||
try {
|
||||
$this->auth = Auth::instance();
|
||||
$this->auth = Auth::instance(['request' => $request]);
|
||||
$token = get_auth_token(['ba', 'user', 'token'], $request);
|
||||
if ($token) $this->auth->init($token);
|
||||
} catch (TokenExpirationException) {
|
||||
|
||||
Reference in New Issue
Block a user