作者 赵彬吉

update

... ... @@ -37,7 +37,9 @@ class Common
public static function set_user_login($param = []){
$data = [
'user_id'=>$param['user_id'],
'ip'=>$param['ip']
'ip'=>$param['ip'],
'project_id'=>$param['project_id'] ?: 0,
'remark'=>$param['remark'] ?? '',
];
$model = new UserLoginModel();
return $model->add($data);
... ...
... ... @@ -8,7 +8,8 @@ use App\Rules\Mobile;
use Illuminate\Http\Request;
/**
* Class LoginController
* @group 登录
*
* @package App\Http\Controllers\Aside
* @author zbj
* @date 2023/4/19
... ... @@ -16,6 +17,13 @@ use Illuminate\Http\Request;
class LoginController extends BaseController
{
/**
* @name 登录
* @description 读取联系人列表
* @type GET/POST
* @param {string} mobile 手机号
* @param {string} [password] 密码
*/
function login(Request $request, LoginLogic $logic)
{
$request->validate([
... ...
... ... @@ -59,6 +59,40 @@ class UserLoginLogic
}
/**
* 自动登录
* @author zbj
* @date 2023/7/25
*/
public function autologin()
{
$current_url = url()->current();
$refer_url = url()->previous();
if ($current_url == $refer_url) {
Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' - -|' . $refer_url]);
echo ' - -';
exit;
}
if (strpos($refer_url, 'www.quanqiusou.cn') === false && strpos($refer_url, 'crm.globalso.com') === false && strpos($refer_url, 'crm.globalso.com') === false) {
Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' 来源错误|' . $refer_url]);
echo '来源错误';
exit;
}
if (!$this->param['project_id']) {
Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' 没有传入链接|' . $refer_url]);
echo '没有连接';
exit;
}
$has_user = User::where('project_id', $this->param['project_id'])->orderBy('id', 'asc')->first();
if (empty($has_user->id)) {
Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' 该项目未找到注册账号|' . $refer_url]);
echo '该项目未找到注册账号';
exit;
}
return redirect('admin');
}
/**
* @name :(验证账号、密码或验证码是否正确)verifyAccount
* @author :lyh
* @method :post
... ...