作者 赵彬吉

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

@@ -27,23 +27,23 @@ class Kernel extends ConsoleKernel @@ -27,23 +27,23 @@ class Kernel extends ConsoleKernel
27 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 27 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
28 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 28 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
29 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 29 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
30 - // 更新域名|证书结束时间,每天凌晨1点执行一次 30 +// // 更新域名|证书结束时间,每天凌晨1点执行一次
31 // $schedule->command('domain_time')->dailyAt('01:00')->withoutOverlapping(1); 31 // $schedule->command('domain_time')->dailyAt('01:00')->withoutOverlapping(1);
32 - // B站 - 网站数据统计  
33 - // 获取当前月份最后一天  
34 - $lastDay = date('Y-m-t');  
35 - // 统计当月访问来源数据,每月最后一天23:59点执行一次  
36 - $schedule->command('statistics_source')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);  
37 - // 统计当月地域分布数据,每月最后一天23:59点执行一次  
38 - $schedule->command('statistics_distribution')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);  
39 - // 统计当月受访页面数据,每月最后一天23:59点执行一次  
40 - $schedule->command('statistics_page')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);  
41 - // 统计当月访问终端数据,每月最后一天23:59点执行一次  
42 - $schedule->command('statistics_terminal')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);  
43 - // 统计当月流量趋势数据,每月最后一天23:59点执行一次  
44 - $schedule->command('statistics_trend')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);  
45 - // 统计当天流量趋势数据,每天23:59点执行一次  
46 - $schedule->command('statistics_day_trend')->dailyAt('23:59')->withoutOverlapping(1); 32 +// // B站 - 网站数据统计
  33 +// // 获取当前月份最后一天
  34 +// $lastDay = date('Y-m-t');
  35 +// // 统计当月访问来源数据,每月最后一天23:59点执行一次
  36 +// $schedule->command('statistics_source')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);
  37 +// // 统计当月地域分布数据,每月最后一天23:59点执行一次
  38 +// $schedule->command('statistics_distribution')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);
  39 +// // 统计当月受访页面数据,每月最后一天23:59点执行一次
  40 +// $schedule->command('statistics_page')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);
  41 +// // 统计当月访问终端数据,每月最后一天23:59点执行一次
  42 +// $schedule->command('statistics_terminal')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);
  43 +// // 统计当月流量趋势数据,每月最后一天23:59点执行一次
  44 +// $schedule->command('statistics_trend')->monthlyOn($lastDay, '23:59')->withoutOverlapping(1);
  45 +// // 统计当天流量趋势数据,每天23:59点执行一次
  46 +// $schedule->command('statistics_day_trend')->dailyAt('23:59')->withoutOverlapping(1);
47 } 47 }
48 48
49 /** 49 /**
@@ -142,13 +142,13 @@ class Country @@ -142,13 +142,13 @@ class Country
142 'con_flag' => '', 142 'con_flag' => '',
143 143
144 ], 144 ],
145 - 'zh-CN' => [ 145 + 'cn' => [
146 'text' => '中文(简体)', 146 'text' => '中文(简体)',
147 'lang_text' => '简体中文', 147 'lang_text' => '简体中文',
148 'con_flag' => 'con_flag/zh.jfif', 148 'con_flag' => 'con_flag/zh.jfif',
149 'shop_lang' => 'zh-cn', 149 'shop_lang' => 'zh-cn',
150 ], 150 ],
151 - 'zh-TW' => [ 151 + 'tw' => [
152 'text' => '中文(繁体)', 152 'text' => '中文(繁体)',
153 'lang_text' => '繁体中文', 153 'lang_text' => '繁体中文',
154 'con_flag' => 'con_flag/zh.jfif', 154 'con_flag' => 'con_flag/zh.jfif',
@@ -680,7 +680,7 @@ class Country @@ -680,7 +680,7 @@ class Country
680 public function set_country(){ 680 public function set_country(){
681 $data = []; 681 $data = [];
682 foreach ($this->tls_list as $k=>$v){ 682 foreach ($this->tls_list as $k=>$v){
683 - $data[] = ['name'=>$v['text'],'alias'=>$k]; 683 + $data[] = ['name'=>$v['text'],'alias'=>$k,'image'=>$k.'.png','con_flag'=>$v['con_flag'],'lang_text'=>$v['lang_text']];
684 } 684 }
685 $webCountry = new WebSettingCountry(); 685 $webCountry = new WebSettingCountry();
686 $webCountry->insert($data); 686 $webCountry->insert($data);
@@ -169,6 +169,9 @@ class BaseController extends Controller @@ -169,6 +169,9 @@ class BaseController extends Controller
169 $data['images_link'][$k1] = url('/b/image/' . $v1); 169 $data['images_link'][$k1] = url('/b/image/' . $v1);
170 } 170 }
171 break; 171 break;
  172 + case 'country_img'://国家图标
  173 + $data['image_link'] = url('upload/country/' . $v);
  174 + break;
172 case 'file': 175 case 'file':
173 $data['file_link'] = url('/b/file_hash/' . $v); 176 $data['file_link'] = url('/b/file_hash/' . $v);
174 break; 177 break;
@@ -3,22 +3,15 @@ @@ -3,22 +3,15 @@
3 namespace App\Http\Controllers\Bside; 3 namespace App\Http\Controllers\Bside;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 -use App\Helper\AyrShare as AyrShareHelper;  
7 -use App\Helper\Common;  
8 -use App\Helper\FormGlobalsoApi;  
9 -use App\Models\AyrShare\AyrRelease as AyrReleaseModel;  
10 -use App\Models\AyrShare\AyrShare as AyrShareModel;  
11 -use App\Models\Project\DeployBuild; 6 +use App\Http\Logic\Bside\User\UserLogic;
12 use App\Models\Project\Project; 7 use App\Models\Project\Project;
13 use App\Models\Project\Project as ProjectModel; 8 use App\Models\Project\Project as ProjectModel;
14 use App\Models\SmsLog; 9 use App\Models\SmsLog;
15 use App\Models\User\ProjectMenu as ProjectMenuModel; 10 use App\Models\User\ProjectMenu as ProjectMenuModel;
16 use App\Models\User\ProjectRole as ProjectRoleModel; 11 use App\Models\User\ProjectRole as ProjectRoleModel;
17 use App\Models\User\User as UserModel; 12 use App\Models\User\User as UserModel;
18 -use Carbon\Carbon;  
19 use Illuminate\Http\Request; 13 use Illuminate\Http\Request;
20 use Illuminate\Support\Facades\Cache; 14 use Illuminate\Support\Facades\Cache;
21 -use Illuminate\Support\Facades\DB;  
22 use Mrgoon\AliSms\AliSms; 15 use Mrgoon\AliSms\AliSms;
23 16
24 /*** 17 /***
@@ -40,11 +33,8 @@ class ComController extends BaseController @@ -40,11 +33,8 @@ class ComController extends BaseController
40 'password.required'=>'内容必须填写', 33 'password.required'=>'内容必须填写',
41 'mobile.regex' => '请输入正确的手机号码', 34 'mobile.regex' => '请输入正确的手机号码',
42 ]); 35 ]);
43 - $userModel = new UserModel();  
44 - $res = $userModel->login($this->param);  
45 - if($res === false){  
46 - $this->response('当前用户不存在或者被禁用,登录失败',Code::USER_ERROR,[]);  
47 - } 36 + $userLogic = new UserLogic();
  37 + $res = $userLogic->login();
48 $this->response('请求成功',Code::SUCCESS,$res); 38 $this->response('请求成功',Code::SUCCESS,$res);
49 } 39 }
50 40
@@ -98,12 +88,9 @@ class ComController extends BaseController @@ -98,12 +88,9 @@ class ComController extends BaseController
98 'password.required'=>'密码必须填写', 88 'password.required'=>'密码必须填写',
99 'name.required'=>'名称必须填写', 89 'name.required'=>'名称必须填写',
100 ]); 90 ]);
101 - $userModel = new UserModel(); 91 + $userLogic = new UserLogic();
102 $this->param['id'] = $this->uid; 92 $this->param['id'] = $this->uid;
103 - $rs = $userModel->edits($this->param);  
104 - if($rs === false){  
105 - $this->response('参数错误或其他服务器原因,编辑失败',Code::USER_ERROR);  
106 - } 93 + $userLogic->edits($this->param);
107 $this->response('编辑成功'); 94 $this->response('编辑成功');
108 } 95 }
109 96
@@ -155,21 +142,7 @@ class ComController extends BaseController @@ -155,21 +142,7 @@ class ComController extends BaseController
155 } 142 }
156 143
157 public function ceshi(){ 144 public function ceshi(){
158 - $data = [];  
159 - for ($i = 30;$i >= 1 ;$i--){  
160 - $start_time = Carbon::now()->modify('-'.$i.' days')->toDateString();  
161 - $data[] = [  
162 - 'project_id'=>1,  
163 - 'pv_num'=>$i*(rand(10,1000)),  
164 - 'ip_num'=>$i*(rand(10,1000)),  
165 - 'inquiry_num'=>$i*(rand(10,1000)),  
166 - 'date'=>$start_time,  
167 - 'compliance_day'=>2351,  
168 - 'service_day'=>1233,  
169 - 'created_at'=>$start_time.' 00:00:00',  
170 - 'updated_at'=>$start_time.' 00:00:00',  
171 - ];  
172 - }  
173 - DB::table('gl_count')->insert($data); 145 + $country = new \App\Helper\Country();
  146 + return $country->set_country();
174 } 147 }
175 } 148 }
@@ -31,7 +31,7 @@ class StatisticsController extends BaseController @@ -31,7 +31,7 @@ class StatisticsController extends BaseController
31 * 访问来源 31 * 访问来源
32 * @return JsonResponse 32 * @return JsonResponse
33 * @throws ContainerExceptionInterface 33 * @throws ContainerExceptionInterface
34 - * @throws NotFoundExceptionInterface 34 + * @throws NotFoundExceptionInterface|Throwable
35 */ 35 */
36 public function source() 36 public function source()
37 { 37 {
@@ -35,8 +35,10 @@ class BaseLogic extends Logic @@ -35,8 +35,10 @@ class BaseLogic extends Logic
35 $this->request = request(); 35 $this->request = request();
36 $this->requestAll = request()->all(); 36 $this->requestAll = request()->all();
37 $this->user = Cache::get(request()->header('token')); 37 $this->user = Cache::get(request()->header('token'));
  38 + if(!empty($this->user)){
38 $this->project = (new ProjectLogic())->getInfo($this->user['project_id']); 39 $this->project = (new ProjectLogic())->getInfo($this->user['project_id']);
39 } 40 }
  41 + }
40 42
41 43
42 /** 44 /**
@@ -24,14 +24,13 @@ class WebSettingCountryLogic extends BaseLogic @@ -24,14 +24,13 @@ class WebSettingCountryLogic extends BaseLogic
24 * @time :2023/4/28 16:18 24 * @time :2023/4/28 16:18
25 */ 25 */
26 public function country_list(){ 26 public function country_list(){
27 - $lists = $this->model->list($this->param,'id',['id','name','image']); 27 + $lists = $this->model->list($this->param,'id',['id','name','country_img']);
28 if (empty($lists)){ 28 if (empty($lists)){
29 $this->fail('当前数据不存在'); 29 $this->fail('当前数据不存在');
30 } 30 }
31 return $this->success($lists); 31 return $this->success($lists);
32 } 32 }
33 33
34 -  
35 public function edit_country(){ 34 public function edit_country(){
36 35
37 return $this->success(); 36 return $this->success();
@@ -3,8 +3,12 @@ @@ -3,8 +3,12 @@
3 namespace App\Http\Logic\Bside\User; 3 namespace App\Http\Logic\Bside\User;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
  6 +use App\Helper\Common;
6 use App\Http\Logic\Bside\BaseLogic; 7 use App\Http\Logic\Bside\BaseLogic;
  8 +use App\Models\SmsLog;
  9 +use App\Models\User\ProjectRole as ProjectRoleModel;
7 use App\Models\User\User; 10 use App\Models\User\User;
  11 +use Illuminate\Support\Facades\Cache;
8 12
9 class UserLogic extends BaseLogic 13 class UserLogic extends BaseLogic
10 { 14 {
@@ -103,4 +107,74 @@ class UserLogic extends BaseLogic @@ -103,4 +107,74 @@ class UserLogic extends BaseLogic
103 return $this->success(); 107 return $this->success();
104 } 108 }
105 109
  110 + /***
  111 + * @name :登录
  112 + * @return void
  113 + * @author :liyuhang
  114 + * @method
  115 + */
  116 + public function login(){
  117 + //验证账号密码
  118 + $password = base64_encode(md5($this->param['password']));
  119 + $info = $this->model->read(['mobile'=>$this->param['mobile'],'password'=>$password,'status'=>0], ['id','mobile','role_id','token','name','project_id']);
  120 + if($info === false){
  121 + //账号密码没通过时,验证验证码
  122 + $info = $this->model->read(['mobile'=>$this->param['mobile'],'status'=>0], ['id','mobile','role_id','token','name','project_id']);
  123 + if($info === false){
  124 + $this->fail('账号密码错误',Code::USER_REGISTER_ERROE);
  125 + }
  126 + //验证验证码是否准备
  127 + $last_sms = SmsLog::getLastLog($this->param['mobile'], SmsLog::TYPE_LOGIN);
  128 + if($this->param['password'] != $last_sms->code){
  129 + $this->fail('账号密码错误',Code::USER_REGISTER_ERROE);
  130 + }
  131 + }
  132 + //当前用户角色是否被禁用
  133 + $projectRoleModel = new ProjectRoleModel();
  134 + $role_info = $projectRoleModel->read(['id'=>$info['role_id'],'status'=>0]);
  135 + if($role_info === false){
  136 + $this->fail('当前用户角色被禁用',Code::USER_REGISTER_ERROE);
  137 + }
  138 + if(isset($info['token']) && !empty($info['token'])){
  139 + //清除上一次用户缓存
  140 + Cache::pull($info['token']);
  141 + }
  142 + //生成新token
  143 + $token = md5(uniqid().$info['id']);
  144 + //存储缓存
  145 + $info['token'] = $token;
  146 + Cache::add($token,$info);
  147 + $rs = $this->model->edit(['token'=>$token],['id'=>$info['id']]);
  148 + if($rs === false){
  149 + $this->fail('系统错误,请联系管理员');
  150 + }
  151 + //写入日志
  152 + Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip()]);
  153 + return $this->success($info);
  154 + }
  155 +
  156 +
  157 + /**
  158 + * @param $param
  159 + * @name :编辑管理员
  160 + * @return bool
  161 + * @author :liyuhang
  162 + * @method
  163 + */
  164 + public function edits($param){
  165 + //查看密码是否修改
  166 + $info = $this->model->read(['id'=>$param['id']]);
  167 + $param['password'] = base64_encode(md5($param['password']));
  168 + if($param['password'] == $info['password']){
  169 + unset($param['password']);
  170 + }
  171 + //密码加密
  172 + $rs = $this->model->edit($param,['id'=>$param['id']]);
  173 + if($rs === false){
  174 + $this->fail('系统错误,请联系管理员');
  175 + }
  176 + //清空当前用户登录缓存
  177 + Cache::pull($info['token']);
  178 + return $this->success();
  179 + }
106 } 180 }
@@ -53,74 +53,4 @@ class User extends Base @@ -53,74 +53,4 @@ class User extends Base
53 'updated_at' => 'datetime:Y-m-d H:i:s', 53 'updated_at' => 'datetime:Y-m-d H:i:s',
54 ]; 54 ];
55 55
56 - /***  
57 - * @name :登录  
58 - * @return void  
59 - * @author :liyuhang  
60 - * @method  
61 - */  
62 - public function login($param){  
63 - //验证账号密码  
64 - $password = base64_encode(md5($param['password']));  
65 - $info = $this->read(['mobile'=>$param['mobile'],'password'=>$password,'status'=>0], ['id','mobile','role_id','token','name','project_id']);  
66 - if($info === false){  
67 - //账号密码没通过时,验证验证码  
68 - $info = $this->read(['mobile'=>$param['mobile'],'status'=>0], ['id','mobile','role_id','token','name','project_id']);  
69 - if($info === false){  
70 - return false;  
71 - }  
72 - //验证验证码是否准备  
73 - $last_sms = SmsLog::getLastLog($param['mobile'], SmsLog::TYPE_LOGIN);  
74 - if($param['password'] != $last_sms->code){  
75 - return false;  
76 - }  
77 - }  
78 - //当前用户角色是否被禁用  
79 - $projectRoleModel = new ProjectRoleModel();  
80 - $role_info = $projectRoleModel->read(['id'=>$info['role_id'],'status'=>0]);  
81 - if($role_info === false){  
82 - return false;  
83 - }  
84 - if(isset($info['token']) && !empty($info['token'])){  
85 - //清除上一次用户缓存  
86 - Cache::pull($info['token']);  
87 - }  
88 - //生成新token  
89 - $token = md5(uniqid().$info['id']);  
90 - //存储缓存  
91 - $info['token'] = $token;  
92 - Cache::add($token,$info);  
93 - $rs = $this->edit(['token'=>$token],['id'=>$info['id']]);  
94 - if($rs === false){  
95 - return false;  
96 - }  
97 - //写入日志  
98 - Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip()]);  
99 - return $info;  
100 - }  
101 -  
102 -  
103 - /**  
104 - * @param $param  
105 - * @name :编辑管理员  
106 - * @return bool  
107 - * @author :liyuhang  
108 - * @method  
109 - */  
110 - public function edits($param){  
111 - //查看密码是否修改  
112 - $info = $this->read(['id'=>$param['id']]);  
113 - $param['password'] = base64_encode(md5($param['password']));  
114 - if($param['password'] == $info['password']){  
115 - unset($param['password']);  
116 - }  
117 - //密码加密  
118 - $rs = $this->edit($param,['id'=>$param['id']]);  
119 - if($rs === false){  
120 - return false;  
121 - }  
122 - //清空当前用户登录缓存  
123 - Cache::pull($info['token']);  
124 - return true;  
125 - }  
126 } 56 }