作者 lyh

gx

@@ -6,6 +6,7 @@ use App\Enums\Common\Common; @@ -6,6 +6,7 @@ use App\Enums\Common\Common;
6 use App\Models\Manage\Manage; 6 use App\Models\Manage\Manage;
7 use App\Models\Manage\LoginLog; 7 use App\Models\Manage\LoginLog;
8 use App\Models\Service\Service; 8 use App\Models\Service\Service;
  9 +use App\Utils\EncryptUtils;
9 use Illuminate\Support\Facades\Cache; 10 use Illuminate\Support\Facades\Cache;
10 use Illuminate\Support\Facades\Hash; 11 use Illuminate\Support\Facades\Hash;
11 12
@@ -21,7 +22,7 @@ class LoginLogic extends BaseLogic @@ -21,7 +22,7 @@ class LoginLogic extends BaseLogic
21 public function __construct() 22 public function __construct()
22 { 23 {
23 parent::__construct(); 24 parent::__construct();
24 - 25 + $this->param = $this->requestAll;
25 $this->model = new Manage(); 26 $this->model = new Manage();
26 } 27 }
27 28
@@ -84,7 +85,14 @@ class LoginLogic extends BaseLogic @@ -84,7 +85,14 @@ class LoginLogic extends BaseLogic
84 if($info === false){ 85 if($info === false){
85 $this->fail('当前地址不存在或者已被删除'); 86 $this->fail('当前地址不存在或者已被删除');
86 } 87 }
87 - return $this->success($info); 88 + $encrypt = new EncryptUtils();
  89 + $data = [
  90 + 'domain'=>$info['values'],
  91 + 'autologin_code' => $encrypt->authcode(json_encode(['project_id' => $this->param['project_id']]), 'ENCODE', 'autologin', 3600),
  92 + 'remark'=>'自动登录地址和code',
  93 + ];
  94 + //获取当前超级管理员的token
  95 + return $this->success($data);
88 } 96 }
89 97
90 } 98 }
@@ -78,6 +78,13 @@ class ProjectLogic extends BaseLogic @@ -78,6 +78,13 @@ class ProjectLogic extends BaseLogic
78 return $list; 78 return $list;
79 } 79 }
80 80
  81 + /**
  82 + * @remark :自动登录加密
  83 + * @name :getAutoLoginCode
  84 + * @author :lyh
  85 + * @method :post
  86 + * @time :2023/8/7 9:47
  87 + */
81 public function getAutoLoginCode($project_id){ 88 public function getAutoLoginCode($project_id){
82 $encrypt = new EncryptUtils(); 89 $encrypt = new EncryptUtils();
83 return $encrypt->authcode(json_encode(['project_id' => $project_id]), 'ENCODE', 'autologin', 3600); 90 return $encrypt->authcode(json_encode(['project_id' => $project_id]), 'ENCODE', 'autologin', 3600);
@@ -71,7 +71,6 @@ class UserLoginLogic @@ -71,7 +71,6 @@ class UserLoginLogic
71 $this->fail('该项目未找到注册账号'); 71 $this->fail('该项目未找到注册账号');
72 } 72 }
73 $info = $this->verifyRole($has_user->toArray()); 73 $info = $this->verifyRole($has_user->toArray());
74 -  
75 if(!Cache::get($info['token'])){ 74 if(!Cache::get($info['token'])){
76 //生成新token 75 //生成新token
77 $token = md5(uniqid().$info['id']); 76 $token = md5(uniqid().$info['id']);