|
...
|
...
|
@@ -63,33 +63,24 @@ class UserLoginLogic |
|
|
|
* @author zbj
|
|
|
|
* @date 2023/7/25
|
|
|
|
*/
|
|
|
|
public function autologin()
|
|
|
|
public function autologin($project_id)
|
|
|
|
{
|
|
|
|
$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();
|
|
|
|
$has_user = User::where('project_id', $project_id)->orderBy('id', 'asc')->select(['id','mobile','role_id','token','name','project_id'])->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;
|
|
|
|
Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?? 0,'remark' => '该项目未找到注册账号']);
|
|
|
|
$this->fail('该项目未找到注册账号');
|
|
|
|
}
|
|
|
|
$info = $this->verifyRole($has_user->toArray());
|
|
|
|
|
|
|
|
return redirect('admin');
|
|
|
|
if(!Cache::get($info['token'])){
|
|
|
|
//生成新token
|
|
|
|
$token = md5(uniqid().$info['id']);
|
|
|
|
//存储缓存
|
|
|
|
$info['token'] = $token;
|
|
|
|
Cache::add($token,$info);
|
|
|
|
}
|
|
|
|
Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(),'project_id'=>$info['project_id'], 'remark' => '自动登录']);
|
|
|
|
return $info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|