作者 刘锟

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

正在显示 37 个修改的文件 包含 901 行增加187 行删除
@@ -28,6 +28,10 @@ use App\Models\Project\MinorLanguages; @@ -28,6 +28,10 @@ use App\Models\Project\MinorLanguages;
28 use App\Models\Project\Project; 28 use App\Models\Project\Project;
29 use App\Models\RouteMap\RouteMap; 29 use App\Models\RouteMap\RouteMap;
30 use App\Models\Template\BCustomTemplate; 30 use App\Models\Template\BCustomTemplate;
  31 +use App\Models\Template\BTemplate;
  32 +use App\Models\Template\BTemplateCom;
  33 +use App\Models\Template\BTemplateCommon;
  34 +use App\Models\Template\Setting;
31 use App\Models\WebSetting\WebSettingService; 35 use App\Models\WebSetting\WebSettingService;
32 use App\Services\AmazonS3Service; 36 use App\Services\AmazonS3Service;
33 use App\Services\ProjectServer; 37 use App\Services\ProjectServer;
@@ -52,82 +56,82 @@ class Demo extends Command @@ -52,82 +56,82 @@ class Demo extends Command
52 * @var string 56 * @var string
53 */ 57 */
54 protected $description = 'demo'; 58 protected $description = 'demo';
55 -  
56 - public function s(){ 59 + /**
  60 + * Execute the job.
  61 + *
  62 + * @return void
  63 + */
  64 + public function handle()
  65 + {
57 $projectModel = new Project(); 66 $projectModel = new Project();
58 - $list = $projectModel->list(['id'=>181]); 67 + $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
  68 + $data = [];
59 foreach ($list as $v){ 69 foreach ($list as $v){
60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 70 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
61 ProjectServer::useProject($v['id']); 71 ProjectServer::useProject($v['id']);
62 - $this->initSearch($v['id']); 72 + DB::table('gl_web_template_com')->truncate();
  73 + $templateComModel = new BTemplateCom();
  74 + $templateComModel->truncate();
  75 + $this->saveTemplateCom($v['id']);
63 DB::disconnect('custom_mysql'); 76 DB::disconnect('custom_mysql');
64 } 77 }
65 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 78 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
66 } 79 }
67 80
68 - /**  
69 - * @remark :创建search页面  
70 - * @name :initSearch  
71 - * @author :lyh  
72 - * @method :post  
73 - * @time :2024/4/25 11:35  
74 - */  
75 - public function initSearch($project_id){  
76 - $bCustomTemplateModel = new BCustomTemplate();  
77 - $info = $bCustomTemplateModel->read(['url'=>'search']);  
78 - if($info === false){  
79 - $time = date('Y-m-d H:i:s');  
80 - $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();  
81 - if(empty($info)) {  
82 - $data = [  
83 - 'project_id' => $project_id,  
84 - 'name' => 'search',  
85 - 'status' => 1,  
86 - 'url' => 'search',  
87 - 'html' => '',  
88 - 'html_style' =>'search',  
89 - 'title' => 'search',  
90 - 'description' => 'Sorry. The page has either moved or cannot be found.',  
91 - 'created_at' => $time, 'updated_at' => $time];  
92 - $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);  
93 - //路由  
94 - $info = DB::connection('custom_mysql')->table('gl_route_map')->first();  
95 - if(empty($info)) {  
96 - $data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => 'search', 'created_at' => $time, 'updated_at' => $time];  
97 - DB::connection('custom_mysql')->table('gl_route_map')->insert($data);  
98 - } 81 + public function saveTemplateCom($project_id){
  82 + //获取当前项目选择的模版
  83 + $settingModel = new Setting();
  84 + $settingInfo = $settingModel->read(['project_id'=>$project_id]);
  85 + echo date('Y-m-d H:i:s') . '设置的模版:'.json_encode($settingInfo) . PHP_EOL;
  86 + if($settingInfo !== false){
  87 + $templateCommonModel = new BTemplateCommon();
  88 + $commonList = $templateCommonModel->list(['template_id'=>['in',[$settingInfo['template_id'],0]]]);
  89 + if(!empty($commonList)){
  90 + foreach ($commonList as $v){
  91 + $typeArr = [1, 2, 3];
  92 + foreach ($typeArr as $type){
  93 + if($type == 1){
  94 + $headData = [
  95 + 'project_id'=>$v['project_id'],
  96 + 'source'=>$v['type'] == 1 ? 99 : $v['type'],
  97 + 'common_type'=>1,
  98 + 'template_id'=>$v['template_id'],
  99 + 'html'=>$v['head_html'],
  100 + 'html_style'=>$v['head_css'],
  101 + 'is_custom'=>$v['is_custom'],
  102 + 'is_list'=>$v['is_list']
  103 + ];
  104 + $templateComModel = new BTemplateCom();
  105 + $templateComModel->add($headData);
  106 + }elseif ($type == 2){
  107 + $footerData = [
  108 + 'project_id'=>$v['project_id'],
  109 + 'source'=>$v['type'] == 1 ? 99 : $v['type'],
  110 + 'common_type'=>2,
  111 + 'template_id'=>$v['template_id'],
  112 + 'html'=>$v['footer_html'],
  113 + 'html_style'=>$v['footer_css'],
  114 + 'is_custom'=>$v['is_custom'],
  115 + 'is_list'=>$v['is_list']
  116 + ];
  117 + $templateComModel = new BTemplateCom();
  118 + $templateComModel->add($footerData);
  119 + }elseif ($type == 3){
  120 + $otherData = [
  121 + 'project_id'=>$v['project_id'],
  122 + 'source'=>$v['type'] == 1 ? 99 : $v['type'],
  123 + 'common_type'=>3,
  124 + 'template_id'=>$v['template_id'],
  125 + 'html'=>$v['other'],
  126 + 'html_style'=>null,
  127 + 'is_custom'=>$v['is_custom'],
  128 + 'is_list'=>$v['is_list']
  129 + ];
  130 + $templateComModel = new BTemplateCom();
  131 + $templateComModel->add($otherData);
99 } 132 }
100 } 133 }
101 - return true;  
102 } 134 }
103 -  
104 - /**  
105 - * Execute the job.  
106 - *  
107 - * @return void  
108 - */  
109 - public function handle()  
110 - {  
111 - $this->param['project_id'] = 181;  
112 - $imageModel = new ImageModel();  
113 - //获取当前项目的所有图片  
114 - $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);  
115 - if(!empty($imageList)){  
116 - $amazonS3Service = new AmazonS3Service();  
117 - foreach ($imageList as $k => $v){  
118 - $amazonS3Service->syncImageFiles(getImageUrl($v['path']));  
119 - $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);  
120 - }  
121 - }  
122 -  
123 - $fileModel = new FileModel();  
124 - $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);  
125 - if(!empty($fileList)){  
126 - $amazonS3Service = new AmazonS3Service();  
127 - foreach ($fileList as $k => $v){  
128 - echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;  
129 - $amazonS3Service->syncImageFiles(getFileUrl($v['path']));  
130 - $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);  
131 } 135 }
132 } 136 }
133 return true; 137 return true;
@@ -43,6 +43,7 @@ class KeywordVideoController extends BaseController @@ -43,6 +43,7 @@ class KeywordVideoController extends BaseController
43 'gl_keyword_video_task.project_id AS project_id', 43 'gl_keyword_video_task.project_id AS project_id',
44 'gl_keyword_video_task.number AS number', 44 'gl_keyword_video_task.number AS number',
45 'gl_keyword_video_task.status AS status', 45 'gl_keyword_video_task.status AS status',
  46 + 'gl_keyword_video_task.keywords AS keywords',
46 'gl_keyword_video_task.sort AS sort', 47 'gl_keyword_video_task.sort AS sort',
47 'gl_keyword_video_task.created_at AS created_at', 48 'gl_keyword_video_task.created_at AS created_at',
48 'gl_keyword_video_task.updated_at AS updated_at', 49 'gl_keyword_video_task.updated_at AS updated_at',
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ReplaceHtmlController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/8 10:02
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Template;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Http\Logic\Aside\Template\ReplaceHtmlLogic;
  15 +use App\Models\Template\TemplateReplaceHtml;
  16 +use App\Models\Template\TemplateReplaceHtmlLog;
  17 +use App\Services\ProjectServer;
  18 +use Illuminate\Support\Facades\DB;
  19 +
  20 +class ReplaceHtmlController extends BaseController
  21 +{
  22 + /**
  23 + * @remark :替换同一种类型的html代码
  24 + * @name :replaceTemplateMainHtml
  25 + * @author :lyh
  26 + * @method :post
  27 + * @time :2024/5/7 14:39
  28 + */
  29 + public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){
  30 + $this->request->validate([
  31 + 'old_html'=>'required',
  32 + 'html'=>'required',
  33 + 'type'=>'required',
  34 + 'is_list'=>'required',
  35 + 'is_custom'=>'required',
  36 + 'project_id'=>'required',
  37 + ],[
  38 + 'old_html.required' => '需替换的html不能为空',
  39 + 'html.required' => 'html不能为空',
  40 + 'type.required' => '类型type不能为空',
  41 + 'is_custom.required' => '类型is_custom不能为空',
  42 + 'is_list.required' => '类型is_list不能为空',
  43 + 'project_id.required' => 'project_id不能为空',
  44 + ]);
  45 + $logic->replaceHtml();
  46 + $this->response('success');
  47 + }
  48 +
  49 + /**
  50 + * @remark :替换的记录
  51 + * @name :replaceTemplateLog
  52 + * @author :lyh
  53 + * @method :post
  54 + * @time :2024/5/8 10:28
  55 + */
  56 + public function replaceTemplateLog(TemplateReplaceHtml $replaceModel){
  57 + $this->request->validate([
  58 + 'project_id'=>'required',
  59 + ],[
  60 + 'project_id.required' => 'project_id不能为空',
  61 + ]);
  62 + ProjectServer::useProject($this->param['project_id']);
  63 + $lists = $replaceModel->lists($this->map,$this->page,$this->row,$this->order);
  64 + if(!empty($lists) && !empty($lists['list'])){
  65 + $templateLogModel = new TemplateReplaceHtmlLog();
  66 + foreach ($lists['list'] as $k => $v){
  67 + $v['sub'] = $templateLogModel->list(['replace_id'=>$v['id']]);
  68 + $lists['list'][$k] = $v;
  69 + }
  70 + }
  71 + DB::disconnect('custom_mysql');
  72 + $this->response('success',Code::SUCCESS,$lists);
  73 + }
  74 +
  75 + /**
  76 + * @remark :还原
  77 + * @name :reductionHtml
  78 + * @author :lyh
  79 + * @method :post
  80 + * @time :2024/5/8 10:27
  81 + */
  82 + public function reductionHtml(ReplaceHtmlLogic $logic){
  83 + $this->request->validate([
  84 + 'id'=>'required',
  85 + ],[
  86 + 'id.required' => 'id不能为空',
  87 + ]);
  88 + $logic->reductionHtml();
  89 + $this->response('success');
  90 + }
  91 +}
@@ -24,7 +24,7 @@ class PageSettingController extends BaseController @@ -24,7 +24,7 @@ class PageSettingController extends BaseController
24 */ 24 */
25 public function info(){ 25 public function info(){
26 $pageSettingModel = new PageSetting(); 26 $pageSettingModel = new PageSetting();
27 - $info = $pageSettingModel->read(['project_id'=>$this->user['project_id']]); 27 + $info = $pageSettingModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'] ?? 1]);
28 if($info === false){ 28 if($info === false){
29 $info = [ 29 $info = [
30 'project_id'=>$this->user['project_id'], 30 'project_id'=>$this->user['project_id'],
@@ -36,6 +36,8 @@ class PageSettingController extends BaseController @@ -36,6 +36,8 @@ class PageSettingController extends BaseController
36 'news_list'=>0, 36 'news_list'=>0,
37 'news_details'=>0, 37 'news_details'=>0,
38 'polymerization'=>0, 38 'polymerization'=>0,
  39 + 'home'=>0,
  40 + 'type'=>$this->param['type'] ?? 1,
39 ]; 41 ];
40 $pageSettingModel->add($info); 42 $pageSettingModel->add($info);
41 } 43 }
@@ -51,7 +53,7 @@ class PageSettingController extends BaseController @@ -51,7 +53,7 @@ class PageSettingController extends BaseController
51 */ 53 */
52 public function edit(){ 54 public function edit(){
53 $pageSettingModel = new PageSetting(); 55 $pageSettingModel = new PageSetting();
54 - $rs = $pageSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]); 56 + $rs = $pageSettingModel->edit($this->param,['project_id'=>$this->user['project_id'],'type'=>$this->param['type'] ?? 1]);
55 if($rs === false){ 57 if($rs === false){
56 $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR); 58 $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR);
57 } 59 }
@@ -151,4 +151,17 @@ class BlogCategoryController extends BaseController @@ -151,4 +151,17 @@ class BlogCategoryController extends BaseController
151 //TODO::写入操作日志 151 //TODO::写入操作日志
152 $this->response('success'); 152 $this->response('success');
153 } 153 }
  154 +
  155 +
  156 + /**
  157 + * @remark :批量排序
  158 + * @name :allSort
  159 + * @author :lyh
  160 + * @method :post
  161 + * @time :2024/1/11 9:46
  162 + */
  163 + public function allSort(BlogCategoryLogic $blogCategoryLogic){
  164 + $blogCategoryLogic->setAllSort();
  165 + $this->response('success');
  166 + }
154 } 167 }
@@ -298,13 +298,28 @@ class BlogController extends BaseController @@ -298,13 +298,28 @@ class BlogController extends BaseController
298 $this->request->validate([ 298 $this->request->validate([
299 'id'=>'required', 299 'id'=>'required',
300 'category_id'=>'required', 300 'category_id'=>'required',
301 - 'status'=>'required'  
302 ],[ 301 ],[
303 'id.required' => '产品ID不能为空', 302 'id.required' => '产品ID不能为空',
304 'category_id.required' => '分类ID不能为空', 303 'category_id.required' => '分类ID不能为空',
305 - 'status.required'=>'状态不能为空'  
306 ]); 304 ]);
307 $logic->batchSetCategory(); 305 $logic->batchSetCategory();
308 $this->response('success'); 306 $this->response('success');
309 } 307 }
  308 +
  309 + /**
  310 + * @remark :复制新闻
  311 + * @name :copyNews
  312 + * @author :lyh
  313 + * @method :post
  314 + * @time :2024/4/28 11:53
  315 + */
  316 + public function copyBlog(BlogLogic $blog){
  317 + $this->request->validate([
  318 + 'id'=>'required',
  319 + ],[
  320 + 'id.required' => 'id不能为空',
  321 + ]);
  322 + $data = $blog->copyBlogInfo();
  323 + $this->response('success',Code::SUCCESS,$data);
  324 + }
310 } 325 }
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\CustomModule; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\CustomModule;
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\CustomModule\CustomModuleCategoryLogic; 14 use App\Http\Logic\Bside\CustomModule\CustomModuleCategoryLogic;
  15 +use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic;
15 use App\Models\CustomModule\CustomModule; 16 use App\Models\CustomModule\CustomModule;
16 use App\Models\CustomModule\CustomModuleCategory; 17 use App\Models\CustomModule\CustomModuleCategory;
17 use App\Models\Template\BTemplate; 18 use App\Models\Template\BTemplate;
@@ -173,4 +174,18 @@ class CustomModuleCategoryController extends BaseController @@ -173,4 +174,18 @@ class CustomModuleCategoryController extends BaseController
173 $logic->categorySort(); 174 $logic->categorySort();
174 $this->response('success'); 175 $this->response('success');
175 } 176 }
  177 +
  178 + /**
  179 + * @remark :批量排序
  180 + * @name :allSort
  181 + * @author :lyh
  182 + * @method :post
  183 + * @time :2024/1/11 9:46
  184 + */
  185 + public function allSort(CustomModuleCategoryLogic $logic){
  186 + $logic->setAllSort();
  187 + $this->response('success');
  188 + }
  189 +
  190 +
176 } 191 }
@@ -243,4 +243,28 @@ class CustomModuleContentController extends BaseController @@ -243,4 +243,28 @@ class CustomModuleContentController extends BaseController
243 $logic->contentSort(); 243 $logic->contentSort();
244 $this->response('success'); 244 $this->response('success');
245 } 245 }
  246 +
  247 + /**
  248 + * @remark :批量排序
  249 + * @name :allSort
  250 + * @author :lyh
  251 + * @method :post
  252 + * @time :2024/1/11 9:46
  253 + */
  254 + public function allSort(CustomModuleContentLogic $logic){
  255 + $logic->setAllSort();
  256 + $this->response('success');
  257 + }
  258 +
  259 + /**
  260 + * @remark :复制扩展模块
  261 + * @name :copyModuleContent
  262 + * @author :lyh
  263 + * @method :post
  264 + * @time :2024/4/28 16:31
  265 + */
  266 + public function copyModuleContent(CustomModuleContentLogic $logic){
  267 + $logic->copyModuleContentInfo();
  268 + $this->response('success');
  269 + }
246 } 270 }
@@ -148,4 +148,17 @@ class NewsCategoryController extends BaseController @@ -148,4 +148,17 @@ class NewsCategoryController extends BaseController
148 $this->response('success'); 148 $this->response('success');
149 } 149 }
150 150
  151 +
  152 + /**
  153 + * @remark :批量排序
  154 + * @name :allSort
  155 + * @author :lyh
  156 + * @method :post
  157 + * @time :2024/1/11 9:46
  158 + */
  159 + public function allSort(NewsCategoryLogic $newsCategoryLogic){
  160 + $newsCategoryLogic->setAllSort();
  161 + $this->response('success');
  162 + }
  163 +
151 } 164 }
@@ -281,7 +281,7 @@ class NewsController extends BaseController @@ -281,7 +281,7 @@ class NewsController extends BaseController
281 281
282 282
283 /** 283 /**
284 - * @remark :批量设置产品分类及状态 284 + * @remark :批量设置分类及状态
285 * @name :batchSetCategory 285 * @name :batchSetCategory
286 * @author :lyh 286 * @author :lyh
287 * @method :post 287 * @method :post
@@ -291,11 +291,9 @@ class NewsController extends BaseController @@ -291,11 +291,9 @@ class NewsController extends BaseController
291 $this->request->validate([ 291 $this->request->validate([
292 'id'=>'required', 292 'id'=>'required',
293 'category_id'=>'required', 293 'category_id'=>'required',
294 - 'status'=>'required'  
295 ],[ 294 ],[
296 'id.required' => '产品ID不能为空', 295 'id.required' => '产品ID不能为空',
297 'category_id.required' => '分类ID不能为空', 296 'category_id.required' => '分类ID不能为空',
298 - 'status.required'=>'状态不能为空'  
299 ]); 297 ]);
300 $logic->batchSetCategory(); 298 $logic->batchSetCategory();
301 $this->response('success'); 299 $this->response('success');
@@ -338,7 +336,13 @@ class NewsController extends BaseController @@ -338,7 +336,13 @@ class NewsController extends BaseController
338 * @method :post 336 * @method :post
339 * @time :2024/4/28 11:53 337 * @time :2024/4/28 11:53
340 */ 338 */
341 - public function copyNews(NewsModel $news){  
342 - 339 + public function copyNews(NewsLogic $news){
  340 + $this->request->validate([
  341 + 'id'=>'required',
  342 + ],[
  343 + 'id.required' => 'id不能为空',
  344 + ]);
  345 + $data = $news->copyNewsInfo();
  346 + $this->response('success',Code::SUCCESS,$data);
343 } 347 }
344 } 348 }
@@ -164,4 +164,17 @@ class CategoryController extends BaseController @@ -164,4 +164,17 @@ class CategoryController extends BaseController
164 $data = $logic->categoryDelete(); 164 $data = $logic->categoryDelete();
165 $this->response('success',Code::SUCCESS,$data); 165 $this->response('success',Code::SUCCESS,$data);
166 } 166 }
  167 +
  168 +
  169 + /**
  170 + * @remark :批量更新排序
  171 + * @name :allSort
  172 + * @author :lyh
  173 + * @method :post
  174 + * @time :2024/1/10 15:34
  175 + */
  176 + public function allSort(CategoryLogic $logic){
  177 + $logic->setAllSort();
  178 + $this->response('success');
  179 + }
167 } 180 }
@@ -297,7 +297,7 @@ class ProductController extends BaseController @@ -297,7 +297,7 @@ class ProductController extends BaseController
297 $v = $this->getHandleFileImage($v); 297 $v = $this->getHandleFileImage($v);
298 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); 298 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);
299 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id'] ?? 0); 299 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id'] ?? 0);
300 - $v['url'] = $this->user['domain'].$v['route'] ?? ''; 300 + $v['url'] = $this->user['domain'].($v['route'] ?? '');
301 //获取当前数据扩展字段及值 301 //获取当前数据扩展字段及值
302 $v['extend'] = $this->getExtendInfo($v['id']); 302 $v['extend'] = $this->getExtendInfo($v['id']);
303 return $v; 303 return $v;
@@ -433,12 +433,17 @@ class ProductController extends BaseController @@ -433,12 +433,17 @@ class ProductController extends BaseController
433 * @time :2023/7/29 14:59 433 * @time :2023/7/29 14:59
434 */ 434 */
435 public function copyProduct(ProductLogic $logic){ 435 public function copyProduct(ProductLogic $logic){
  436 + $this->request->validate([
  437 + 'id'=>'required',
  438 + ],[
  439 + 'id.required' => 'id不能为空',
  440 + ]);
436 $data = $logic->setCopyProduct(); 441 $data = $logic->setCopyProduct();
437 $this->response('success',Code::SUCCESS,$data); 442 $this->response('success',Code::SUCCESS,$data);
438 } 443 }
439 444
440 /** 445 /**
441 - * @remark :批量设置产品分类及状态 446 + * @remark :批量设置产品分类
442 * @name :batchSetCategory 447 * @name :batchSetCategory
443 * @author :lyh 448 * @author :lyh
444 * @method :post 449 * @method :post
@@ -448,11 +453,9 @@ class ProductController extends BaseController @@ -448,11 +453,9 @@ class ProductController extends BaseController
448 $this->request->validate([ 453 $this->request->validate([
449 'id'=>'required', 454 'id'=>'required',
450 'category_id'=>'required', 455 'category_id'=>'required',
451 - 'status'=>'required'  
452 ],[ 456 ],[
453 'id.required' => '产品ID不能为空', 457 'id.required' => '产品ID不能为空',
454 'category_id.required' => '分类ID不能为空', 458 'category_id.required' => '分类ID不能为空',
455 - 'status.required'=>'状态不能为空'  
456 ]); 459 ]);
457 $logic->batchSetCategory(); 460 $logic->batchSetCategory();
458 $this->response('success'); 461 $this->response('success');
@@ -51,7 +51,7 @@ class BTemplateController extends BaseController @@ -51,7 +51,7 @@ class BTemplateController extends BaseController
51 } 51 }
52 52
53 /** 53 /**
54 - * @remark :获取当前已选择的模板 54 + * @remark :获取可视化数据
55 * @name :getModuleTemplate 55 * @name :getModuleTemplate
56 * @author :lyh 56 * @author :lyh
57 * @method :post 57 * @method :post
@@ -156,4 +156,21 @@ class CustomTemplateController extends BaseController @@ -156,4 +156,21 @@ class CustomTemplateController extends BaseController
156 $logic->saveRollbackVersion(); 156 $logic->saveRollbackVersion();
157 $this->response('success'); 157 $this->response('success');
158 } 158 }
  159 +
  160 + /**
  161 + * @remark :复制单页
  162 + * @name :copyCustomTemplate
  163 + * @author :lyh
  164 + * @method :post
  165 + * @time :2024/4/28 16:13
  166 + */
  167 + public function copyCustomTemplate(CustomTemplateLogic $logic){
  168 + $this->request->validate([
  169 + 'id'=>['required'],
  170 + ],[
  171 + 'id.required' => 'ID不能为空',
  172 + ]);
  173 + $logic->copyCustomTemplateInfo();
  174 + $this->response('success');
  175 + }
159 } 176 }
@@ -165,14 +165,16 @@ class FileController @@ -165,14 +165,16 @@ class FileController
165 */ 165 */
166 public function getOnlyFilename($name,$project_id = 0){ 166 public function getOnlyFilename($name,$project_id = 0){
167 $nameArr = explode('.',$name); 167 $nameArr = explode('.',$name);
168 - $enName = generateRoute(Translate::tran($nameArr[0], 'en')); 168 + $suffix = array_pop($nameArr) ?? 'jpg';
  169 + $nameStr = implode('-', $nameArr);
  170 + $enName = generateRoute(Translate::tran($nameStr, 'en'));
169 $fileName = $enName; 171 $fileName = $enName;
170 $i=1; 172 $i=1;
171 - while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ 173 + while($this->onlyName($enName.'.'.$suffix,$project_id)){
172 $enName = $fileName .'-'.$i; 174 $enName = $fileName .'-'.$i;
173 $i++; 175 $i++;
174 } 176 }
175 - return $enName.'.'.$nameArr[1]; 177 + return $enName.'.'.$suffix;
176 } 178 }
177 179
178 /** 180 /**
@@ -224,15 +224,18 @@ class ImageController extends Controller @@ -224,15 +224,18 @@ class ImageController extends Controller
224 * @time :2024/4/26 16:10 224 * @time :2024/4/26 16:10
225 */ 225 */
226 public function getOnlyFilename($name,$project_id = 0){ 226 public function getOnlyFilename($name,$project_id = 0){
  227 +
227 $nameArr = explode('.',$name); 228 $nameArr = explode('.',$name);
228 - $enName = generateRoute(Translate::tran($nameArr[0], 'en')); 229 + $suffix = array_pop($nameArr) ?? 'jpg';
  230 + $nameStr = implode('-', $nameArr);
  231 + $enName = generateRoute(Translate::tran($nameStr, 'en'));
229 $fileName = $enName; 232 $fileName = $enName;
230 $i=1; 233 $i=1;
231 - while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ 234 + while($this->onlyName($enName.'.'.$suffix,$project_id)){
232 $enName = $fileName .'-'.$i; 235 $enName = $fileName .'-'.$i;
233 $i++; 236 $i++;
234 } 237 }
235 - return $enName.'.'.$nameArr[1]; 238 + return $enName.'.'.$suffix;
236 } 239 }
237 240
238 /** 241 /**
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ReplaceHtmlLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/8 10:03
  8 + */
  9 +
  10 +namespace App\Http\Logic\Aside\Template;
  11 +
  12 +use App\Http\Logic\aside\BaseLogic;
  13 +use App\Models\Template\BTemplate;
  14 +use App\Models\Template\TemplateReplaceHtml;
  15 +use App\Models\Template\TemplateReplaceHtmlLog;
  16 +use App\Services\ProjectServer;
  17 +use Illuminate\Support\Facades\DB;
  18 +
  19 +class ReplaceHtmlLogic extends BaseLogic
  20 +{
  21 + public function __construct()
  22 + {
  23 + parent::__construct();
  24 + $this->model = new TemplateReplaceHtml();
  25 + $this->param = $this->requestAll;
  26 + }
  27 +
  28 + /**
  29 + * @remark :替换可视化的html代码(按类型)
  30 + * @name :replaceHtml
  31 + * @author :lyh
  32 + * @method :post
  33 + * @time :2024/5/7 15:52
  34 + */
  35 + public function replaceHtml(){
  36 + ProjectServer::useProject($this->param['project_id']);
  37 + //TODO::生成一条任务记录
  38 + $replaceId = $this->saveReplaceHtml($this->param);
  39 + //查询当前类型所有装修的记录
  40 + $condition = ['source'=>$this->param['type'],'is_custom'=>$this->param['is_custom'],'is_list'=>$this->param['is_list'],
  41 + 'template_id'=>$this->param['template_id']];
  42 + $list = $this->model->list($condition);
  43 + foreach ($list as $v){
  44 + if($v['type'] == 0){
  45 + $main_html = str_replace($this->param['old_html'],$this->param['html'],$v['main_html']);
  46 + $this->model->edit(['main_html'=>$main_html],['id'=>$v['id']]);
  47 + }else{
  48 + $html = str_replace($this->param['old_html'],$this->param['html'],$v['html']);
  49 + $this->model->edit(['html'=>$html],['id'=>$v['id']]);
  50 + }
  51 + $this->saveReplaceHtmlLog($replaceId,$v['id']);
  52 + }
  53 + DB::disconnect('custom_mysql');
  54 + return $this->success();
  55 + }
  56 +
  57 + /**
  58 + * @remark :生成一条记录
  59 + * @name :saveTemplateLog
  60 + * @author :lyh
  61 + * @method :post
  62 + * @time :2024/5/8 9:23
  63 + */
  64 + public function saveReplaceHtml($data,$template_id){
  65 + $logData = [
  66 + 'type'=>$data['type'],
  67 + 'is_custom'=>$data['is_custom'],
  68 + 'is_list'=>$data['is_list'],
  69 + 'template_id'=>$template_id,
  70 + 'old_html'=>$data['old_html'],
  71 + 'html'=>$data['html'],
  72 + ];
  73 + return $this->model->addReturnId($logData);
  74 + }
  75 +
  76 + /**
  77 + * @remark :保存每条替换记录
  78 + * @name :saveReplaceHtmlLog
  79 + * @author :lyh
  80 + * @method :post
  81 + * @time :2024/5/8 9:37
  82 + */
  83 + public function saveReplaceHtmlLog($replace_id,$replace_template_id){
  84 + $logData = [
  85 + 'replace_id'=>$replace_id,
  86 + 'replace_template_id'=>$replace_template_id,
  87 + 'uid'=>$this->user['manager_id'],
  88 + ];
  89 + $replaceHtmlModel = new TemplateReplaceHtmlLog();
  90 + return $replaceHtmlModel->add($logData);
  91 + }
  92 +
  93 + /**
  94 + * @remark :还原所有记录
  95 + * @name :reductionHtml
  96 + * @author :lyh
  97 + * @method :post
  98 + * @time :2024/5/8 10:35
  99 + */
  100 + public function reductionHtml(){
  101 + ProjectServer::useProject($this->param['project_id']);
  102 + //获取当前数据详情
  103 + $info = $this->model->read(['id'=>$this->param['id']]);
  104 + if($info === false){
  105 + $this->fail('当前数据不存在');
  106 + }
  107 + $replaceLogModel = new TemplateReplaceHtmlLog();
  108 + $logList = $replaceLogModel->list(['replace_id'=>$this->param['id']]);
  109 + $replaceArr = [];
  110 + foreach ($logList as $v){
  111 + $replaceArr[] = $v['replace_template_id'];
  112 + }
  113 + if(!empty($replaceArr)){
  114 + //查询可视化数据
  115 + $bTemplateModel = new BTemplate();
  116 + $templateList = $bTemplateModel->list(['id'=>['in',$replaceArr]]);
  117 + foreach ($templateList as $value){
  118 + if($v['type'] == 0){
  119 + $main_html = str_replace($info['html'],$info['old_html'],$value['main_html']);
  120 + $this->model->edit(['main_html'=>$main_html],['id'=>$v['id']]);
  121 + }else{
  122 + $html = str_replace($info['html'],$info['old_html'],$value['html']);
  123 + $this->model->edit(['html'=>$html],['id'=>$v['id']]);
  124 + }
  125 + }
  126 + }
  127 + DB::disconnect('custom_mysql');
  128 + return $this->success();
  129 + }
  130 +}
@@ -494,7 +494,7 @@ class BTemplateLogic extends BaseLogic @@ -494,7 +494,7 @@ class BTemplateLogic extends BaseLogic
494 return $this->success(); 494 return $this->success();
495 } 495 }
496 } 496 }
497 - //其他情况 497 + //todo::其他情况
498 $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) 498 $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面)
499 if($template_id == 0){//定制页面默认为独立头部 499 if($template_id == 0){//定制页面默认为独立头部
500 $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部 500 $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部
@@ -4,8 +4,11 @@ namespace App\Http\Logic\Bside\Blog; @@ -4,8 +4,11 @@ namespace App\Http\Logic\Bside\Blog;
4 4
5 use App\Helper\Translate; 5 use App\Helper\Translate;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
  7 +use App\Models\Blog\Blog;
7 use App\Models\Blog\Blog as BlogModel; 8 use App\Models\Blog\Blog as BlogModel;
  9 +use App\Models\Blog\BlogCategory;
8 use App\Models\Blog\BlogCategory as BlogCategoryModel; 10 use App\Models\Blog\BlogCategory as BlogCategoryModel;
  11 +use App\Models\News\NewsCategory as NewsCategoryModel;
9 use App\Models\RouteMap\RouteMap; 12 use App\Models\RouteMap\RouteMap;
10 use Illuminate\Support\Facades\DB; 13 use Illuminate\Support\Facades\DB;
11 14
@@ -90,32 +93,13 @@ class BlogCategoryLogic extends BaseLogic @@ -90,32 +93,13 @@ class BlogCategoryLogic extends BaseLogic
90 */ 93 */
91 public function delBlogCategory(){ 94 public function delBlogCategory(){
92 foreach ($this->param['id'] as $id){ 95 foreach ($this->param['id'] as $id){
93 - $this->verifyIsDelete($id);  
94 //删除路由 96 //删除路由
95 $this->delRoute($id); 97 $this->delRoute($id);
96 $this->model->del(['id'=>$id]); 98 $this->model->del(['id'=>$id]);
97 - }  
98 - return $this->success();  
99 - }  
100 -  
101 - /**  
102 - * @remark :验证是否可删除  
103 - * @name :VerifyIsDelete  
104 - * @author :lyh  
105 - * @method :post  
106 - * @time :2023/9/7 14:40  
107 - */  
108 - public function verifyIsDelete($id){  
109 - //查询是否有子分类  
110 - $rs = $this->model->read(['pid'=>$id],['id']);  
111 - if($rs !== false){  
112 - $this->response('当前分类拥有子分类不允许删除');  
113 - }  
114 - //查看当前分内下是否有博客  
115 - $blogModel = new BlogModel();  
116 - $rs = $blogModel->read(['category_id'=>['like','%,'.$id.',%']],['id']);  
117 - if($rs !== false){  
118 - $this->response('当前分类拥有博客,不允许删除'); 99 + //同步删除产品字段category_id
  100 + $blogModel = new Blog();
  101 + $blogModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
  102 + $blogModel->edit(['category_id'=>null],['category_id'=>',']);
119 } 103 }
120 return $this->success(); 104 return $this->success();
121 } 105 }
@@ -278,4 +262,19 @@ class BlogCategoryLogic extends BaseLogic @@ -278,4 +262,19 @@ class BlogCategoryLogic extends BaseLogic
278 } 262 }
279 return $this->success(); 263 return $this->success();
280 } 264 }
  265 +
  266 +
  267 + /**
  268 + * @remark :设置批量排序
  269 + * @name :setAllSort
  270 + * @author :lyh
  271 + * @method :post
  272 + * @time :2024/1/10 15:40
  273 + */
  274 + public function setAllSort(){
  275 + foreach ($this->param['data'] as $k => $v){
  276 + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
  277 + }
  278 + return $this->success();
  279 + }
281 } 280 }
@@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic; @@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic;
6 use App\Models\Blog\Blog; 6 use App\Models\Blog\Blog;
7 use App\Models\Blog\BlogCategory as BlogCategoryModel; 7 use App\Models\Blog\BlogCategory as BlogCategoryModel;
8 use App\Models\RouteMap\RouteMap; 8 use App\Models\RouteMap\RouteMap;
  9 +use App\Models\Template\BTemplate;
9 use App\Services\CosService; 10 use App\Services\CosService;
10 use Illuminate\Support\Facades\DB; 11 use Illuminate\Support\Facades\DB;
11 12
@@ -16,7 +17,6 @@ class BlogLogic extends BaseLogic @@ -16,7 +17,6 @@ class BlogLogic extends BaseLogic
16 public function __construct() 17 public function __construct()
17 { 18 {
18 parent::__construct(); 19 parent::__construct();
19 -  
20 $this->model = new Blog(); 20 $this->model = new Blog();
21 $this->param = $this->requestAll; 21 $this->param = $this->requestAll;
22 } 22 }
@@ -382,15 +382,26 @@ class BlogLogic extends BaseLogic @@ -382,15 +382,26 @@ class BlogLogic extends BaseLogic
382 public function batchSetCategory(){ 382 public function batchSetCategory(){
383 if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { 383 if(isset($this->param['category_id']) && !empty($this->param['category_id'])) {
384 DB::connection('custom_mysql')->beginTransaction(); 384 DB::connection('custom_mysql')->beginTransaction();
385 - $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; 385 + $category_id_str = ','.implode(',',$this->param['category_id']).',';
386 try { 386 try {
387 - //批量 387 + if(!isset($this->param['is_cover']) || ($this->param['is_cover'] == 1)){
  388 + //批量覆盖
388 $param = [ 389 $param = [
389 - 'category_id'=>$this->param['category_id'], 390 + 'category_id'=>$category_id_str,
390 'status'=>$this->param['status'] 391 'status'=>$this->param['status']
391 ]; 392 ];
392 $this->model->edit($param,['id'=>['in',$this->param['id']]]); 393 $this->model->edit($param,['id'=>['in',$this->param['id']]]);
393 DB::connection('custom_mysql')->commit(); 394 DB::connection('custom_mysql')->commit();
  395 + }else{
  396 + foreach ($this->param['id'] as $id){
  397 + //获取当前产品的分类
  398 + $blogInfo = $this->model->read(['id'=>$id],['id','category_id']);
  399 + $category_ids = explode(',',trim($blogInfo['category_id'],','));
  400 + $category_ids_arr = array_values(array_unique(array_merge($category_ids,$this->param['category_id'])));
  401 + $category_ids = ','.implode(',',$category_ids_arr).',';
  402 + $this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
  403 + }
  404 + }
394 //对应添加关联表 405 //对应添加关联表
395 }catch (\Exception $e){ 406 }catch (\Exception $e){
396 DB::connection('custom_mysql')->rollBack(); 407 DB::connection('custom_mysql')->rollBack();
@@ -399,4 +410,71 @@ class BlogLogic extends BaseLogic @@ -399,4 +410,71 @@ class BlogLogic extends BaseLogic
399 } 410 }
400 return $this->success(); 411 return $this->success();
401 } 412 }
  413 +
  414 + /**
  415 + * @remark :复制新闻
  416 + * @name :copyNewsInfo
  417 + * @author :lyh
  418 + * @method :post
  419 + * @time :2024/4/28 14:51
  420 + */
  421 + public function copyBlogInfo(){
  422 + $info = $this->model->read(['id'=>$this->param['id']]);
  423 + $param = [
  424 + 'name'=>$info['name']."-copy",
  425 + 'status'=>$info['status'],
  426 + 'sort'=>$info['sort'],
  427 + 'category_id'=>$info['category_id'],
  428 + 'text'=>$info['text'],
  429 + 'remark'=>$info['remark'],
  430 + 'url'=>$info['url'],
  431 + 'label_id'=>$info['label_id'],
  432 + 'image'=>$info['image'],
  433 + 'project_id'=>$info['project_id'],
  434 + 'operator_id'=>$this->user['id'],
  435 + 'create_id'=>$this->user['id'],
  436 + 'created_at'=>date('Y-m-d H:i:s'),
  437 + 'updated_at'=>date('Y-m-d H:i:s'),
  438 + ];
  439 + $save_id = $this->model->insertGetId($param);
  440 + $route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_BLOG, $save_id, $this->user['project_id']);
  441 + $this->model->edit(['url'=>$route],['id'=>$save_id]);
  442 + //同步可视化装修数据
  443 + $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
  444 + return $this->success(['id'=>$save_id]);
  445 + }
  446 +
  447 + /**
  448 + * @remark :同步模版数据
  449 + * @name :copyTemplate
  450 + * @author :lyh
  451 + * @method :post
  452 + * @time :2023/7/29 15:53
  453 + */
  454 + public function copyTemplate($id,$project_id,$save_id){
  455 + $BTemplateModel = new BTemplate();
  456 + $list = $BTemplateModel->list(['source'=>BTemplate::SOURCE_BLOG,'source_id'=>$id,'project_id'=>$project_id]);
  457 + if(!empty($list)){
  458 + $data = [];
  459 + foreach ($list as $v){
  460 + $data[] = [
  461 + 'html'=>$v['html'],
  462 + 'project_id'=>$project_id,
  463 + 'source'=>$v['source'],
  464 + 'source_id'=>$save_id,
  465 + 'template_id'=>$v['template_id'],
  466 + 'section_list_id'=>$v['section_list_id'],
  467 + 'main_html'=>$v['main_html'],
  468 + 'main_css'=>$v['main_css'],
  469 + 'created_at'=>date('Y-m-d H:i:s'),
  470 + 'updated_at'=>date('Y-m-d H:i:s'),
  471 + ];
  472 + }
  473 + $rs = $BTemplateModel->insert($data);
  474 + if($rs === false){
  475 + $this->fail('error');
  476 + }
  477 + }
  478 + return $this->success();
  479 + }
402 } 480 }
@@ -189,18 +189,13 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -189,18 +189,13 @@ class CustomModuleCategoryLogic extends BaseLogic
189 public function categoryDel(){ 189 public function categoryDel(){
190 $ids = $this->param['id']; 190 $ids = $this->param['id'];
191 foreach ($ids as $id){ 191 foreach ($ids as $id){
192 - $info = $this->model->read(['pid'=>$id],['id']);  
193 - if($info !== false){  
194 - $this->fail('分类id:'.$id.'拥有子集不允许删除');  
195 - }  
196 - $contentModel = new CustomModuleContent();  
197 - $contentInfo = $contentModel->read(['category_id'=>['like','%,'.$id.',%']]);  
198 - if($contentInfo !== false){  
199 - $this->fail('当前分类拥有产品不允许删除');  
200 - }  
201 //删除路由 192 //删除路由
202 $this->delRoute($id); 193 $this->delRoute($id);
203 $this->model->del(['id'=>$id]); 194 $this->model->del(['id'=>$id]);
  195 + //同步删除产品字段category_id
  196 + $contentModel = new CustomModuleContent();
  197 + $contentModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
  198 + $contentModel->edit(['category_id'=>null],['category_id'=>',']);
204 } 199 }
205 return $this->success(); 200 return $this->success();
206 } 201 }
@@ -238,4 +233,18 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -238,4 +233,18 @@ class CustomModuleCategoryLogic extends BaseLogic
238 } 233 }
239 return $this->success(); 234 return $this->success();
240 } 235 }
  236 +
  237 + /**
  238 + * @remark :设置批量排序
  239 + * @name :setAllSort
  240 + * @author :lyh
  241 + * @method :post
  242 + * @time :2024/1/10 15:40
  243 + */
  244 + public function setAllSort(){
  245 + foreach ($this->param['data'] as $k => $v){
  246 + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
  247 + }
  248 + return $this->success();
  249 + }
241 } 250 }
@@ -16,6 +16,7 @@ use App\Models\CustomModule\CustomModuleContent; @@ -16,6 +16,7 @@ use App\Models\CustomModule\CustomModuleContent;
16 use App\Models\CustomModule\CustomModuleExtend; 16 use App\Models\CustomModule\CustomModuleExtend;
17 use App\Models\CustomModule\CustomModuleExtentContent; 17 use App\Models\CustomModule\CustomModuleExtentContent;
18 use App\Models\RouteMap\RouteMap; 18 use App\Models\RouteMap\RouteMap;
  19 +use App\Models\Template\BTemplate;
19 use Illuminate\Support\Facades\DB; 20 use Illuminate\Support\Facades\DB;
20 use mysql_xdevapi\Exception; 21 use mysql_xdevapi\Exception;
21 22
@@ -377,4 +378,106 @@ class CustomModuleContentLogic extends BaseLogic @@ -377,4 +378,106 @@ class CustomModuleContentLogic extends BaseLogic
377 $contentExtendModel->del(['content_id'=>$id]); 378 $contentExtendModel->del(['content_id'=>$id]);
378 return $this->success(); 379 return $this->success();
379 } 380 }
  381 +
  382 + /**
  383 + * @remark :设置批量排序
  384 + * @name :setAllSort
  385 + * @author :lyh
  386 + * @method :post
  387 + * @time :2024/1/10 15:40
  388 + */
  389 + public function setAllSort(){
  390 + foreach ($this->param['data'] as $k => $v){
  391 + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
  392 + }
  393 + return $this->success();
  394 + }
  395 +
  396 + /**
  397 + * @remark :复制扩展模块内容页
  398 + * @name :copyModuleContentInfo
  399 + * @author :lyh
  400 + * @method :post
  401 + * @time :2024/4/28 16:32
  402 + */
  403 + public function copyModuleContentInfo(){
  404 + $info = $this->model->read(['id'=>$this->param['id']]);
  405 + $param = $this->setContentParams($info);
  406 + $save_id = $this->model->insertGetId($param);
  407 + $this->copyTemplate($this->param['id'],$info['project_id'],$save_id,$info['module_id']);
  408 + $this->response('success');
  409 + }
  410 +
  411 + /**
  412 + * @remark :字段处理
  413 + * @name :setContentParams
  414 + * @author :lyh
  415 + * @method :post
  416 + * @time :2024/4/28 16:33
  417 + */
  418 + public function setContentParams($info){
  419 + return [
  420 + 'name'=>$info['name'].'-copy',
  421 + 'status'=>$info['status'],
  422 + 'sort'=>$info['sort'],
  423 + 'content'=>$info['content'],
  424 + 'remark'=>$info['remark'],
  425 + 'route'=>$info['route'],
  426 + 'image'=>$info['image'],
  427 + 'project_id'=>$info['project_id'],
  428 + 'operator_id'=>$this->user['id'],
  429 + 'module_id'=>$info['module_id'],
  430 + 'category_id'=>!empty($info['category_id']) ? ','.Arr::arrToSet($info['category_id']).',' : '',
  431 + 'video'=>Arr::a2s($info['video']),
  432 + 'created_at'=>date('Y-m-d H:i:s'),
  433 + 'updated_at'=>date('Y-m-d H:i:s')
  434 + ];
  435 + }
  436 +
  437 + /**
  438 + * @remark :同步模版数据
  439 + * @name :copyTemplate
  440 + * @author :lyh
  441 + * @method :post
  442 + * @time :2023/7/29 15:53
  443 + */
  444 + public function copyTemplate($id,$project_id,$save_id,$module_id){
  445 + $BTemplateModel = new BTemplate();
  446 + $list = $BTemplateModel->list(['source'=>$module_id,'source_id'=>$id,'is_custom'=>BTemplate::IS_CUSTOM,'project_id'=>$project_id]);
  447 + if(!empty($list)){
  448 + $data = [];
  449 + foreach ($list as $v){
  450 + $data[] = $this->setTemplateParams($v,$project_id,$save_id);
  451 + }
  452 + $rs = $BTemplateModel->insert($data);
  453 + if($rs === false){
  454 + $this->fail('error');
  455 + }
  456 + }
  457 + return $this->success();
  458 + }
  459 +
  460 + /**
  461 + * @remark :组装模版数据
  462 + * @name :setTemplateParams
  463 + * @author :lyh
  464 + * @method :post
  465 + * @time :2023/7/29 15:54
  466 + */
  467 + public function setTemplateParams($v,$project_id,$save_id){
  468 + $param = [
  469 + 'html'=>$v['html'],
  470 + 'project_id'=>$project_id,
  471 + 'source'=>$v['source'],
  472 + 'source_id'=>$save_id,
  473 + 'template_id'=>$v['template_id'],
  474 + 'section_list_id'=>$v['section_list_id'],
  475 + 'main_html'=>$v['main_html'],
  476 + 'main_css'=>$v['main_css'],
  477 + 'is_custom'=>$v['is_custom'],
  478 + 'created_at'=>$v['created_at'],
  479 + 'updated_at'=>$v['updated_at']
  480 + ];
  481 + return $this->success($param);
  482 + }
380 } 483 }
@@ -46,7 +46,7 @@ class CountLogic extends BaseLogic @@ -46,7 +46,7 @@ class CountLogic extends BaseLogic
46 //获取项目的剩余时长 46 //获取项目的剩余时长
47 $projectModel = new Project(); 47 $projectModel = new Project();
48 $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']); 48 $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']);
49 - $info['service_day'] = $this->project['deploy_build']['service_duration'] - $projectInfo['finish_remain_day']; 49 + $info['service_day'] = ($this->project['deploy_build']['service_duration'] ?? 0 - $projectInfo['finish_remain_day'] ?? 0);
50 $info['compliance_day'] = $projectInfo['finish_remain_day']; 50 $info['compliance_day'] = $projectInfo['finish_remain_day'];
51 return $this->success($info); 51 return $this->success($info);
52 } 52 }
@@ -4,8 +4,10 @@ namespace App\Http\Logic\Bside\News; @@ -4,8 +4,10 @@ namespace App\Http\Logic\Bside\News;
4 4
5 use App\Helper\Translate; 5 use App\Helper\Translate;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
  7 +use App\Models\News\News;
7 use App\Models\News\News as NewsModel; 8 use App\Models\News\News as NewsModel;
8 use App\Models\News\NewsCategory as NewsCategoryModel; 9 use App\Models\News\NewsCategory as NewsCategoryModel;
  10 +use App\Models\Product\Product;
9 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
10 use Illuminate\Support\Facades\DB; 12 use Illuminate\Support\Facades\DB;
11 13
@@ -88,19 +90,12 @@ class NewsCategoryLogic extends BaseLogic @@ -88,19 +90,12 @@ class NewsCategoryLogic extends BaseLogic
88 */ 90 */
89 public function del_news_category(){ 91 public function del_news_category(){
90 foreach ($this->param['id'] as $id){ 92 foreach ($this->param['id'] as $id){
91 - //查询是否有子分类  
92 - $rs = $this->model->read(['pid'=>$id],['id']);  
93 - if($rs !== false){  
94 - $this->fail('当前分类拥有子分类不允许删除');  
95 - }  
96 - //查看当前分内下是否有商品  
97 - $newsModel = new NewsModel();  
98 - $rs = $newsModel->read(['category_id'=>$id],['id']);  
99 - if($rs !== false){  
100 - $this->fail('当前分类拥有商品,不允许删除');  
101 - }  
102 $this->delRoute($id); 93 $this->delRoute($id);
103 $this->model->del(['id'=>$id]); 94 $this->model->del(['id'=>$id]);
  95 + //同步删除产品字段category_id
  96 + $newsModel = new NewsModel();
  97 + $newsModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
  98 + $newsModel->edit(['category_id'=>null],['category_id'=>',']);
104 } 99 }
105 return $this->success(); 100 return $this->success();
106 } 101 }
@@ -259,4 +254,18 @@ class NewsCategoryLogic extends BaseLogic @@ -259,4 +254,18 @@ class NewsCategoryLogic extends BaseLogic
259 } 254 }
260 return $this->success(); 255 return $this->success();
261 } 256 }
  257 +
  258 + /**
  259 + * @remark :设置批量排序
  260 + * @name :setAllSort
  261 + * @author :lyh
  262 + * @method :post
  263 + * @time :2024/1/10 15:40
  264 + */
  265 + public function setAllSort(){
  266 + foreach ($this->param['data'] as $k => $v){
  267 + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
  268 + }
  269 + return $this->success();
  270 + }
262 } 271 }
@@ -9,6 +9,7 @@ use App\Models\News\News; @@ -9,6 +9,7 @@ use App\Models\News\News;
9 use App\Models\News\NewsCategory; 9 use App\Models\News\NewsCategory;
10 use App\Models\News\NewsCategory as NewsCategoryModel; 10 use App\Models\News\NewsCategory as NewsCategoryModel;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
  12 +use App\Models\Template\BTemplate;
12 use App\Services\CosService; 13 use App\Services\CosService;
13 use Illuminate\Support\Facades\DB; 14 use Illuminate\Support\Facades\DB;
14 use mysql_xdevapi\Exception; 15 use mysql_xdevapi\Exception;
@@ -270,7 +271,7 @@ class NewsLogic extends BaseLogic @@ -270,7 +271,7 @@ class NewsLogic extends BaseLogic
270 } 271 }
271 272
272 /** 273 /**
273 - * @remark : 274 + * @remark :设置批量排序
274 * @name :setAllSort 275 * @name :setAllSort
275 * @author :lyh 276 * @author :lyh
276 * @method :post 277 * @method :post
@@ -427,16 +428,26 @@ class NewsLogic extends BaseLogic @@ -427,16 +428,26 @@ class NewsLogic extends BaseLogic
427 public function batchSetCategory(){ 428 public function batchSetCategory(){
428 if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { 429 if(isset($this->param['category_id']) && !empty($this->param['category_id'])) {
429 DB::connection('custom_mysql')->beginTransaction(); 430 DB::connection('custom_mysql')->beginTransaction();
430 - $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; 431 + $category_id_str = ','.implode(',',$this->param['category_id']).',';
431 try { 432 try {
432 - //批量 433 + if(!isset($this->param['is_cover']) || ($this->param['is_cover'] == 1)){
  434 + //批量覆盖
433 $param = [ 435 $param = [
434 - 'category_id'=>$this->param['category_id'], 436 + 'category_id'=>$category_id_str,
435 'status'=>$this->param['status'] 437 'status'=>$this->param['status']
436 ]; 438 ];
437 $this->model->edit($param,['id'=>['in',$this->param['id']]]); 439 $this->model->edit($param,['id'=>['in',$this->param['id']]]);
438 DB::connection('custom_mysql')->commit(); 440 DB::connection('custom_mysql')->commit();
439 - //对应添加关联表 441 + }else{
  442 + foreach ($this->param['id'] as $id){
  443 + //获取当前产品的分类
  444 + $newsInfo = $this->model->read(['id'=>$id],['id','category_id']);
  445 + $category_ids = explode(',',trim($newsInfo['category_id'],','));
  446 + $category_ids_arr = array_values(array_unique(array_merge($category_ids,$this->param['category_id'])));
  447 + $category_ids = ','.implode(',',$category_ids_arr).',';
  448 + $this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
  449 + }
  450 + }
440 }catch (\Exception $e){ 451 }catch (\Exception $e){
441 DB::connection('custom_mysql')->rollBack(); 452 DB::connection('custom_mysql')->rollBack();
442 $this->fail('系统错误,请联系管理员'); 453 $this->fail('系统错误,请联系管理员');
@@ -444,4 +455,70 @@ class NewsLogic extends BaseLogic @@ -444,4 +455,70 @@ class NewsLogic extends BaseLogic
444 } 455 }
445 return $this->success(); 456 return $this->success();
446 } 457 }
  458 +
  459 + /**
  460 + * @remark :复制新闻
  461 + * @name :copyNewsInfo
  462 + * @author :lyh
  463 + * @method :post
  464 + * @time :2024/4/28 14:51
  465 + */
  466 + public function copyNewsInfo(){
  467 + $info = $this->model->read(['id'=>$this->param['id']]);
  468 + $param = [
  469 + 'name'=>$info['name']."-copy",
  470 + 'status'=>$info['status'],
  471 + 'sort'=>$info['sort'],
  472 + 'category_id'=>$info['category_id'],
  473 + 'text'=>$info['text'],
  474 + 'remark'=>$info['remark'],
  475 + 'url'=>$info['url'],
  476 + 'image'=>$info['image'],
  477 + 'project_id'=>$info['project_id'],
  478 + 'operator_id'=>$this->user['id'],
  479 + 'create_id'=>$this->user['id'],
  480 + 'created_at'=>date('Y-m-d H:i:s'),
  481 + 'updated_at'=>date('Y-m-d H:i:s'),
  482 + ];
  483 + $save_id = $this->model->insertGetId($param);
  484 + $route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_NEWS, $save_id, $this->user['project_id']);
  485 + $this->model->edit(['url'=>$route],['id'=>$save_id]);
  486 + //同步可视化装修数据
  487 + $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
  488 + return $this->success(['id'=>$save_id]);
  489 + }
  490 +
  491 + /**
  492 + * @remark :同步模版数据
  493 + * @name :copyTemplate
  494 + * @author :lyh
  495 + * @method :post
  496 + * @time :2023/7/29 15:53
  497 + */
  498 + public function copyTemplate($id,$project_id,$save_id){
  499 + $BTemplateModel = new BTemplate();
  500 + $list = $BTemplateModel->list(['source'=>BTemplate::SOURCE_NEWS,'source_id'=>$id,'project_id'=>$project_id]);
  501 + if(!empty($list)){
  502 + $data = [];
  503 + foreach ($list as $v){
  504 + $data[] = [
  505 + 'html'=>$v['html'],
  506 + 'project_id'=>$project_id,
  507 + 'source'=>$v['source'],
  508 + 'source_id'=>$save_id,
  509 + 'template_id'=>$v['template_id'],
  510 + 'section_list_id'=>$v['section_list_id'],
  511 + 'main_html'=>$v['main_html'],
  512 + 'main_css'=>$v['main_css'],
  513 + 'created_at'=>date('Y-m-d H:i:s'),
  514 + 'updated_at'=>date('Y-m-d H:i:s'),
  515 + ];
  516 + }
  517 + $rs = $BTemplateModel->insert($data);
  518 + if($rs === false){
  519 + $this->fail('error');
  520 + }
  521 + }
  522 + return $this->success();
  523 + }
447 } 524 }
@@ -168,18 +168,16 @@ class CategoryLogic extends BaseLogic @@ -168,18 +168,16 @@ class CategoryLogic extends BaseLogic
168 public function categoryDelete(){ 168 public function categoryDelete(){
169 $ids = $this->param['ids']; 169 $ids = $this->param['ids'];
170 foreach ($ids as $id){ 170 foreach ($ids as $id){
171 - $info = $this->model->read(['pid'=>$id],['id']);  
172 - if($info !== false){  
173 - $this->fail('分类id:'.$id.'拥有子集不允许删除');  
174 - }  
175 - $productModel = new Product();  
176 - $product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]);  
177 - if($product_info !== false){  
178 - $this->fail('当前分类拥有产品不允许删除');  
179 - }  
180 //删除路由 171 //删除路由
181 $this->delRoute($id); 172 $this->delRoute($id);
182 $this->model->del(['id'=>$id]); 173 $this->model->del(['id'=>$id]);
  174 + //同步删除关联表
  175 + $categoryRelatedModel = new CategoryRelated();
  176 + $categoryRelatedModel->del(['cate_id'=>$id]);
  177 + //同步删除产品字段category_id
  178 + $productModel = new Product();
  179 + $productModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
  180 + $productModel->edit(['category_id'=>null],['category_id'=>',']);
183 } 181 }
184 //清除缓存 182 //清除缓存
185 Common::del_user_cache('product_category',$this->user['project_id']); 183 Common::del_user_cache('product_category',$this->user['project_id']);
@@ -273,4 +271,18 @@ class CategoryLogic extends BaseLogic @@ -273,4 +271,18 @@ class CategoryLogic extends BaseLogic
273 } 271 }
274 return $this->success(); 272 return $this->success();
275 } 273 }
  274 +
  275 + /**
  276 + * @remark :批量设置排序
  277 + * @name :setAllSort
  278 + * @author :lyh
  279 + * @method :post
  280 + * @time :2024/1/10 15:40
  281 + */
  282 + public function setAllSort(){
  283 + foreach ($this->param['data'] as $k => $v){
  284 + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
  285 + }
  286 + return $this->success();
  287 + }
276 } 288 }
@@ -335,22 +335,6 @@ class ProductLogic extends BaseLogic @@ -335,22 +335,6 @@ class ProductLogic extends BaseLogic
335 return !empty(trim($str,',')) ? ','.$str.',' : ''; 335 return !empty(trim($str,',')) ? ','.$str.',' : '';
336 } 336 }
337 337
338 - /**  
339 - * @remark :获取最后一级分类id(数组)  
340 - * @name :getLastCategory  
341 - * @author :lyh  
342 - * @method :post  
343 - * @time :2023/10/20 9:02  
344 - */  
345 - public function getLastCategoryArr($category){  
346 - $arr = [];  
347 - if(isset($category) && !empty($category)){  
348 - foreach ($category as $v){  
349 - $arr[] = $v;  
350 - }  
351 - }  
352 - return $arr;  
353 - }  
354 338
355 /** 339 /**
356 * @remark :编辑产品 340 * @remark :编辑产品
@@ -575,27 +559,29 @@ class ProductLogic extends BaseLogic @@ -575,27 +559,29 @@ class ProductLogic extends BaseLogic
575 * @time :2023/8/15 17:53 559 * @time :2023/8/15 17:53
576 */ 560 */
577 public function batchSetCategory(){ 561 public function batchSetCategory(){
578 - if(isset($this->param['category_id']) && !empty($this->param['category_id'])) {  
579 - DB::connection('custom_mysql')->beginTransaction();  
580 - $category_ids = $this->getLastCategoryArr($this->param['category_id']);  
581 - $this->param['category_id'] = ','.implode(',',$category_ids).','; 562 + if(!isset($this->param['category_id']) || empty($this->param['category_id'])){
  563 + $this->fail('请选择分类');
  564 + }
582 try { 565 try {
583 - //批量  
584 - $param = [  
585 - 'category_id'=>$this->param['category_id'],  
586 - 'status'=>$this->param['status']  
587 - ];  
588 - $this->model->edit($param,['id'=>['in',$this->param['id']]]); 566 + if(!isset($this->param['is_cover']) || ($this->param['is_cover'] == 1)){
  567 + $category_ids = ','.implode(',',$this->param['category_id']).',';
  568 + $this->model->edit(['category_id'=>$category_ids],['id'=>['in',$this->param['id']]]);
589 //分类关联 569 //分类关联
590 foreach ($this->param['id'] as $id){ 570 foreach ($this->param['id'] as $id){
591 - CategoryRelated::saveRelated($id, $category_ids); 571 + CategoryRelated::saveRelated($id, $this->param['category_id']);
  572 + }
  573 + }else{
  574 + foreach ($this->param['id'] as $id){
  575 + //获取当前产品的分类
  576 + $productInfo = $this->model->read(['id'=>$id],['id','category_id']);
  577 + $category_ids_arr = array_values(array_unique(array_merge($productInfo['category_id'],$this->param['category_id'])));
  578 + $category_ids = ','.implode(',',$category_ids_arr).',';
  579 + $this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
  580 + CategoryRelated::saveRelated($id, $category_ids_arr);
592 } 581 }
593 - DB::connection('custom_mysql')->commit();  
594 - //对应添加关联表  
595 - }catch (\Exception $e){  
596 - DB::connection('custom_mysql')->rollBack();  
597 - $this->fail('系统错误,请联系管理员');  
598 } 582 }
  583 + }catch (\Exception $e){
  584 + $this->fail('设置分类失败,请联系管理员');
599 } 585 }
600 return $this->success(); 586 return $this->success();
601 } 587 }
@@ -158,7 +158,9 @@ class UserLoginLogic @@ -158,7 +158,9 @@ class UserLoginLogic
158 $info['aicc'] = $project['aicc'] ?? ''; 158 $info['aicc'] = $project['aicc'] ?? '';
159 $info['hagro'] = $project['hagro'] ?? ''; 159 $info['hagro'] = $project['hagro'] ?? '';
160 $info['plan'] = Project::planMap()[$project['deploy_build']['plan']]; 160 $info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
161 - $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); 161 + $info['test_domain'] = $project['deploy_build']['test_domain'] ?? '';
  162 + $info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
  163 + ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');
162 $info['is_customized'] = $project['is_customized']; 164 $info['is_customized'] = $project['is_customized'];
163 $info['is_upload_manage'] = $project['is_upload_manage']; 165 $info['is_upload_manage'] = $project['is_upload_manage'];
164 $info['is_upgrade'] = $project['is_upgrade']; 166 $info['is_upgrade'] = $project['is_upgrade'];
@@ -258,8 +260,9 @@ class UserLoginLogic @@ -258,8 +260,9 @@ class UserLoginLogic
258 $info['hagro'] = $project['hagro'] ?? ''; 260 $info['hagro'] = $project['hagro'] ?? '';
259 $info['plan'] = Project::planMap()[$project['deploy_build']['plan']]; 261 $info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
260 $info['is_domain'] = empty($project['deploy_optimize']['domain']) ? 0 : 1; 262 $info['is_domain'] = empty($project['deploy_optimize']['domain']) ? 0 : 1;
  263 + $info['test_domain'] = $project['deploy_build']['test_domain'] ?? '';
261 $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? 264 $info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
262 - ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); 265 + ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');
263 $info['is_customized'] = $project['is_customized']; 266 $info['is_customized'] = $project['is_customized'];
264 $info['is_upgrade'] = $project['is_upgrade']; 267 $info['is_upgrade'] = $project['is_upgrade'];
265 $info['is_upload_manage'] = $project['is_upload_manage']; 268 $info['is_upload_manage'] = $project['is_upload_manage'];
@@ -36,6 +36,7 @@ class NavRequest extends FormRequest @@ -36,6 +36,7 @@ class NavRequest extends FormRequest
36 'pid' => ['required','integer'], 36 'pid' => ['required','integer'],
37 'name' => ['required','max:100'], 37 'name' => ['required','max:100'],
38 'url' => ['required'], 38 'url' => ['required'],
  39 + 'remark'=> ['max:500']
39 ]; 40 ];
40 return $rule; 41 return $rule;
41 } 42 }
@@ -51,6 +52,7 @@ class NavRequest extends FormRequest @@ -51,6 +52,7 @@ class NavRequest extends FormRequest
51 'name.required' => '名称必须', 52 'name.required' => '名称必须',
52 'name.max' => '名称不能超过100个字符', 53 'name.max' => '名称不能超过100个字符',
53 'url.required' => '链接不能为空', 54 'url.required' => '链接不能为空',
  55 + 'remark.max' => '描述超过最长500字符',
54 ]; 56 ];
55 } 57 }
56 } 58 }
@@ -15,6 +15,7 @@ class BTemplate extends Base @@ -15,6 +15,7 @@ class BTemplate extends Base
15 /** 15 /**
16 * 模块类型 16 * 模块类型
17 */ 17 */
  18 + const SOURCE_COM = 99;//公共页面
18 const SOURCE_HOME = 1;//首页 19 const SOURCE_HOME = 1;//首页
19 const SOURCE_PRODUCT = 2;//产品 20 const SOURCE_PRODUCT = 2;//产品
20 21
@@ -29,7 +30,12 @@ class BTemplate extends Base @@ -29,7 +30,12 @@ class BTemplate extends Base
29 */ 30 */
30 const ALL_HTML = 1;//无需拼接数据,获取整个html 31 const ALL_HTML = 1;//无需拼接数据,获取整个html
31 const PAGE_HTML = 0;//默认保存方式为0, 32 const PAGE_HTML = 0;//默认保存方式为0,
32 - 33 + /**
  34 + * 公共头部底部连接部分
  35 + */
  36 + const COMMON_HEAD = 1;//公共头部
  37 + const COMMON_FOOTER = 2;//公共头部
  38 + const COMMON_OTHER = 3;//公共头部
33 /** 39 /**
34 * 独立头部类型 40 * 独立头部类型
35 */ 41 */
@@ -52,7 +58,7 @@ class BTemplate extends Base @@ -52,7 +58,7 @@ class BTemplate extends Base
52 const IS_NO_CUSTOM = 0;//为默认模块 58 const IS_NO_CUSTOM = 0;//为默认模块
53 const IS_VISUALIZATION = 1;//定制项目 59 const IS_VISUALIZATION = 1;//定制项目
54 60
55 - const IS_NO_VISUALIZATION = 1;//定制项目 61 + const IS_NO_VISUALIZATION = 0;//非定制项目
56 const STATUS = 0; 62 const STATUS = 0;
57 63
58 /** 64 /**
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :BTemplateCom.php
  5 + * @author :lyh
  6 + * @method :post
  7 +<<<<<<< HEAD
  8 + * @time :2024/5/7 10:13
  9 +=======
  10 + * @time :2024/4/29 10:29
  11 +>>>>>>> 6ab07f6903cde5505cc85cd6989e6f0401614405
  12 + */
  13 +
  14 +namespace App\Models\Template;
  15 +
  16 +use App\Models\Base;
  17 +
  18 +/**
  19 + * @remark :可视化公共部分
  20 + * @name :BTemplateCom
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2024/4/29 10:29
  24 + */
  25 +class BTemplateCom extends Base
  26 +{
  27 + protected $table = 'gl_web_template_com';
  28 + //连接数据库
  29 + protected $connection = 'custom_mysql';
  30 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateReplaceHtml.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/8 9:05
  8 + */
  9 +
  10 +namespace App\Models\Template;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class TemplateReplaceHtml extends Base
  15 +{
  16 + protected $table = 'gl_replace_html';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
  19 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateReplaceHtmlLog.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/8 9:34
  8 + */
  9 +
  10 +namespace App\Models\Template;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class TemplateReplaceHtmlLog extends Base
  15 +{
  16 + protected $table = 'gl_replace_html_log';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
  19 +}
@@ -133,7 +133,7 @@ class ProjectServer @@ -133,7 +133,7 @@ class ProjectServer
133 //初始化模块数据 133 //初始化模块数据
134 self::initModule($project_id); 134 self::initModule($project_id);
135 //初始化search页面 135 //初始化search页面
136 - self::initSearchPage($project_id); 136 +// self::initSearchPage($project_id);
137 DB::disconnect('custom_mysql'); 137 DB::disconnect('custom_mysql');
138 return true; 138 return true;
139 } 139 }
@@ -376,7 +376,12 @@ Route::middleware(['aloginauth'])->group(function () { @@ -376,7 +376,12 @@ Route::middleware(['aloginauth'])->group(function () {
376 Route::any('/del', [Aside\Template\ATemplateTypeController::class, 'del'])->name('admin.ATemplateType_del'); 376 Route::any('/del', [Aside\Template\ATemplateTypeController::class, 'del'])->name('admin.ATemplateType_del');
377 }); 377 });
378 }); 378 });
379 - 379 + //可视化数据替换
  380 + Route::prefix('replace')->group(function () {
  381 + Route::any('/replaceTemplateMainHtml', [Aside\Template\ReplaceHtmlController::class, 'replaceTemplateMainHtml'])->name('admin.replace_replaceTemplateMainHtml');
  382 + Route::any('/replaceTemplateLog', [Aside\Template\ReplaceHtmlController::class, 'replaceTemplateLog'])->name('admin.replace_replaceTemplateLog');
  383 + Route::any('/reductionHtml', [Aside\Template\ReplaceHtmlController::class, 'reductionHtml'])->name('admin.replace_reductionHtml');
  384 + });
380 385
381 Route::any('/generate_aicc_token', [Aside\Com\IndexController::class, 'generateAiCCToken'])->name('admin.generate_aicc_token'); 386 Route::any('/generate_aicc_token', [Aside\Com\IndexController::class, 'generateAiCCToken'])->name('admin.generate_aicc_token');
382 Route::any('/getAutoToken', [Aside\Com\IndexController::class, 'getAutoToken'])->name('admin.getAutoToken'); 387 Route::any('/getAutoToken', [Aside\Com\IndexController::class, 'getAutoToken'])->name('admin.getAutoToken');
@@ -77,12 +77,14 @@ Route::middleware(['bloginauth'])->group(function () { @@ -77,12 +77,14 @@ Route::middleware(['bloginauth'])->group(function () {
77 Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info'); 77 Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info');
78 Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_edit'); 78 Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_edit');
79 Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del'); 79 Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del');
  80 + Route::any('/category/allSort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'allSort'])->name('news_category_allSort');
80 Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status'); 81 Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status');
81 Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort'); 82 Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort');
82 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList'); 83 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList');
83 //新闻 84 //新闻
84 Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists'); 85 Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists');
85 Route::any('/newsNoPage', [\App\Http\Controllers\Bside\News\NewsController::class, 'newsNoPage'])->name('news_newsNoPage'); 86 Route::any('/newsNoPage', [\App\Http\Controllers\Bside\News\NewsController::class, 'newsNoPage'])->name('news_newsNoPage');
  87 + Route::any('/copyNews', [\App\Http\Controllers\Bside\News\NewsController::class, 'copyNews'])->name('news_copyNews');
86 Route::any('/get_category_list', [\App\Http\Controllers\Bside\News\NewsController::class, 'get_category_list'])->name('news_get_category_list'); 88 Route::any('/get_category_list', [\App\Http\Controllers\Bside\News\NewsController::class, 'get_category_list'])->name('news_get_category_list');
87 Route::any('/add', [\App\Http\Controllers\Bside\News\NewsController::class, 'save'])->name('news_add'); 89 Route::any('/add', [\App\Http\Controllers\Bside\News\NewsController::class, 'save'])->name('news_add');
88 Route::any('/edit_seo', [\App\Http\Controllers\Bside\News\NewsController::class, 'edit_seo'])->name('news_edit_seo'); 90 Route::any('/edit_seo', [\App\Http\Controllers\Bside\News\NewsController::class, 'edit_seo'])->name('news_edit_seo');
@@ -111,6 +113,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -111,6 +113,7 @@ Route::middleware(['bloginauth'])->group(function () {
111 Route::any('/sort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'sort'])->name('blog_sort'); 113 Route::any('/sort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'sort'])->name('blog_sort');
112 Route::any('/allSort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'allSort'])->name('blog_allSort'); 114 Route::any('/allSort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'allSort'])->name('blog_allSort');
113 Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'batchSetCategory'])->name('blog_batchSetCategory'); 115 Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'batchSetCategory'])->name('blog_batchSetCategory');
  116 + Route::any('/copyBlog', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'copyBlog'])->name('blog_copyBlog');
114 Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); 117 Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum');
115 //分类 118 //分类
116 Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); 119 Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists');
@@ -118,6 +121,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -118,6 +121,7 @@ Route::middleware(['bloginauth'])->group(function () {
118 Route::any('/category/info', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'info'])->name('blog_category_info'); 121 Route::any('/category/info', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'info'])->name('blog_category_info');
119 Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_edit'); 122 Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_edit');
120 Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); 123 Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del');
  124 + Route::any('/category/allSort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'allSort'])->name('blog_category_allSort');
121 Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); 125 Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status');
122 Route::any('/category/sort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'sort'])->name('blog_category_sort'); 126 Route::any('/category/sort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'sort'])->name('blog_category_sort');
123 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList'); 127 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList');
@@ -250,7 +254,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -250,7 +254,7 @@ Route::middleware(['bloginauth'])->group(function () {
250 Route::post('category/save', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'save'])->name('product_category_save'); 254 Route::post('category/save', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'save'])->name('product_category_save');
251 Route::post('category/sort', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'sort'])->name('product_category_sort'); 255 Route::post('category/sort', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'sort'])->name('product_category_sort');
252 Route::any('category/delete', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'delete'])->name('product_category_delete'); 256 Route::any('category/delete', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'delete'])->name('product_category_delete');
253 - 257 + Route::any('category/allSort', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'allSort'])->name('product_category_allSort');
254 //产品关键词 258 //产品关键词
255 Route::get('keyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'index'])->name('product_keyword'); 259 Route::get('keyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'index'])->name('product_keyword');
256 Route::get('keyword/info', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'info'])->name('product_keyword_info'); 260 Route::get('keyword/info', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'info'])->name('product_keyword_info');
@@ -353,7 +357,6 @@ Route::middleware(['bloginauth'])->group(function () { @@ -353,7 +357,6 @@ Route::middleware(['bloginauth'])->group(function () {
353 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate'); 357 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
354 Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo'); 358 Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo');
355 Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail'); 359 Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail');
356 - Route::any('/getSource', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getSource'])->name('template_getSource');  
357 // 模板 360 // 模板
358 Route::prefix('module')->group(function () { 361 Route::prefix('module')->group(function () {
359 //获取所有左侧模版 362 //获取所有左侧模版
@@ -398,6 +401,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -398,6 +401,7 @@ Route::middleware(['bloginauth'])->group(function () {
398 Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del'); 401 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'); 402 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'); 403 Route::any('/getCustomTemplateLog', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'getCustomTemplateLog'])->name('custom_getCustomTemplateLog');
  404 + Route::any('/copyCustomTemplate', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'copyCustomTemplate'])->name('custom_copyCustomTemplate');
401 }); 405 });
402 // 菜单组 406 // 菜单组
403 Route::prefix('nav_group')->group(function () { 407 Route::prefix('nav_group')->group(function () {
@@ -487,6 +491,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -487,6 +491,7 @@ Route::middleware(['bloginauth'])->group(function () {
487 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'save'])->name('custom_category_save'); 491 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'save'])->name('custom_category_save');
488 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'del'])->name('custom_category_del'); 492 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'del'])->name('custom_category_del');
489 Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'sort'])->name('custom_category_sort'); 493 Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'sort'])->name('custom_category_sort');
  494 + Route::any('/allSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'allSort'])->name('custom_category_allSort');
490 }); 495 });
491 496
492 Route::prefix('content')->group(function () { 497 Route::prefix('content')->group(function () {
@@ -496,6 +501,8 @@ Route::middleware(['bloginauth'])->group(function () { @@ -496,6 +501,8 @@ Route::middleware(['bloginauth'])->group(function () {
496 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'save'])->name('custom_content_save'); 501 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'save'])->name('custom_content_save');
497 Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'sort'])->name('custom_content_sort'); 502 Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'sort'])->name('custom_content_sort');
498 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del'); 503 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del');
  504 + Route::any('/allSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'allSort'])->name('custom_content_allSort');
  505 + Route::any('/copyModuleContent', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'copyModuleContent'])->name('custom_content_copyModuleContent');
499 }); 506 });
500 507
501 Route::prefix('extend')->group(function () { 508 Route::prefix('extend')->group(function () {