作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -99,16 +99,16 @@ class RemainDay extends Command @@ -99,16 +99,16 @@ class RemainDay extends Command
99 $item->remain_day = ($remain_day > 0 ? $remain_day : 0); 99 $item->remain_day = ($remain_day > 0 ? $remain_day : 0);
100 } 100 }
101 $item->save(); 101 $item->save();
102 -// if($item->remain_day == 0){  
103 -// $item->extend_type = Project::TYPE_FIVE; 102 + if($item->remain_day == 0){
  103 + $item->extend_type = Project::TYPE_FIVE;
104 // $item->site_status = Project::TYPE_ONE;//关闭站点 104 // $item->site_status = Project::TYPE_ONE;//关闭站点
105 -// //TODO::未续费网站禁止登录及通知C端禁止网站 105 + //TODO::未续费网站禁止登录及通知C端禁止网站
106 // $domainModel = new DomainInfoModel(); 106 // $domainModel = new DomainInfoModel();
107 // $domainInfos = $domainModel->read(['project_id'=>$item->id]); 107 // $domainInfos = $domainModel->read(['project_id'=>$item->id]);
108 // if($domainInfos !== false){ 108 // if($domainInfos !== false){
109 // curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/'); 109 // curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/');
110 // } 110 // }
111 -// } 111 + }
112 } 112 }
113 } 113 }
114 } 114 }
@@ -62,7 +62,7 @@ class UpdateBuildConfiguration extends Command @@ -62,7 +62,7 @@ class UpdateBuildConfiguration extends Command
62 */ 62 */
63 public function handle(){ 63 public function handle(){
64 $projectModel = new Project(); 64 $projectModel = new Project();
65 - $list = $projectModel->list(['delete_status'=>0,'id'=>3050],'id',['id'],'asc'); 65 + $list = $projectModel->list(['delete_status'=>0,'id'=>1214],'id',['id'],'asc');
66 foreach ($list as $k => $v){ 66 foreach ($list as $k => $v){
67 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 67 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
68 ProjectServer::useProject($v['id']); 68 ProjectServer::useProject($v['id']);
@@ -87,14 +87,14 @@ class UpdateBuildConfiguration extends Command @@ -87,14 +87,14 @@ class UpdateBuildConfiguration extends Command
87 // if(($product_list > 0) && ($lists == 0)){ 87 // if(($product_list > 0) && ($lists == 0)){
88 // echo date('Y-m-d H:i:s') . '需要处理的项目:'.$project_id . PHP_EOL; 88 // echo date('Y-m-d H:i:s') . '需要处理的项目:'.$project_id . PHP_EOL;
89 // } 89 // }
90 - Detail::truncate();  
91 - Column::truncate();  
92 - $c = new Column();  
93 - $c->addReturnId(['column_name'=>'product detail']); 90 +// Detail::truncate();
  91 +// Column::truncate();
  92 +// $c = new Column();
  93 +// $c->addReturnId(['column_name'=>'product detail']);
94 $productModel = new Product(); 94 $productModel = new Product();
95 $page = 1; 95 $page = 1;
96 while (true){ 96 while (true){
97 - $lists = $productModel->lists([],$page,1,['id','content','describe']); 97 + $lists = $productModel->lists(['id'=>361],$page,1,['id','content','describe']);
98 $detailModel = new Detail(); 98 $detailModel = new Detail();
99 if(!empty($lists['list'])){ 99 if(!empty($lists['list'])){
100 foreach ($lists['list'] as $k => $v){ 100 foreach ($lists['list'] as $k => $v){
@@ -105,40 +105,40 @@ class UpdateBuildConfiguration extends Command @@ -105,40 +105,40 @@ class UpdateBuildConfiguration extends Command
105 'column_id'=>1, 105 'column_id'=>1,
106 'text_type'=>1, 106 'text_type'=>1,
107 'title'=>'product detail', 107 'title'=>'product detail',
108 - 'sort'=>1, 108 + 'sort'=>2,
109 'content'=>json_encode(['content'=>$v['content'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 109 'content'=>json_encode(['content'=>$v['content'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
110 'created_at'=>date('Y-m-d H:i:s'), 110 'created_at'=>date('Y-m-d H:i:s'),
111 'updated_at'=>date('Y-m-d H:i:s') 111 'updated_at'=>date('Y-m-d H:i:s')
112 ]; 112 ];
113 $detailModel->insert($data); 113 $detailModel->insert($data);
114 } 114 }
115 - if(!empty($v['describe'])){  
116 - foreach ($v['describe'] as $key => $value){  
117 - if(isset($value['title']) && ($value['title'] == null)){  
118 - $value['title'] = '';  
119 - }  
120 - if(isset($value['text']) && ($value['text'] == null)){  
121 - $value['text'] = '';  
122 - }  
123 - if(empty($value['title'])){  
124 - continue;  
125 - }  
126 - //添加切换栏  
127 - $c = new Column();  
128 - $id = $c->addReturnId(['column_name'=>$value['title'],'product_id'=>$v['id']]);  
129 - $dataS = [  
130 - 'product_id'=>$v['id'],  
131 - 'column_id'=>$id,  
132 - 'text_type'=>1,  
133 - 'title'=>$value['title'] ?? '',  
134 - 'sort'=>$key + 1,  
135 - 'content'=>json_encode(['content'=>$value['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),  
136 - 'created_at'=>date('Y-m-d H:i:s'),  
137 - 'updated_at'=>date('Y-m-d H:i:s')  
138 - ];  
139 - $detailModel->insert($dataS);  
140 - }  
141 - } 115 +// if(!empty($v['describe'])){
  116 +// foreach ($v['describe'] as $key => $value){
  117 +// if(isset($value['title']) && ($value['title'] == null)){
  118 +// $value['title'] = '';
  119 +// }
  120 +// if(isset($value['text']) && ($value['text'] == null)){
  121 +// $value['text'] = '';
  122 +// }
  123 +// if(empty($value['title'])){
  124 +// continue;
  125 +// }
  126 +// //添加切换栏
  127 +// $c = new Column();
  128 +// $id = $c->addReturnId(['column_name'=>$value['title'],'product_id'=>$v['id']]);
  129 +// $dataS = [
  130 +// 'product_id'=>$v['id'],
  131 +// 'column_id'=>$id,
  132 +// 'text_type'=>1,
  133 +// 'title'=>$value['title'] ?? '',
  134 +// 'sort'=>$key + 1,
  135 +// 'content'=>json_encode(['content'=>$value['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
  136 +// 'created_at'=>date('Y-m-d H:i:s'),
  137 +// 'updated_at'=>date('Y-m-d H:i:s')
  138 +// ];
  139 +// $detailModel->insert($dataS);
  140 +// }
  141 +// }
142 } 142 }
143 }else{ 143 }else{
144 break; 144 break;
@@ -16,6 +16,7 @@ use App\Models\Product\Category; @@ -16,6 +16,7 @@ use App\Models\Product\Category;
16 use App\Models\Product\CategoryRelated; 16 use App\Models\Product\CategoryRelated;
17 use App\Models\Product\Keyword; 17 use App\Models\Product\Keyword;
18 use App\Models\Product\Product; 18 use App\Models\Product\Product;
  19 +use App\Models\Project\DeployOptimize;
19 use App\Models\Project\OnlineCheck; 20 use App\Models\Project\OnlineCheck;
20 use App\Models\Project\Project; 21 use App\Models\Project\Project;
21 use App\Models\RouteMap\RouteMap; 22 use App\Models\RouteMap\RouteMap;
@@ -349,4 +350,28 @@ class PrivateController extends BaseController @@ -349,4 +350,28 @@ class PrivateController extends BaseController
349 $list = array_filter(array_unique($domain)); 350 $list = array_filter(array_unique($domain));
350 return $this->success($list); 351 return $this->success($list);
351 } 352 }
  353 +
  354 + /**
  355 + * 将项目标记为广告状态
  356 + * @param Request $request
  357 + * @return false|string
  358 + */
  359 + public function markProjectAds(Request $request)
  360 + {
  361 + $company = trim($request->input('company_name'));
  362 + $project = Project::where(['company' => $company])->first();
  363 + if (empty($project))
  364 + return $this->error('未找到企业名称为:"' . $company . '"的项目');
  365 +
  366 + $optimize = DeployOptimize::where(['project_id' => $project->id])->first();
  367 + $array = [
  368 + $optimize->special,
  369 + 16
  370 + ];
  371 + $array = array_unique(array_filter($array));
  372 + $string = ',' . implode(',', $array) . ',';
  373 + $optimize->special = $string;
  374 + $optimize->save();
  375 + return $this->success();
  376 + }
352 } 377 }
@@ -931,14 +931,14 @@ class ProjectController extends BaseController @@ -931,14 +931,14 @@ class ProjectController extends BaseController
931 'id'=>'required', 931 'id'=>'required',
932 'aicc'=>'required', 932 'aicc'=>'required',
933 'hagro'=>'required', 933 'hagro'=>'required',
934 - 'exclusive_aicc_day'=>'required',  
935 - 'exclusive_hagro_day'=>'required', 934 +// 'exclusive_aicc_day'=>'required',
  935 +// 'exclusive_hagro_day'=>'required',
936 ],[ 936 ],[
937 'id.required' => 'id不能为空', 937 'id.required' => 'id不能为空',
938 'aicc.required' => 'aicc是否开启不能为空', 938 'aicc.required' => 'aicc是否开启不能为空',
939 'hagro.required' => 'hagro是否开启不能为空', 939 'hagro.required' => 'hagro是否开启不能为空',
940 - 'exclusive_aicc_day.required' => '服务天数不能为空',  
941 - 'exclusive_hagro_day.required' => '服务天数不能为空', 940 +// 'exclusive_aicc_day.required' => '服务天数不能为空',
  941 +// 'exclusive_hagro_day.required' => '服务天数不能为空',
942 ]); 942 ]);
943 $logic->saveOtherProject(); 943 $logic->saveOtherProject();
944 $this->response('success'); 944 $this->response('success');
@@ -198,15 +198,7 @@ class LoginController extends BaseController @@ -198,15 +198,7 @@ class LoginController extends BaseController
198 $arrayData = json_decode($jsonData, true); 198 $arrayData = json_decode($jsonData, true);
199 //gh_27174ac5c9d8,gh_27174ac5c9d8 199 //gh_27174ac5c9d8,gh_27174ac5c9d8
200 $data = $this->setWechat($arrayData['FromUserName'],$arrayData['EventKey']); 200 $data = $this->setWechat($arrayData['FromUserName'],$arrayData['EventKey']);
201 - if($data['code'] == 0){//登录失败,请先绑定  
202 $resMessage = $data['message']; 201 $resMessage = $data['message'];
203 - }elseif($data['code'] == 1){  
204 - $resMessage = $data['message'];  
205 - }elseif($data['code'] == 2){  
206 - $resMessage = $data['message'];  
207 - }else{  
208 - $resMessage = $data['message'];  
209 - }  
210 Cache::add($arrayData['Ticket'],$data,300); 202 Cache::add($arrayData['Ticket'],$data,300);
211 return "<xml> 203 return "<xml>
212 <ToUserName><![CDATA[$message->FromUserName]]></ToUserName> 204 <ToUserName><![CDATA[$message->FromUserName]]></ToUserName>
@@ -786,7 +786,7 @@ class ProjectLogic extends BaseLogic @@ -786,7 +786,7 @@ class ProjectLogic extends BaseLogic
786 //获取当前数据详情 786 //获取当前数据详情
787 $projectInfo = $this->getProjectInfo($this->param['id']); 787 $projectInfo = $this->getProjectInfo($this->param['id']);
788 //aicc if (($projectInfo['aicc'] == Project::TYPE_ZERO) && ($this->param['aicc'] == Project::TYPE_ONE)) 从关闭到开启状态才同步, 改成只要是开启状态就同步 788 //aicc if (($projectInfo['aicc'] == Project::TYPE_ZERO) && ($this->param['aicc'] == Project::TYPE_ONE)) 从关闭到开启状态才同步, 改成只要是开启状态就同步
789 - if($this->param['aicc'] == Project::TYPE_ONE){ 789 + if($this->param['aicc'] == Project::TYPE_ONE && !empty($this->param['exclusive_aicc_day'])){
790 $data = [ 790 $data = [
791 'company_name'=>$projectInfo['company'], 791 'company_name'=>$projectInfo['company'],
792 'principal_mobile'=>$projectInfo['mobile'], 792 'principal_mobile'=>$projectInfo['mobile'],
@@ -798,7 +798,7 @@ class ProjectLogic extends BaseLogic @@ -798,7 +798,7 @@ class ProjectLogic extends BaseLogic
798 $this->toAicc($data); 798 $this->toAicc($data);
799 } 799 }
800 //黑格 从关闭到开启状态才同步, 改成只要是开启状态就同步, 需要修改有效时间 800 //黑格 从关闭到开启状态才同步, 改成只要是开启状态就同步, 需要修改有效时间
801 - if($this->param['hagro'] == Project::TYPE_ONE){ 801 + if($this->param['hagro'] == Project::TYPE_ONE && !empty($this->param['exclusive_hagro_day'])){
802 $data = [ 802 $data = [
803 'company_name'=>$projectInfo['company'], 803 'company_name'=>$projectInfo['company'],
804 'principal_mobile'=>$projectInfo['mobile'], 804 'principal_mobile'=>$projectInfo['mobile'],
@@ -809,6 +809,12 @@ class ProjectLogic extends BaseLogic @@ -809,6 +809,12 @@ class ProjectLogic extends BaseLogic
809 ]; 809 ];
810 $this->toHagro($data); 810 $this->toHagro($data);
811 } 811 }
  812 + if(empty($this->param['exclusive_aicc_day'])){
  813 + unset($this->param['exclusive_aicc_day']);
  814 + }
  815 + if(empty($this->param['exclusive_hagro_day'])){
  816 + unset($this->param['exclusive_hagro_day']);
  817 + }
812 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 818 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
813 if($rs === false){ 819 if($rs === false){
814 $this->fail('保存失败,请联系管理员'); 820 $this->fail('保存失败,请联系管理员');
@@ -358,9 +358,9 @@ class UserLoginLogic @@ -358,9 +358,9 @@ class UserLoginLogic
358 'message'=>'登陆成功', 358 'message'=>'登陆成功',
359 'data'=>$info 359 'data'=>$info
360 ]; 360 ];
361 - }  
362 Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(), 361 Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(),
363 'project_id'=>$info['project_id'], 'type'=>2 ,'remark' => '自动登录,用户微信扫码']); 362 'project_id'=>$info['project_id'], 'type'=>2 ,'remark' => '自动登录,用户微信扫码']);
  363 + }
364 return $this->success($data); 364 return $this->success($data);
365 } 365 }
366 366
@@ -54,6 +54,8 @@ Route::any('get_project_product', [\App\Http\Controllers\Api\PrivateController:: @@ -54,6 +54,8 @@ Route::any('get_project_product', [\App\Http\Controllers\Api\PrivateController::
54 // --------------------- 站群服务 ------------------------------------------ 54 // --------------------- 站群服务 ------------------------------------------
55 // --------------------- 监控服务 ------------------------------------------ 55 // --------------------- 监控服务 ------------------------------------------
56 Route::any('get_project_online', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectOnline'])->name('api.get_project_online'); 56 Route::any('get_project_online', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectOnline'])->name('api.get_project_online');
  57 +// 将项目标记为广告状态
  58 +Route::any('mark_project_ads', [\App\Http\Controllers\Api\PrivateController::class, 'markProjectAds'])->name('api.mark_project_ads');
57 59
58 //自建站接口转接 60 //自建站接口转接
59 Route::post('selfSiteApi', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteApi']); 61 Route::post('selfSiteApi', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteApi']);