Files
fast_response/front/application/common/behavior/LoginBehavior.php
2025-03-17 11:27:07 +08:00

63 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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;
}
}
}