作者 lyh

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -37,7 +37,9 @@ class Common @@ -37,7 +37,9 @@ class Common
37 public static function set_user_login($param = []){ 37 public static function set_user_login($param = []){
38 $data = [ 38 $data = [
39 'user_id'=>$param['user_id'], 39 'user_id'=>$param['user_id'],
40 - 'ip'=>$param['ip'] 40 + 'ip'=>$param['ip'],
  41 + 'project_id'=>$param['project_id'] ?: 0,
  42 + 'remark'=>$param['remark'] ?? '',
41 ]; 43 ];
42 $model = new UserLoginModel(); 44 $model = new UserLoginModel();
43 return $model->add($data); 45 return $model->add($data);
@@ -8,7 +8,8 @@ use App\Rules\Mobile; @@ -8,7 +8,8 @@ use App\Rules\Mobile;
8 use Illuminate\Http\Request; 8 use Illuminate\Http\Request;
9 9
10 /** 10 /**
11 - * Class LoginController 11 + * @group 登录
  12 + *
12 * @package App\Http\Controllers\Aside 13 * @package App\Http\Controllers\Aside
13 * @author zbj 14 * @author zbj
14 * @date 2023/4/19 15 * @date 2023/4/19
@@ -16,6 +17,13 @@ use Illuminate\Http\Request; @@ -16,6 +17,13 @@ use Illuminate\Http\Request;
16 class LoginController extends BaseController 17 class LoginController extends BaseController
17 { 18 {
18 19
  20 + /**
  21 + * @name 登录
  22 + * @description 读取联系人列表
  23 + * @type GET/POST
  24 + * @param {string} mobile 手机号
  25 + * @param {string} [password] 密码
  26 + */
19 function login(Request $request, LoginLogic $logic) 27 function login(Request $request, LoginLogic $logic)
20 { 28 {
21 $request->validate([ 29 $request->validate([
@@ -57,6 +57,12 @@ class ProjectLogic extends BaseLogic @@ -57,6 +57,12 @@ class ProjectLogic extends BaseLogic
57 'test_domain' => $item['deploy_build']['test_domain'] ?? 0, 57 'test_domain' => $item['deploy_build']['test_domain'] ?? 0,
58 'domain' => $item['deploy_optimize']['domain'] ?? 0, 58 'domain' => $item['deploy_optimize']['domain'] ?? 0,
59 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), 59 'created_at' => date('Y年m月d日', strtotime($item['created_at'])),
  60 + 'autologin_url' => '',
  61 + 'product_num' => 0,
  62 + 'keyword_num' => 0,
  63 + 'article_num' => 0,
  64 + 'task_finish_num' => 0,
  65 + 'task_pending_num' => 0,
60 ]; 66 ];
61 } 67 }
62 return $list; 68 return $list;
@@ -61,6 +61,40 @@ class UserLoginLogic @@ -61,6 +61,40 @@ class UserLoginLogic
61 } 61 }
62 62
63 /** 63 /**
  64 + * 自动登录
  65 + * @author zbj
  66 + * @date 2023/7/25
  67 + */
  68 + public function autologin()
  69 + {
  70 + $current_url = url()->current();
  71 + $refer_url = url()->previous();
  72 + if ($current_url == $refer_url) {
  73 + Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' - -|' . $refer_url]);
  74 + echo ' - -';
  75 + exit;
  76 + }
  77 + if (strpos($refer_url, 'www.quanqiusou.cn') === false && strpos($refer_url, 'crm.globalso.com') === false && strpos($refer_url, 'crm.globalso.com') === false) {
  78 + Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' 来源错误|' . $refer_url]);
  79 + echo '来源错误';
  80 + exit;
  81 + }
  82 + if (!$this->param['project_id']) {
  83 + Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' 没有传入链接|' . $refer_url]);
  84 + echo '没有连接';
  85 + exit;
  86 + }
  87 + $has_user = User::where('project_id', $this->param['project_id'])->orderBy('id', 'asc')->first();
  88 + if (empty($has_user->id)) {
  89 + Common::set_user_login(['user_id'=>0, 'ip'=>request()->ip(), 'project_id' => $this->param['project_id'] ?: 0,'remark' => ' 该项目未找到注册账号|' . $refer_url]);
  90 + echo '该项目未找到注册账号';
  91 + exit;
  92 + }
  93 +
  94 + return redirect('admin');
  95 + }
  96 +
  97 + /**
64 * @name :(验证账号、密码或验证码是否正确)verifyAccount 98 * @name :(验证账号、密码或验证码是否正确)verifyAccount
65 * @author :lyh 99 * @author :lyh
66 * @method :post 100 * @method :post