This commit is contained in:
2025-03-17 11:27:07 +08:00
parent 7a7f432006
commit 5febeca83f
6805 changed files with 6 additions and 6 deletions

View File

@@ -0,0 +1,63 @@
<?php
/*
* description
* authorwh
* email
* createTime{2023/12/5} {15:45}
*/
namespace app\common\behavior;
use app\api\logic\LoginLogic;
use wanghua\general_utility_tools_php\api\BaseUserLogic;
use wanghua\general_utility_tools_php\tool\Tools;
class LoginBehavior
{
//public function run(&$params)
//{
// // 行为逻辑
//}
public function actionBegin(){
return true;
//白名单
$white_arr = [
//【全小写】
'api/login/login',
'api/reg/reg',
'api/email/sendemail',
'api/email/check',
'api/users/forgot',
//public
'api/twitter/search',
];
$module = request()->module();
$controller = request()->controller();
$action = request()->action();
if($module != 'api'){
return false;
}
$url = strtolower($module.'/'.$controller.'/'.$action);
//dump($url);
if(in_array($url, $white_arr)){
//dump('不校验');
return true;//不校验
}
Tools::log_to_write_txt(['action log'=>input()]);
$r = session('api_user_info');
//dump($r);die;
if(empty($r)){
Tools::log_to_write_txt(['api_user_info'=>$r]);
echo json_encode(Tools::set_fail('登录失效'),JSON_UNESCAPED_UNICODE);die;
}
}
}