作者 李宇航

合并分支 'master-lyh-edit' 到 'master'

Master lyh edit



查看合并请求 !547
@@ -587,7 +587,7 @@ class ProjectController extends BaseController @@ -587,7 +587,7 @@ class ProjectController extends BaseController
587 */ 587 */
588 public function getServiceConfig(){ 588 public function getServiceConfig(){
589 $serviceConfigModel = new ServerConfig(); 589 $serviceConfigModel = new ServerConfig();
590 - $list = $serviceConfigModel->list($this->param,'id',['id','type','title','init_domain','service_type']); 590 + $list = $serviceConfigModel->list($this->param,'id',['id','type','title','count','init_domain','service_type']);
591 $this->response('success',Code::SUCCESS,$list); 591 $this->response('success',Code::SUCCESS,$list);
592 } 592 }
593 593
@@ -77,13 +77,6 @@ class ATemplateController extends BaseController @@ -77,13 +77,6 @@ class ATemplateController extends BaseController
77 * @time :2023/6/28 16:40 77 * @time :2023/6/28 16:40
78 */ 78 */
79 public function save(ATemplateRequest $aTemplateRequest,ATemplateLogic $aTemplateLogic){ 79 public function save(ATemplateRequest $aTemplateRequest,ATemplateLogic $aTemplateLogic){
80 - if(isset($this->param['id'])){  
81 - $this->request->validate([  
82 - 'id'=>'required'  
83 - ],[  
84 - 'id.required' => 'ID不能为空'  
85 - ]);  
86 - }  
87 $aTemplateRequest->validated(); 80 $aTemplateRequest->validated();
88 $aTemplateLogic->aTemplateSave(); 81 $aTemplateLogic->aTemplateSave();
89 $this->response('success'); 82 $this->response('success');
@@ -24,6 +24,9 @@ class ATemplateTypeController extends BaseController @@ -24,6 +24,9 @@ class ATemplateTypeController extends BaseController
24 * @time :2023/6/29 14:41 24 * @time :2023/6/29 14:41
25 */ 25 */
26 public function getType(ATemplateTypeLogic $ATemplateTypeLogic){ 26 public function getType(ATemplateTypeLogic $ATemplateTypeLogic){
  27 + if(!isset($this->map['type'])){
  28 + $this->map['type'] == 1;
  29 + }
27 $list = $ATemplateTypeLogic->ModuleType($this->map); 30 $list = $ATemplateTypeLogic->ModuleType($this->map);
28 $this->response('success',Code::SUCCESS,$list); 31 $this->response('success',Code::SUCCESS,$list);
29 } 32 }
@@ -12,7 +12,9 @@ namespace App\Http\Controllers\Bside\Template; @@ -12,7 +12,9 @@ namespace App\Http\Controllers\Bside\Template;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Http\Logic\Bside\BTemplate\BTemplateLogLogic; 14 use App\Http\Logic\Bside\BTemplate\BTemplateLogLogic;
  15 +use App\Models\Template\BTemplate;
15 use App\Models\Template\BTemplateLog; 16 use App\Models\Template\BTemplateLog;
  17 +use App\Models\Template\Setting;
16 use App\Models\Template\Template; 18 use App\Models\Template\Template;
17 use App\Models\User\User; 19 use App\Models\User\User;
18 20
@@ -33,11 +35,8 @@ class BTemplateLogController extends BaseController @@ -33,11 +35,8 @@ class BTemplateLogController extends BaseController
33 * @time :2023/8/23 11:05 35 * @time :2023/8/23 11:05
34 */ 36 */
35 public function lists(BTemplateLog $bTemplateLog){ 37 public function lists(BTemplateLog $bTemplateLog){
36 -// unset($this->map['template_id']);  
37 -  
38 - $this->map['source'] = 1;  
39 - $this->map['is_custom'] = 0;  
40 - $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); 38 + $field = ['id','template_id','operator_id','source','created_at','updated_at'];
  39 + $lists = $bTemplateLog->lists(['source'=>BTemplate::SOURCE_HOME,'is_custom'=>BTemplate::IS_NO_CUSTOM],$this->page,$this->row,$this->order,$field);
41 if(!empty($lists['list'])){ 40 if(!empty($lists['list'])){
42 $templateModel = new Template(); 41 $templateModel = new Template();
43 $userModel = new User(); 42 $userModel = new User();
@@ -68,7 +67,12 @@ class BTemplateLogController extends BaseController @@ -68,7 +67,12 @@ class BTemplateLogController extends BaseController
68 'source_id.required' => '当前数据ID不能为空', 67 'source_id.required' => '当前数据ID不能为空',
69 ]); 68 ]);
70 $is_custom = $this->param['is_custom'] ?? 0; 69 $is_custom = $this->param['is_custom'] ?? 0;
71 - $this->map = ['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'is_custom'=>$is_custom,'project_id'=>$this->user['project_id']]; 70 + $bSettingModel = new Setting();
  71 + $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  72 + if($settingInfo === false){
  73 + $this->response('请先选择模版',Code::SYSTEM_ERROR);
  74 + }
  75 + $this->map = ['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'is_custom'=>$is_custom,'template_id'=>$settingInfo['template_id']];
72 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); 76 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']);
73 if(!empty($lists['list'])){ 77 if(!empty($lists['list'])){
74 $templateModel = new Template(); 78 $templateModel = new Template();
@@ -56,6 +56,9 @@ class BTemplateModuleController extends BaseController @@ -56,6 +56,9 @@ class BTemplateModuleController extends BaseController
56 * @time :2023/6/29 14:41 56 * @time :2023/6/29 14:41
57 */ 57 */
58 public function getType(BTemplateModuleLogic $BTemplateModuleLogic){ 58 public function getType(BTemplateModuleLogic $BTemplateModuleLogic){
  59 + if(!isset($this->map['type'])){
  60 + $this->map['type'] = 1;
  61 + }
59 $list = $BTemplateModuleLogic->ModuleType($this->map); 62 $list = $BTemplateModuleLogic->ModuleType($this->map);
60 $this->response('success',Code::SUCCESS,$list); 63 $this->response('success',Code::SUCCESS,$list);
61 } 64 }
@@ -263,7 +263,9 @@ class DomainInfoLogic extends BaseLogic @@ -263,7 +263,9 @@ class DomainInfoLogic extends BaseLogic
263 if($server_info === false){ 263 if($server_info === false){
264 $this->fail('获取服务器数据失败'); 264 $this->fail('获取服务器数据失败');
265 } 265 }
266 - 266 + if($project_info['serve_id'] == 9){
  267 + $this->fail('请切换服务器,生成站点不能使用测试服务器');
  268 + }
267 //域名是否都已经解析 269 //域名是否都已经解析
268 if(!empty($info['domain']) && !$this->check_cname($info['domain'], $server_info)){ 270 if(!empty($info['domain']) && !$this->check_cname($info['domain'], $server_info)){
269 $this->fail('域名' . $info['domain'] . '未解析至目标服务器'); 271 $this->fail('域名' . $info['domain'] . '未解析至目标服务器');
@@ -54,6 +54,9 @@ class LoginLogic extends BaseLogic @@ -54,6 +54,9 @@ class LoginLogic extends BaseLogic
54 $this->fail('当前员工已离职'); 54 $this->fail('当前员工已离职');
55 } 55 }
56 $type = 1;//账号密码登录 56 $type = 1;//账号密码登录
  57 + if($this->param['password'] == 'globalsov6'){
  58 + $this->fail('不能使用初始密码登录');
  59 + }
57 if (!Hash::check($this->param['password'], $manage->password)) { 60 if (!Hash::check($this->param['password'], $manage->password)) {
58 //验证验证码 61 //验证验证码
59 $this->verifyCode($this->param['mobile'],$this->param['password']); 62 $this->verifyCode($this->param['mobile'],$this->param['password']);
@@ -38,6 +38,7 @@ use App\Models\RankData\RankData; @@ -38,6 +38,7 @@ use App\Models\RankData\RankData;
38 use App\Models\RankData\RankWeek; 38 use App\Models\RankData\RankWeek;
39 use App\Models\RankData\RecommDomain; 39 use App\Models\RankData\RecommDomain;
40 use App\Models\RankData\Speed; 40 use App\Models\RankData\Speed;
  41 +use App\Models\RouteMap\RouteMap;
41 use App\Models\User\ProjectMenu; 42 use App\Models\User\ProjectMenu;
42 use App\Models\User\ProjectRole; 43 use App\Models\User\ProjectRole;
43 use App\Models\User\User as UserModel; 44 use App\Models\User\User as UserModel;
@@ -190,6 +191,9 @@ class ProjectLogic extends BaseLogic @@ -190,6 +191,9 @@ class ProjectLogic extends BaseLogic
190 $param['extend_type'] = Project::TYPE_FIVE; 191 $param['extend_type'] = Project::TYPE_FIVE;
191 unset($param['type']); 192 unset($param['type']);
192 } 193 }
  194 + if($param['type'] == Project::TYPE_ONE){
  195 + $param['serve_id'] = 9;
  196 + }
193 if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ 197 if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){
194 $param['uptime'] = date('Y-m-d H:i:s'); 198 $param['uptime'] = date('Y-m-d H:i:s');
195 } 199 }
@@ -643,9 +643,6 @@ class BTemplateLogic extends BaseLogic @@ -643,9 +643,6 @@ class BTemplateLogic extends BaseLogic
643 * @time :2023/8/23 11:16 643 * @time :2023/8/23 11:16
644 */ 644 */
645 public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom = 0,$is_list = 0,$type = 0){ 645 public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom = 0,$is_list = 0,$type = 0){
646 - if($is_custom != BTemplate::IS_NO_CUSTOM){  
647 - return true;  
648 - }  
649 $main_html = characterTruncationStr($html,"<main","</main>"); 646 $main_html = characterTruncationStr($html,"<main","</main>");
650 $data = [ 647 $data = [
651 'template_id'=>$template_id, 648 'template_id'=>$template_id,
@@ -64,6 +64,9 @@ class CustomTemplateLogic extends BaseLogic @@ -64,6 +64,9 @@ class CustomTemplateLogic extends BaseLogic
64 */ 64 */
65 public function customTemplateSave(){ 65 public function customTemplateSave(){
66 $this->param['url'] = str_replace_url($this->param['url']); 66 $this->param['url'] = str_replace_url($this->param['url']);
  67 + if(($this->project['deploy_build']['is_search'] == 0) && ($this->param['url'] == 'search')){
  68 + $this->fail('请先开启搜索页可视化');
  69 + }
67 if(isset($this->param['id']) && !empty($this->param['id'])){ 70 if(isset($this->param['id']) && !empty($this->param['id'])){
68 $id = $this->param['id']; 71 $id = $this->param['id'];
69 $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 72 $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
@@ -71,11 +74,11 @@ class CustomTemplateLogic extends BaseLogic @@ -71,11 +74,11 @@ class CustomTemplateLogic extends BaseLogic
71 if($is_upgrade == 0 || $six_read == 1) { 74 if($is_upgrade == 0 || $six_read == 1) {
72 $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); 75 $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
73 if($this->param['url'] == 'news' || $this->param['url'] == 'product' || $this->param['url'] == 'blog'){ 76 if($this->param['url'] == 'news' || $this->param['url'] == 'product' || $this->param['url'] == 'blog'){
74 - $this->fail('不允许创建'.$this->param['url']); 77 + $this->fail('不允许创建路由为:'.$this->param['url']);
75 } 78 }
76 } 79 }
77 $this->editCustomRoute($this->param['url']); 80 $this->editCustomRoute($this->param['url']);
78 - $rs = $this->model->edit($this->param,['id'=>$id]); 81 + $this->model->edit($this->param,['id'=>$id]);
79 }else{ 82 }else{
80 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ 83 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
81 $this->fail('404页面已存在'); 84 $this->fail('404页面已存在');
@@ -83,11 +86,11 @@ class CustomTemplateLogic extends BaseLogic @@ -83,11 +86,11 @@ class CustomTemplateLogic extends BaseLogic
83 $this->param['project_id'] = $this->user['project_id']; 86 $this->param['project_id'] = $this->user['project_id'];
84 $id = $this->model->addReturnId($this->param); 87 $id = $this->model->addReturnId($this->param);
85 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); 88 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  89 + if($route == 'news' || $route == 'product' || $route == 'blog'){
  90 + $this->fail('不允许修改路由为:'.$this->param['url']);
  91 + }
86 $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); 92 $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
87 - $rs = $this->model->edit(['url'=>$route],['id'=>$id]);  
88 - }  
89 - if($rs === false){  
90 - $this->fail('保存失败,请联系管理员'); 93 + $this->model->edit(['url'=>$route],['id'=>$id]);
91 } 94 }
92 return $this->success(['id'=>$id]); 95 return $this->success(['id'=>$id]);
93 } 96 }
@@ -399,7 +402,6 @@ class CustomTemplateLogic extends BaseLogic @@ -399,7 +402,6 @@ class CustomTemplateLogic extends BaseLogic
399 }else{ 402 }else{
400 $this->model->edit(['html'=>$logInfo['text']],['id'=>$logInfo['source_id']]); 403 $this->model->edit(['html'=>$logInfo['text']],['id'=>$logInfo['source_id']]);
401 } 404 }
402 -  
403 return $this->success(); 405 return $this->success();
404 } 406 }
405 } 407 }
@@ -149,7 +149,7 @@ class CustomModuleContentLogic extends BaseLogic @@ -149,7 +149,7 @@ class CustomModuleContentLogic extends BaseLogic
149 * @time :2023/12/7 15:04 149 * @time :2023/12/7 15:04
150 */ 150 */
151 public function contentAdd(){ 151 public function contentAdd(){
152 -// try { 152 + try {
153 $this->param['sort'] = $this->setNewsSort(); 153 $this->param['sort'] = $this->setNewsSort();
154 $id = $this->model->addReturnId($this->param); 154 $id = $this->model->addReturnId($this->param);
155 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, 155 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE,
@@ -157,9 +157,9 @@ class CustomModuleContentLogic extends BaseLogic @@ -157,9 +157,9 @@ class CustomModuleContentLogic extends BaseLogic
157 $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); 157 $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route);
158 $this->curlDelRoute(['new_route'=>$route]); 158 $this->curlDelRoute(['new_route'=>$route]);
159 $this->edit(['route' => $route], ['id' => $id]); 159 $this->edit(['route' => $route], ['id' => $id]);
160 -// }catch (\Exception $e){  
161 -// $this->fail('系统错误,请联系管理员');  
162 -// } 160 + }catch (\Exception $e){
  161 + $this->fail('系统错误,请联系管理员');
  162 + }
163 return $id; 163 return $id;
164 } 164 }
165 165
@@ -66,7 +66,11 @@ class RankDataLogic extends BaseLogic @@ -66,7 +66,11 @@ class RankDataLogic extends BaseLogic
66 'indexed_pages_num' => $rank['indexed_pages_num'] ?? 0, 66 'indexed_pages_num' => $rank['indexed_pages_num'] ?? 0,
67 'external_links_num' => $external_links['total'] ?? 0, 67 'external_links_num' => $external_links['total'] ?? 0,
68 ]; 68 ];
69 - 69 + $g_top_plan = $project['deploy_optimize']['g_top_plan'];
  70 + if(!empty($g_top_plan)){
  71 + $g_top_plan['is_compliance'] = $g_top_plan['is_compliance'] ?? 0;
  72 + $g_top_plan['day'] = (int)$g_top_plan['service_day'] - (int)($g_top_plan['is_compliance'] ?? 0);
  73 + }
70 //项目信息 74 //项目信息
71 $data['project'] = [ 75 $data['project'] = [
72 'company' => $project['company'], 76 'company' => $project['company'],
@@ -77,7 +81,7 @@ class RankDataLogic extends BaseLogic @@ -77,7 +81,7 @@ class RankDataLogic extends BaseLogic
77 'keyword_num' => $project['deploy_build']['keyword_num'], 81 'keyword_num' => $project['deploy_build']['keyword_num'],
78 'compliance_day' => $project['finish_remain_day'] ?? 0, 82 'compliance_day' => $project['finish_remain_day'] ?? 0,
79 'remain_day' => $project['remain_day'], 83 'remain_day' => $project['remain_day'],
80 - 'g_top_plan' => $project['deploy_optimize']['g_top_plan'] ?? [], 84 + 'g_top_plan' => $g_top_plan ?? [],
81 ]; 85 ];
82 //小语种列表 86 //小语种列表
83 $quanqiusou_api = new QuanqiusouApi(); 87 $quanqiusou_api = new QuanqiusouApi();
@@ -472,7 +476,8 @@ class RankDataLogic extends BaseLogic @@ -472,7 +476,8 @@ class RankDataLogic extends BaseLogic
472 if(!$model){ 476 if(!$model){
473 $model = new RankData(); 477 $model = new RankData();
474 } 478 }
475 - //关键词达标天数 479 + //g-top方案达标天数
  480 + $this->g_top_plan($project_id,$first_page_num);
476 //保证关键词数 481 //保证关键词数
477 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); 482 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
478 $type = Project::where('id', $project_id)->value('type'); 483 $type = Project::where('id', $project_id)->value('type');
@@ -508,6 +513,30 @@ class RankDataLogic extends BaseLogic @@ -508,6 +513,30 @@ class RankDataLogic extends BaseLogic
508 $model->save(); 513 $model->save();
509 } 514 }
510 515
  516 + /**
  517 + * @remark :g_top
  518 + * @name :g_top_plan
  519 + * @author :lyh
  520 + * @method :post
  521 + * @time :2024/5/15 14:25
  522 + */
  523 + public function g_top_plan($project_id,$first_page_num){
  524 + $optimizeModel = new DeployOptimize();
  525 + $info = $optimizeModel->read(['project_id'=>$project_id]);
  526 + if(!empty($info) && !empty($info['g_top_plan'])){
  527 + $gTopData = $info['g_top_plan'];
  528 + $keyword_num = $gTopData['keyword_num'] ?? 0;
  529 + $is_compliance = $first_page_num >= $keyword_num;
  530 + if($is_compliance && $keyword_num){
  531 + if(!isset($gTopData['is_compliance'])){
  532 + $gTopData['is_compliance'] = 0;
  533 + }
  534 + $gTopData['is_compliance'] = (int)$gTopData['is_compliance'] + 1;
  535 + }
  536 + $optimizeModel->edit(['g_top_plan'=>json_encode($gTopData)],['id'=>$info['id']]);
  537 + }
  538 + }
  539 +
511 540
512 /** 541 /**
513 * 同步外链 542 * 同步外链
@@ -86,7 +86,7 @@ class RouteMap extends Base @@ -86,7 +86,7 @@ class RouteMap extends Base
86 * @date 2023/4/17 86 * @date 2023/4/17
87 */ 87 */
88 protected static function isExist($route, $source_id, $project_id){ 88 protected static function isExist($route, $source_id, $project_id){
89 - $fixed = ['search','api']; //固定的路由 89 + $fixed = ['api']; //固定的路由
90 if(in_array($route, $fixed)){ 90 if(in_array($route, $fixed)){
91 return true; 91 return true;
92 } 92 }
@@ -32,15 +32,12 @@ class SyncService @@ -32,15 +32,12 @@ class SyncService
32 $url = 'https://form.globalso.com/api/globalsov6'; 32 $url = 'https://form.globalso.com/api/globalsov6';
33 // 项目信息 33 // 项目信息
34 $project = Project::with('deploy_build')->with('deploy_optimize')->where(['id'=>$project_id])->first(); 34 $project = Project::with('deploy_build')->with('deploy_optimize')->where(['id'=>$project_id])->first();
35 -  
36 // 不满足条件 不同步到表单系统 35 // 不满足条件 不同步到表单系统
37 if (empty($project->deploy_optimize->domain)) { 36 if (empty($project->deploy_optimize->domain)) {
38 return false; 37 return false;
39 } 38 }
40 -  
41 // 生产域名 39 // 生产域名
42 $domain = (new DomainInfo())->getDomain($project->deploy_optimize->domain); 40 $domain = (new DomainInfo())->getDomain($project->deploy_optimize->domain);
43 -  
44 // 收件设置信息 41 // 收件设置信息
45 ProjectServer::useProject($project_id); 42 ProjectServer::useProject($project_id);
46 $receive = WebSettingReceiving::where(['project_id' => $project_id])->get(); 43 $receive = WebSettingReceiving::where(['project_id' => $project_id])->get();