Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
8 个修改的文件
包含
190 行增加
和
51 行删除
| @@ -33,9 +33,8 @@ class BTemplateLogController extends BaseController | @@ -33,9 +33,8 @@ class BTemplateLogController extends BaseController | ||
| 33 | * @time :2023/8/23 11:05 | 33 | * @time :2023/8/23 11:05 |
| 34 | */ | 34 | */ |
| 35 | public function lists(BTemplateLog $bTemplateLog){ | 35 | public function lists(BTemplateLog $bTemplateLog){ |
| 36 | - unset($this->map['template_id']); | 36 | +// unset($this->map['template_id']); |
| 37 | $this->map['project_id'] = $this->user['project_id']; | 37 | $this->map['project_id'] = $this->user['project_id']; |
| 38 | - $this->map['source'] = 1; | ||
| 39 | $this->map['is_custom'] = 0; | 38 | $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']); | 39 | $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); |
| 41 | if(!empty($lists['list'])){ | 40 | if(!empty($lists['list'])){ |
| @@ -6,6 +6,8 @@ use App\Enums\Common\Code; | @@ -6,6 +6,8 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 7 | use App\Http\Logic\Bside\BTemplate\CustomTemplateLogic; | 7 | use App\Http\Logic\Bside\BTemplate\CustomTemplateLogic; |
| 8 | use App\Http\Requests\Bside\Template\CustomTemplateRequest; | 8 | use App\Http\Requests\Bside\Template\CustomTemplateRequest; |
| 9 | +use App\Models\Template\BTemplate; | ||
| 10 | +use App\Models\Template\BTemplateLog; | ||
| 9 | 11 | ||
| 10 | /** | 12 | /** |
| 11 | * @remark :自定义模块 | 13 | * @remark :自定义模块 |
| @@ -107,4 +109,39 @@ class CustomTemplateController extends BaseController | @@ -107,4 +109,39 @@ class CustomTemplateController extends BaseController | ||
| 107 | $customTemplateLogic->saveHtml(); | 109 | $customTemplateLogic->saveHtml(); |
| 108 | $this->response('success'); | 110 | $this->response('success'); |
| 109 | } | 111 | } |
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * @remark :获取自定义界面的保存记录 | ||
| 115 | + * @name :getCustomTemplateLog | ||
| 116 | + * @author :lyh | ||
| 117 | + * @method :post | ||
| 118 | + * @time :2024/4/23 11:07 | ||
| 119 | + */ | ||
| 120 | + public function getCustomTemplateLog(BTemplateLog $bTemplateLog){ | ||
| 121 | + $this->request->validate([ | ||
| 122 | + 'id'=>['required'], | ||
| 123 | + ],[ | ||
| 124 | + 'id.required' => 'ID不能为空', | ||
| 125 | + ]); | ||
| 126 | + $this->map['source'] = 9; | ||
| 127 | + $lists = $bTemplateLog->lists($this->map,$this->page,$this->row); | ||
| 128 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * @remark :还原单页面记录 | ||
| 133 | + * @name :rollbackVersion | ||
| 134 | + * @author :lyh | ||
| 135 | + * @method :post | ||
| 136 | + * @time :2024/4/23 13:58 | ||
| 137 | + */ | ||
| 138 | + public function rollbackVersion(CustomTemplateLogic $logic){ | ||
| 139 | + $this->request->validate([ | ||
| 140 | + 'id'=>['required'], | ||
| 141 | + ],[ | ||
| 142 | + 'id.required' => '模版ID不能为空', | ||
| 143 | + ]); | ||
| 144 | + $logic->saveRollbackVersion(); | ||
| 145 | + $this->response('success'); | ||
| 146 | + } | ||
| 110 | } | 147 | } |
| @@ -353,6 +353,7 @@ class ProjectLogic extends BaseLogic | @@ -353,6 +353,7 @@ class ProjectLogic extends BaseLogic | ||
| 353 | if(empty($zh)){ | 353 | if(empty($zh)){ |
| 354 | continue; | 354 | continue; |
| 355 | } | 355 | } |
| 356 | + //获取小语种达标天数 | ||
| 356 | $result['language'] = $zh['chinese']; | 357 | $result['language'] = $zh['chinese']; |
| 357 | $result['lang'] = $v['lang']; | 358 | $result['lang'] = $v['lang']; |
| 358 | $result['created_at'] = date('Y-m-d H:i:s'); | 359 | $result['created_at'] = date('Y-m-d H:i:s'); |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Http\Logic\Bside\BTemplate; | 10 | namespace App\Http\Logic\Bside\BTemplate; |
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | +use App\Models\Project\PageSetting; | ||
| 13 | use App\Models\Service\Service as ServiceSettingModel; | 14 | use App\Models\Service\Service as ServiceSettingModel; |
| 14 | use App\Models\Template\BTemplate; | 15 | use App\Models\Template\BTemplate; |
| 15 | use App\Models\Template\BTemplateCommon; | 16 | use App\Models\Template\BTemplateCommon; |
| @@ -39,38 +40,76 @@ class BTemplateLogLogic extends BaseLogic | @@ -39,38 +40,76 @@ class BTemplateLogLogic extends BaseLogic | ||
| 39 | $this->fail('error'); | 40 | $this->fail('error'); |
| 40 | } | 41 | } |
| 41 | $bTemplateModel = new BTemplate(); | 42 | $bTemplateModel = new BTemplate(); |
| 42 | - if($info['template_id'] == 0){//定制项目 | ||
| 43 | - //TODO::还原头部+底部 | ||
| 44 | - $bTemplateModel->edit(['html'=>$info['text']],['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); | ||
| 45 | - return $this->success(); | ||
| 46 | - } | ||
| 47 | //演示项目,不允许其他号码编辑 | 43 | //演示项目,不允许其他号码编辑 |
| 48 | if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){ | 44 | if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){ |
| 49 | $this->fail('演示项目仅支持演示功能,无法更改首页'); | 45 | $this->fail('演示项目仅支持演示功能,无法更改首页'); |
| 50 | } | 46 | } |
| 51 | - //获取当前项目的模版 | 47 | + if($info['template_id'] == 0) {//todo::定制项目 |
| 48 | + return $this->rollBackCustomized($info); | ||
| 49 | + } | ||
| 50 | + //TODO::非定制项目,获取当前项目的模版 | ||
| 51 | + return $this->rollBackNoCustomized($info); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * @remark :定制页面还原 | ||
| 56 | + * @name :rollBackCustomized | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2024/4/23 14:36 | ||
| 60 | + */ | ||
| 61 | + public function rollBackCustomized($info){ | ||
| 62 | + $bTemplateModel = new BTemplate(); | ||
| 63 | + $condition = ['template_id'=>0,'source'=>$info['source'],'source_id'=>$info['source_id'], | ||
| 64 | + 'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom']]; | ||
| 65 | + //TODO::还原头部+底部 | ||
| 66 | + $bTemplateModel->edit(['html'=>$info['text']],$condition); | ||
| 67 | + $commonData = [ | ||
| 68 | + 'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'], | ||
| 69 | + 'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css'] | ||
| 70 | + ]; | ||
| 71 | + $type = $this->getCustomizedType($info['source'],$info['is_list']); | ||
| 72 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 73 | + $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]); | ||
| 74 | + return $this->success(); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * @remark :非定制界面还原 | ||
| 79 | + * @name :rollBackNoCustomized | ||
| 80 | + * @author :lyh | ||
| 81 | + * @method :post | ||
| 82 | + * @time :2024/4/23 14:38 | ||
| 83 | + */ | ||
| 84 | + public function rollBackNoCustomized($info){ | ||
| 52 | $bSettingModel = new Setting(); | 85 | $bSettingModel = new Setting(); |
| 53 | $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); | 86 | $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); |
| 54 | if($settingInfo === false){ | 87 | if($settingInfo === false){ |
| 55 | $this->fail('请先选择模版'); | 88 | $this->fail('请先选择模版'); |
| 56 | } | 89 | } |
| 57 | - //切换模版 | ||
| 58 | - if($info['template_id'] != $settingInfo['template_id']){ | ||
| 59 | - $bSettingModel->edit(['template_id'=>$info['template_id']],['id'=>$settingInfo['id']]); | ||
| 60 | - } | 90 | + $bTemplateModel = new BTemplate(); |
| 61 | try { | 91 | try { |
| 62 | - $data = $this->setParam($info); | ||
| 63 | - $bTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); | ||
| 64 | - $commonData = $this->setCommonParam($info); | 92 | + //切换模版 |
| 93 | + if($info['template_id'] != $settingInfo['template_id']){ | ||
| 94 | + $bSettingModel->edit(['template_id'=>$info['template_id']],['id'=>$settingInfo['id']]); | ||
| 95 | + } | ||
| 96 | + $data = ['main_html'=>$info['main_html'], 'main_css'=>$info['main_css']]; | ||
| 97 | + $condition = ['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id'], | ||
| 98 | + 'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom']]; | ||
| 99 | + $bTemplateModel->edit($data,$condition); | ||
| 100 | + //还原头部+底部 | ||
| 101 | + $commonData = [ | ||
| 102 | + 'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'], 'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css'] | ||
| 103 | + ]; | ||
| 65 | $commonTemplateModel = new BTemplateCommon(); | 104 | $commonTemplateModel = new BTemplateCommon(); |
| 66 | - $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]); | ||
| 67 | - //更新所有界面的other | 105 | + $type = $this->getType($info['source'],$info['is_list'],$info['is_custom']); |
| 106 | + $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]); | ||
| 68 | if(!empty($info['other'])){ | 107 | if(!empty($info['other'])){ |
| 69 | - $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); | 108 | + $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$info['type']]); |
| 70 | }else{ | 109 | }else{ |
| 71 | $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); | 110 | $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 72 | $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | 111 | $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); |
| 73 | - $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); | 112 | + $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$type]); |
| 74 | } | 113 | } |
| 75 | }catch (\Exception $e){ | 114 | }catch (\Exception $e){ |
| 76 | $this->fail('系统错误,请联系管理员'); | 115 | $this->fail('系统错误,请联系管理员'); |
| @@ -79,35 +118,67 @@ class BTemplateLogLogic extends BaseLogic | @@ -79,35 +118,67 @@ class BTemplateLogLogic extends BaseLogic | ||
| 79 | } | 118 | } |
| 80 | 119 | ||
| 81 | /** | 120 | /** |
| 82 | - * @remark :设置回滚参数 | ||
| 83 | - * @name :setParam | 121 | + * @remark :定制页面头部类型---根据source获取type类型 |
| 122 | + * @name :getType | ||
| 84 | * @author :lyh | 123 | * @author :lyh |
| 85 | * @method :post | 124 | * @method :post |
| 86 | - * @time :2023/8/23 14:18 | 125 | + * @time :2023/11/16 11:20 |
| 87 | */ | 126 | */ |
| 88 | - public function setParam($info){ | ||
| 89 | - $data = [ | ||
| 90 | - 'main_html'=>$info['main_html'], | ||
| 91 | - 'main_css'=>$info['main_css'], | ||
| 92 | - ]; | ||
| 93 | - return $this->success($data); | 127 | + public function getCustomizedType($source,$is_list){ |
| 128 | + $type = BTemplate::TYPE_HOME; | ||
| 129 | + if($source == BTemplate::SOURCE_PRODUCT){ | ||
| 130 | + if($is_list == BTemplate::IS_LIST){ | ||
| 131 | + $type = BTemplate::TYPE_PRODUCT_LIST; | ||
| 132 | + }else{ | ||
| 133 | + $type = BTemplate::TYPE_PRODUCT_DETAIL; | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + if($source == BTemplate::SOURCE_BLOG){ | ||
| 137 | + if($is_list == BTemplate::IS_LIST){ | ||
| 138 | + $type = BTemplate::TYPE_BLOG_LIST; | ||
| 139 | + }else{ | ||
| 140 | + $type = BTemplate::TYPE_BLOG_DETAIL; | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + if($source == BTemplate::SOURCE_NEWS){ | ||
| 144 | + if($is_list == BTemplate::IS_LIST){ | ||
| 145 | + $type = BTemplate::TYPE_NEWS_LIST; | ||
| 146 | + }else{ | ||
| 147 | + $type = BTemplate::TYPE_NEWS_DETAIL; | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + return $type; | ||
| 94 | } | 151 | } |
| 95 | 152 | ||
| 96 | /** | 153 | /** |
| 97 | - * @remark :设置回滚公共参数参数 | ||
| 98 | - * @name :setParam | 154 | + * @remark :(非定制)保存时获取获取设置的类型 |
| 155 | + * @name :getType | ||
| 99 | * @author :lyh | 156 | * @author :lyh |
| 100 | * @method :post | 157 | * @method :post |
| 101 | - * @time :2023/8/23 14:18 | 158 | + * @time :2023/10/21 17:29 |
| 102 | */ | 159 | */ |
| 103 | - public function setCommonParam($info){ | ||
| 104 | - $data = [ | ||
| 105 | - 'head_html'=>$info['head_html'], | ||
| 106 | - 'head_css'=>$info['head_css'], | ||
| 107 | - 'footer_html'=>$info['footer_html'], | ||
| 108 | - 'footer_css'=>$info['footer_css'] | ||
| 109 | - ]; | ||
| 110 | - return $this->success($data); | 160 | + public function getType($source,$is_list,$is_custom = 0){ |
| 161 | + $type = BTemplate::SOURCE_HOME;//首页公共头部底部 | ||
| 162 | + $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; | ||
| 163 | + if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部 | ||
| 164 | + return $this->success($type); | ||
| 165 | + } | ||
| 166 | + //查看页面是否设置自定义头部底部 | ||
| 167 | + if($is_head != BTemplate::IS_NO_HEADER) { | ||
| 168 | + $pageSettingModel = new PageSetting(); | ||
| 169 | + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); | ||
| 170 | + if ($pageInfo === false) { | ||
| 171 | + return $this->success($type); | ||
| 172 | + } | ||
| 173 | + if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}} | ||
| 174 | + else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}} | ||
| 175 | + if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}} | ||
| 176 | + else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}} | ||
| 177 | + if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}} | ||
| 178 | + else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}} | ||
| 179 | + if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}} | ||
| 180 | + } | ||
| 181 | + return $this->success($type); | ||
| 111 | } | 182 | } |
| 112 | 183 | ||
| 113 | /** | 184 | /** |
| @@ -417,7 +417,7 @@ class BTemplateLogic extends BaseLogic | @@ -417,7 +417,7 @@ class BTemplateLogic extends BaseLogic | ||
| 417 | } | 417 | } |
| 418 | //更新头部信息 | 418 | //更新头部信息 |
| 419 | $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id'],$this->param['is_custom']); | 419 | $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id'],$this->param['is_custom']); |
| 420 | - $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']); | 420 | + $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']); |
| 421 | //通知更新 | 421 | //通知更新 |
| 422 | $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']); | 422 | $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']); |
| 423 | return $this->success(); | 423 | return $this->success(); |
| @@ -607,6 +607,7 @@ class BTemplateLogic extends BaseLogic | @@ -607,6 +607,7 @@ class BTemplateLogic extends BaseLogic | ||
| 607 | $param['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | 607 | $param['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); |
| 608 | return $this->success($param); | 608 | return $this->success($param); |
| 609 | } | 609 | } |
| 610 | + | ||
| 610 | /** | 611 | /** |
| 611 | * @remark :(非定制)保存时获取获取设置的类型 | 612 | * @remark :(非定制)保存时获取获取设置的类型 |
| 612 | * @name :getType | 613 | * @name :getType |
| @@ -646,7 +647,7 @@ class BTemplateLogic extends BaseLogic | @@ -646,7 +647,7 @@ class BTemplateLogic extends BaseLogic | ||
| 646 | * @method :post | 647 | * @method :post |
| 647 | * @time :2023/8/23 11:16 | 648 | * @time :2023/8/23 11:16 |
| 648 | */ | 649 | */ |
| 649 | - public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom,$type = 0){ | 650 | + public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom = 0,$is_list = 0,$type = 0){ |
| 650 | if($is_custom != BTemplate::IS_NO_CUSTOM){ | 651 | if($is_custom != BTemplate::IS_NO_CUSTOM){ |
| 651 | return true; | 652 | return true; |
| 652 | } | 653 | } |
| @@ -657,6 +658,7 @@ class BTemplateLogic extends BaseLogic | @@ -657,6 +658,7 @@ class BTemplateLogic extends BaseLogic | ||
| 657 | 'text'=>$html, | 658 | 'text'=>$html, |
| 658 | 'type'=>$type, | 659 | 'type'=>$type, |
| 659 | 'is_custom'=>$is_custom, | 660 | 'is_custom'=>$is_custom, |
| 661 | + 'is_list'=>$is_list, | ||
| 660 | 'source'=>$source, | 662 | 'source'=>$source, |
| 661 | 'source_id'=>$source_id, | 663 | 'source_id'=>$source_id, |
| 662 | 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'), | 664 | 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'), |
| @@ -113,7 +113,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -113,7 +113,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 113 | $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | 113 | $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); |
| 114 | $this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']); | 114 | $this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']); |
| 115 | } | 115 | } |
| 116 | - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 116 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id'],'project_id'=>$this->user['project_id']]); |
| 117 | if($rs === false){ | 117 | if($rs === false){ |
| 118 | $this->fail('系统错误,请联系管理'); | 118 | $this->fail('系统错误,请联系管理'); |
| 119 | } | 119 | } |
| @@ -364,4 +364,37 @@ class CustomTemplateLogic extends BaseLogic | @@ -364,4 +364,37 @@ class CustomTemplateLogic extends BaseLogic | ||
| 364 | } | 364 | } |
| 365 | return $this->success($data); | 365 | return $this->success($data); |
| 366 | } | 366 | } |
| 367 | + | ||
| 368 | + /** | ||
| 369 | + * @remark :单页面还原 | ||
| 370 | + * @name :saveRollbackVersion | ||
| 371 | + * @author :lyh | ||
| 372 | + * @method :post | ||
| 373 | + * @time :2024/4/23 14:00 | ||
| 374 | + */ | ||
| 375 | + public function saveRollbackVersion(){ | ||
| 376 | + //获取当前数据记录详情 | ||
| 377 | + $log = new BTemplateLog(); | ||
| 378 | + $logInfo = $log->read(['id'=>$this->param['id']]); | ||
| 379 | + if($logInfo === false){ | ||
| 380 | + $this->fail('未获取到当前记录'); | ||
| 381 | + } | ||
| 382 | + //获取当前数据详情 | ||
| 383 | + $info = $this->model->read(['id'=>$logInfo['source_id']],['is_visualization']); | ||
| 384 | + if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ | ||
| 385 | + //还原头部底部 | ||
| 386 | + $type = $this->getType(); | ||
| 387 | + //还原头部+底部 | ||
| 388 | + $commonData = [ | ||
| 389 | + 'head_html'=>$logInfo['head_html'], | ||
| 390 | + 'head_css'=>$logInfo['head_css'], | ||
| 391 | + 'footer_html'=>$logInfo['footer_html'], | ||
| 392 | + 'footer_css'=>$logInfo['footer_css'] | ||
| 393 | + ]; | ||
| 394 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 395 | + $commonTemplateModel->edit($commonData,['template_id'=>$logInfo['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]); | ||
| 396 | + } | ||
| 397 | + $this->model->edit(['html'=>$logInfo['main_html'],'html_style'=>$logInfo['main_css']],['id'=>$logInfo['source_id']]); | ||
| 398 | + return $this->success(); | ||
| 399 | + } | ||
| 367 | } | 400 | } |
| @@ -92,10 +92,11 @@ class RankDataLogic extends BaseLogic | @@ -92,10 +92,11 @@ class RankDataLogic extends BaseLogic | ||
| 92 | $data['langs'][$lang['language'] ?? ''] = [ | 92 | $data['langs'][$lang['language'] ?? ''] = [ |
| 93 | 'lang_text' => $lang['language'], | 93 | 'lang_text' => $lang['language'], |
| 94 | 'keyword_num' => $lang['keywords'] ?? 0, | 94 | 'keyword_num' => $lang['keywords'] ?? 0, |
| 95 | - 'reach_day' => $lang_data[$lang['language']]['dabiao_day'] ?? 0, | ||
| 96 | - 'home_cnt' => $lang_data[$lang['language']]['home_cnt'] ?? 0, | 95 | + 'reach_day' => $lang_data[$lang['lang']]['dabiao_day'] ?? 0, |
| 96 | + 'home_cnt' => $lang_data[$lang['lang']]['home_cnt'] ?? 0, | ||
| 97 | 'remain_day' => ($lang['type']??0) == 1 ? $data['project']['remain_day'] : $lang['service_day'] - $remain_day, | 97 | 'remain_day' => ($lang['type']??0) == 1 ? $data['project']['remain_day'] : $lang['service_day'] - $remain_day, |
| 98 | 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 | 98 | 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 |
| 99 | + 'service_day' => $lang['service_day'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 | ||
| 99 | ]; | 100 | ]; |
| 100 | } | 101 | } |
| 101 | } | 102 | } |
| @@ -463,8 +464,6 @@ class RankDataLogic extends BaseLogic | @@ -463,8 +464,6 @@ class RankDataLogic extends BaseLogic | ||
| 463 | $first_ten_pages_num ++; | 464 | $first_ten_pages_num ++; |
| 464 | } | 465 | } |
| 465 | } | 466 | } |
| 466 | - | ||
| 467 | - | ||
| 468 | $where = [ | 467 | $where = [ |
| 469 | 'project_id' => $project_id, | 468 | 'project_id' => $project_id, |
| 470 | 'lang' => $lang | 469 | 'lang' => $lang |
| @@ -473,13 +472,11 @@ class RankDataLogic extends BaseLogic | @@ -473,13 +472,11 @@ class RankDataLogic extends BaseLogic | ||
| 473 | if(!$model){ | 472 | if(!$model){ |
| 474 | $model = new RankData(); | 473 | $model = new RankData(); |
| 475 | } | 474 | } |
| 476 | - | ||
| 477 | //关键词达标天数 | 475 | //关键词达标天数 |
| 478 | //保证关键词数 | 476 | //保证关键词数 |
| 479 | $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); | 477 | $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); |
| 480 | $type = Project::where('id', $project_id)->value('type'); | 478 | $type = Project::where('id', $project_id)->value('type'); |
| 481 | $model->is_compliance = 0; | 479 | $model->is_compliance = 0; |
| 482 | - | ||
| 483 | //是否达标 | 480 | //是否达标 |
| 484 | $is_compliance = $first_page_num >= $keyword_num; | 481 | $is_compliance = $first_page_num >= $keyword_num; |
| 485 | if(in_array($project_id, $without_extension_project_ids)){ | 482 | if(in_array($project_id, $without_extension_project_ids)){ |
| @@ -487,20 +484,17 @@ class RankDataLogic extends BaseLogic | @@ -487,20 +484,17 @@ class RankDataLogic extends BaseLogic | ||
| 487 | } | 484 | } |
| 488 | if ($keyword_num && $type == Project::TYPE_TWO && $is_compliance) { | 485 | if ($keyword_num && $type == Project::TYPE_TWO && $is_compliance) { |
| 489 | Log::channel('rank_data')->info('项目' . $project_id . ':关键词达标'. $keyword_num .' - ' . $first_page_num . ' - ' . $first_page_without_extension_num); | 486 | Log::channel('rank_data')->info('项目' . $project_id . ':关键词达标'. $keyword_num .' - ' . $first_page_num . ' - ' . $first_page_without_extension_num); |
| 490 | - | ||
| 491 | //项目表更新 | 487 | //项目表更新 |
| 492 | if (($model->updated_date != date('Y-m-d') || empty($model->is_compliance)) && !$lang) { | 488 | if (($model->updated_date != date('Y-m-d') || empty($model->is_compliance)) && !$lang) { |
| 493 | $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0; | 489 | $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0; |
| 494 | Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]); | 490 | Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]); |
| 495 | Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1)); | 491 | Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1)); |
| 496 | } | 492 | } |
| 497 | - | ||
| 498 | $model->compliance_day = $model->compliance_day + 1; | 493 | $model->compliance_day = $model->compliance_day + 1; |
| 499 | $model->is_compliance = 1; | 494 | $model->is_compliance = 1; |
| 500 | } else { | 495 | } else { |
| 501 | Log::channel('rank_data')->info('项目' . $project_id . ':关键词未达标'. $keyword_num .' - ' . $first_page_num); | 496 | Log::channel('rank_data')->info('项目' . $project_id . ':关键词未达标'. $keyword_num .' - ' . $first_page_num); |
| 502 | } | 497 | } |
| 503 | - | ||
| 504 | $model->project_id = $project_id; | 498 | $model->project_id = $project_id; |
| 505 | $model->first_num = $first_num; | 499 | $model->first_num = $first_num; |
| 506 | $model->first_page_num = $first_page_num; | 500 | $model->first_page_num = $first_page_num; |
| @@ -396,6 +396,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -396,6 +396,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 396 | Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'saveHtml'])->name('custom_saveHtml'); | 396 | Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'saveHtml'])->name('custom_saveHtml'); |
| 397 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'statusNumber'])->name('custom_statusNum'); | 397 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'statusNumber'])->name('custom_statusNum'); |
| 398 | Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del'); | 398 | Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del'); |
| 399 | + Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'rollbackVersion'])->name('custom_rollbackVersion'); | ||
| 400 | + Route::any('/getCustomTemplateLog', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'getCustomTemplateLog'])->name('custom_getCustomTemplateLog'); | ||
| 399 | }); | 401 | }); |
| 400 | // 菜单组 | 402 | // 菜单组 |
| 401 | Route::prefix('nav_group')->group(function () { | 403 | Route::prefix('nav_group')->group(function () { |
-
请 注册 或 登录 后发表评论