作者 zhl

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

正在显示 31 个修改的文件 包含 1346 行增加697 行删除
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\GeneratePDF;
  4 +
  5 +use App\Models\File\PdfFile;
  6 +use App\Models\ProjectAssociation\ProjectAssociation;
  7 +use App\Services\CosService;
  8 +use Barryvdh\DomPDF\Facade\Pdf;
  9 +use Illuminate\Console\Command;
  10 +
  11 +class GeneratePdfData extends Command
  12 +{
  13 +// use CmdSignal;
  14 +
  15 + /**
  16 + * The name and signature of the console command.
  17 + *
  18 + * @var string
  19 + */
  20 + protected $signature = 'generate_pdf_data';
  21 +
  22 + /**
  23 + * The console command description.
  24 + *
  25 + * @var string
  26 + */
  27 + protected $description = '生成v6绑定的aicc用户的pdf备用数据';
  28 +
  29 + // 最大支持5个进程
  30 + public $maxRunNumber = 50;
  31 +
  32 + /**
  33 + * Create a new command instance.
  34 + *
  35 + * @return void
  36 + */
  37 + public function __construct()
  38 + {
  39 + parent::__construct();
  40 + }
  41 +
  42 + public function handle()
  43 + {
  44 + return $this->main();
  45 + }
  46 +
  47 + /**
  48 + * @return int
  49 + */
  50 + public function start(): int
  51 + {
  52 + return $this->main();
  53 + }
  54 +
  55 + /**
  56 + * @return int
  57 + */
  58 + protected function main()
  59 + {
  60 + $month = date('m');
  61 + $list = ProjectAssociation::query()->whereStatus(ProjectAssociation::STATUS_NORMAL)
  62 + ->where('m_status', '!=', $month)->first();
  63 +
  64 + if (is_null($list)) {
  65 + $this->error('没有任务,等待中');
  66 + sleep(60);
  67 + return 0;
  68 + }
  69 + $pdfFile = new PdfFile();
  70 + $bool = $pdfFile->saveData(['pid' => $list->id]);
  71 + if (!$bool) {
  72 + $this->error('生成v6绑定的aicc用户的pdf备用数据添加失败');
  73 + return 0;
  74 + }
  75 + $list->m_status = $month;
  76 + $list->save();
  77 + $this->info('生成v6绑定的aicc用户的pdf备用数据添加成功');
  78 + return 0;
  79 + }
  80 +}
1 <?php 1 <?php
2 2
3 -namespace App\Console\Commands; 3 +namespace App\Console\Commands\GeneratePDF;
4 4
5 -use App\Http\Controllers\File\FileController;  
6 -use App\Models\File\DataFile; 5 +use App\Models\File\PdfFile;
7 use App\Models\ProjectAssociation\ProjectAssociation; 6 use App\Models\ProjectAssociation\ProjectAssociation;
8 use App\Services\CosService; 7 use App\Services\CosService;
9 use Barryvdh\DomPDF\Facade\Pdf; 8 use Barryvdh\DomPDF\Facade\Pdf;
@@ -12,7 +11,7 @@ use Illuminate\Http\File; @@ -12,7 +11,7 @@ use Illuminate\Http\File;
12 11
13 class ProjectFilePDF extends Command 12 class ProjectFilePDF extends Command
14 { 13 {
15 - use CmdSignal; 14 +// use CmdSignal;
16 15
17 /** 16 /**
18 * The name and signature of the console command. 17 * The name and signature of the console command.
@@ -28,14 +27,8 @@ class ProjectFilePDF extends Command @@ -28,14 +27,8 @@ class ProjectFilePDF extends Command
28 */ 27 */
29 protected $description = '网站项目数据,生成PDF文件'; 28 protected $description = '网站项目数据,生成PDF文件';
30 29
31 - protected $ProjectAssociation;  
32 -  
33 - protected $DataFile;  
34 -  
35 protected $time; 30 protected $time;
36 31
37 - protected $fileController;  
38 -  
39 protected $CosService; 32 protected $CosService;
40 33
41 // 最大支持5个进程 34 // 最大支持5个进程
@@ -48,71 +41,91 @@ class ProjectFilePDF extends Command @@ -48,71 +41,91 @@ class ProjectFilePDF extends Command
48 */ 41 */
49 public function __construct() 42 public function __construct()
50 { 43 {
51 - $this->ProjectAssociation = new ProjectAssociation();  
52 - $this->DataFile = new DataFile();  
53 - $this->time = date("Y-m");  
54 - $this->fileController = new FileController();  
55 - $this->CosService = new CosService(); 44 + $this->time = date("Y-m");
  45 + $this->CosService = new CosService();
56 parent::__construct(); 46 parent::__construct();
57 } 47 }
58 48
59 -// public function handle()  
60 -// {  
61 -// $project_data = [];  
62 -// $html = $this->html($project_data);  
63 -// $filename = hash('md5', $this->time . '-' . '$project_id' . '-' . '$friend_id' . '-' . '$user_id');  
64 -// $this->savePDF($html, $filename);  
65 -//// $this->testStreamPdf($html, $filename);  
66 -//// $file_path = $this->savePDF2($html, $filename);  
67 -// return 0;  
68 -// } 49 + public function handle()
  50 + {
  51 +
  52 + // 开始时间
  53 + $startTime = microtime(true);
  54 +
  55 + $gg = $this->main();
  56 +
  57 + // 结束时间
  58 + $endTime = microtime(true);
  59 +
  60 + // 计算执行时间
  61 + $executionTime = ($endTime - $startTime);
69 62
  63 + // 输出执行时间
  64 + var_dump("程序执行时间: " . $executionTime . " 秒");
  65 +
  66 + return $gg;
  67 +
  68 + }
  69 +
  70 + /**
  71 + * @return int
  72 + */
70 public function start(): int 73 public function start(): int
71 { 74 {
72 - # 0 - 未生成  
73 - # 1 - 已生成  
74 - # 2 - 其它问题  
75 - $is_pdf = 0;  
76 - $lists = $this->ProjectAssociation::query()->where('is_pdf', $is_pdf)  
77 - ->where('project_id', '!=', 0)  
78 - ->where('friend_id', '!=', 0)  
79 - ->where('user_id', '!=', 0)  
80 - ->where('created_at', 'like', $this->time . '%')->first();  
81 -  
82 - if (is_null($lists)) {  
83 - $this->debug_echo('没有任务,等待中');  
84 - sleep(30); 75 + return $this->main();
  76 + }
  77 +
  78 + /**
  79 + * @return int
  80 + */
  81 + protected function main()
  82 + {
  83 + $list = PdfFile::query()->whereIsPdf(PdfFile::GENERATE_NOT_PDF)->first();
  84 +
  85 + if (is_null($list)) {
  86 + $this->error('没有任务,等待中');
  87 + sleep(60);
  88 + return 0;
  89 + }
  90 + $pid = $list->pid;
  91 + if (empty($pid)) {
  92 + $this->error('数据错误');
  93 + return 0;
  94 + }
  95 + $isExists = ProjectAssociation::query()->whereId($pid)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first();
  96 + if (is_null($isExists)) {
  97 + $this->error('数据已被禁用 —— ' . $pid);
85 return 0; 98 return 0;
86 } 99 }
87 - $key = $this->signature . '-' . $lists->id;  
88 - $count = redis_get($key);  
89 100
90 - $project_id = $lists->project_id;  
91 - $user_id = $lists->user_id;  
92 - $friend_id = $lists->friend_id; 101 + $key = 'generate_pdf_' . $list->id;
  102 + $count = (int)redis_get($key) ?: 0;
  103 + $project_id = $isExists->project_id;
  104 + $user_id = $isExists->user_id;
  105 + $friend_id = $isExists->friend_id;
93 // todo 根据项目查询数据 106 // todo 根据项目查询数据
94 $project_data = []; 107 $project_data = [];
95 $html = $this->html($project_data); 108 $html = $this->html($project_data);
96 $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id); 109 $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id);
97 110
  111 + if ($count == 2) {
  112 + $list->is_pdf = PdfFile::GENERATE_OTHER_PDF;
  113 + $list->save();
  114 + $this->error('项目文件数据保存失败! - 其他原因 - ' . $key);
  115 + return 0;
  116 + }
  117 +
98 $file_path = $this->savePDF($html, $filename); 118 $file_path = $this->savePDF($html, $filename);
99 if (empty($file_path)) { 119 if (empty($file_path)) {
100 - $this->debug_echo('pdf生成失败!'); 120 + redis_set($key, $count + 1);
  121 + $this->error('pdf生成失败!');
101 return 0; 122 return 0;
102 } 123 }
103 - $isRes = $this->DataFile->saveData(compact('project_id', 'user_id', 'friend_id', 'file_path') + ['time' => $this->time]);  
104 - if (!$isRes) {  
105 - if ($count == 2) {  
106 - $lists->is_pdf = 2;  
107 - $lists->save();  
108 - $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key);  
109 - } else {  
110 - redis_set($key, $count + 1);  
111 - $this->debug_echo('项目文件数据保存失败! - ' . $key);  
112 - }  
113 - }  
114 - $lists->is_pdf = 1;  
115 - $lists->save(); 124 +
  125 + // 保存文件路径
  126 + $list->file_path = $file_path;
  127 + $list->is_pdf = PdfFile::GENERATE_PDF;
  128 + $list->save();
116 $this->info('项目文件数据保存成功!'); 129 $this->info('项目文件数据保存成功!');
117 return 0; 130 return 0;
118 } 131 }
@@ -131,18 +144,22 @@ class ProjectFilePDF extends Command @@ -131,18 +144,22 @@ class ProjectFilePDF extends Command
131 } 144 }
132 // 指定保存路径和文件名 145 // 指定保存路径和文件名
133 $savePath = $pdf_path . $filename . '.pdf'; 146 $savePath = $pdf_path . $filename . '.pdf';
  147 +
134 if (file_exists($savePath)) { 148 if (file_exists($savePath)) {
135 echo '文件已经存在'; 149 echo '文件已经存在';
136 return 0; 150 return 0;
137 } 151 }
138 152
139 - $pdf = PDF::loadHTML($html);  
140 - $pdf->save($savePath); 153 + $path = '/PDF/' . $this->time;
  154 + $pdf = PDF::loadHTML($html);
  155 +
  156 + // 获取二进制文件
  157 + $binary = $pdf->output(['compres' => 0]);
  158 + // 将文件保存到本地
  159 +// $pdf->save($savePath);
  160 +// $binary = new File($savePath);
141 161
142 - $path = '/V6/PDF/' . $this->time;  
143 - // 创建一个文件实例  
144 - $file = new File($savePath);  
145 - return $this->CosService->uploadFile($file, $path, $filename . '.pdf'); 162 + return $this->CosService->uploadFile($binary, $path, $filename . '.pdf', true);
146 } 163 }
147 164
148 /** 165 /**
@@ -153,6 +170,6 @@ class ProjectFilePDF extends Command @@ -153,6 +170,6 @@ class ProjectFilePDF extends Command
153 protected function html($item) 170 protected function html($item)
154 { 171 {
155 $font_path = storage_path('fonts\msyh.ttf'); 172 $font_path = storage_path('fonts\msyh.ttf');
156 - return '<html><head><title>Laravel</title><meta http-equiv=\'Content-Type\' content=\'text/html; charset=utf-8\'/><style>body{ font-family: \'msyh\'; } @font-face { font-family: \'msyh\'; font-style: normal; font-weight: normal; src: url(' . $font_path . ') format(\'truetype\'); }</style></head><body><div class=\'container\'><div class=\'content\'><p style=\'font-family: msyh, DejaVu Sans,sans-serif;\'>献给母亲的爱</p><div style=\'font-family: msyh, DejaVu Sans,sans-serif;\' class=\'title\'>Laravel 5中文测试</div><div class=\'title\'>测试三askjdhfkjasdhf</div></div></div></body></html>'; 173 + return '<html><head><title>Laravel</title><meta http-equiv=\'Content-Type\' content=\'text/html; charset=utf-8\'/><style>body{ font-family: \'msyh\'; } @font-face { font-family: \'msyh\'; font-style: normal; font-weight: normal; src: url(' . $font_path . ') format(\'truetype\'); }</style></head><body><div class=\'container\'><div class=\'content\'><p style=\'font-family: msyh, DejaVu Sans,sans-serif;\'>献给母亲的爱</p><div style=\'font-family: msyh, DejaVu Sans,sans-serif;\' class=\'title\'>Laravel 5中文测试sdsd</div><div class=\'title\'>测试三askjdhfkjasdhf</div></div></div></body></html>';
157 } 174 }
158 } 175 }
1 <?php 1 <?php
2 2
3 -namespace App\Console\Commands; 3 +namespace App\Console\Commands\GeneratePDF;
4 4
5 -use App\Models\File\DataFile; 5 +use App\Models\File\PdfFile;
  6 +use App\Models\ProjectAssociation\ProjectAssociation;
6 use Illuminate\Console\Command; 7 use Illuminate\Console\Command;
7 8
8 -class WebsiteData extends Command 9 +class PushAiccData extends Command
9 { 10 {
10 - use CmdSignal; 11 +// use CmdSignal;
11 12
12 /** 13 /**
13 * The name and signature of the console command. 14 * The name and signature of the console command.
14 * 15 *
15 * @var string 16 * @var string
16 */ 17 */
17 - protected $signature = 'website_data'; 18 + protected $signature = 'push_data_to_aicc';
18 19
19 /** 20 /**
20 * The console command description. 21 * The console command description.
@@ -39,48 +40,72 @@ class WebsiteData extends Command @@ -39,48 +40,72 @@ class WebsiteData extends Command
39 parent::__construct(); 40 parent::__construct();
40 } 41 }
41 42
  43 +
  44 + public function handle()
  45 + {
  46 + return $this->main();
  47 + }
  48 +
42 public function start(): int 49 public function start(): int
43 { 50 {
44 - # 0 - 未推送  
45 - # 1 - 已推送  
46 - # 2 - 其他问题  
47 - $status = 0;  
48 - $lists = DataFile::query()->where('status', $status)  
49 - ->where('created_at', 'like', $this->time . '%')->first();  
50 - if (is_null($lists)) {  
51 - $this->debug_echo('没有任务,等待中');  
52 - sleep(30); 51 + return $this->main();
  52 + }
  53 +
  54 + protected function main()
  55 + {
  56 + $list = PdfFile::query()->whereIsPdf(PdfFile::GENERATE_PUSH)->whereIsPush(PdfFile::GENERATE_NOT_PUSH)->first();
  57 + if (is_null($list)) {
  58 + $this->error('向AICC推送 - 没有任务,等待中');
  59 + sleep(60);
  60 + return 0;
  61 + }
  62 +
  63 + $pid = $list->pid;
  64 + if (empty($pid)) {
  65 + $this->error('向AICC推送数据错误');
  66 + return 0;
  67 + }
  68 + $isExists = ProjectAssociation::query()->whereId($pid)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first();
  69 + if (is_null($isExists)) {
  70 + $this->error('向AICC推送数据已被禁用 —— ' . $pid);
53 return 0; 71 return 0;
54 } 72 }
55 73
56 - $key = $this->signature . '-' . $lists->id;  
57 - $count = redis_get($key);  
58 - $data = $lists;  
59 - $url = env('AICC_URL'); 74 + $key = 'push_data_to_aicc_' . $list->id;
  75 + $count = (int)redis_get($key) ?: 0;
  76 +
  77 + $data = $list->toArray();
  78 + $data['project_id'] = $isExists->project_id;
  79 + $data['friend_id'] = $isExists->friend_id;
  80 + $data['user_id'] = $isExists->user_id;
  81 +
  82 + $url = env('AICC_URL') . env('AICC_PUSH_API_URL');
60 $msg = http_post($url, json_encode(compact('data'))); 83 $msg = http_post($url, json_encode(compact('data')));
61 $status_code = 0; 84 $status_code = 0;
62 if ($msg) { 85 if ($msg) {
63 $status_code = (int)$msg['status']; 86 $status_code = (int)$msg['status'];
64 } 87 }
  88 + if ($count == 2) {
  89 + $list->is_push = PdfFile::GENERATE_OTHER_PUSH;
  90 + $list->save();
  91 + $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key);
  92 + return 0;
  93 + }
  94 +
65 if ($status_code != 200) { 95 if ($status_code != 200) {
66 - if ($count == 2) {  
67 - $lists->status = 2;  
68 - $lists->save();  
69 - $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key);  
70 - } else {  
71 - redis_set($key, $count + 1);  
72 - $this->debug_echo('项目文件数据保存失败! - ' . $key);  
73 - } 96 + redis_set($key, $count + 1);
  97 + $this->debug_echo('项目文件数据保存失败! - ' . $key);
  98 + return 0;
74 } 99 }
75 - $lists->status = 1;  
76 - $lists->save(); 100 + $list->is_push = PdfFile::GENERATE_PUSH;
  101 + $list->save();
77 $this->info('项目文件数据保存成功!'); 102 $this->info('项目文件数据保存成功!');
78 return 0; 103 return 0;
79 } 104 }
80 105
81 public function post_data($data) 106 public function post_data($data)
82 { 107 {
83 - $url = env('AICC_URL'); 108 + $url = env('AICC_URL') . env('AICC_PUSH_API_URL');
84 $msg = http_post($url, json_encode(compact('data'))); 109 $msg = http_post($url, json_encode(compact('data')));
85 print_r($msg); 110 print_r($msg);
86 } 111 }
@@ -82,6 +82,17 @@ class InitProject extends Command @@ -82,6 +82,17 @@ class InitProject extends Command
82 } 82 }
83 83
84 /** 84 /**
  85 + * @remark :保存默认扩展模块
  86 + * @name :saveModule
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2023/12/28 15:53
  90 + */
  91 + public function saveModule(){
  92 +
  93 + }
  94 +
  95 + /**
85 * @param NoticeLog $log 96 * @param NoticeLog $log
86 */ 97 */
87 public function retry($log, $remark){ 98 public function retry($log, $remark){
@@ -136,7 +136,7 @@ class HtmlCollect extends Command @@ -136,7 +136,7 @@ class HtmlCollect extends Command
136 } 136 }
137 137
138 138
139 - $update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first(); 139 + $update_log = UpdateLog::whereNotIn('project_id', [555, 626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first();
140 if (!$update_log) { 140 if (!$update_log) {
141 return false; 141 return false;
142 } 142 }
@@ -41,28 +41,60 @@ class HtmlCustomCollect extends Command @@ -41,28 +41,60 @@ class HtmlCustomCollect extends Command
41 { 41 {
42 ini_set('memory_limit', '512M'); 42 ini_set('memory_limit', '512M');
43 43
44 - $project_id = 517;  
45 - $project_site = 'v6-1gee9.globalso.site'; 44 +// $project_id = 437;
  45 +// $project_site = 'v6-1500k.globalso.site';
  46 +// $pages = [
  47 +// 'https://www.tourletent.com/project/b300-glamping-tent-in-china/',
  48 +// 'https://www.tourletent.com/project/lotus-bell-tent-in-australia/',
  49 +// 'https://www.tourletent.com/project/luxury-resort-in-china/',
  50 +// 'https://www.tourletent.com/project/canvas-safari-tent-inthailand/',
  51 +// 'https://www.tourletent.com/project/safari-tent-for-m8-in-mexcio/',
  52 +// 'https://www.tourletent.com/project/9m-pvc-dome-tent-in-canada/',
  53 +// 'https://www.tourletent.com/project/c900-hotel-tent-in-korea/',
  54 +// 'https://www.tourletent.com/project/safari-tent-in-guizhou/',
  55 +// 'https://www.tourletent.com/project/dome-tent-in-austin/',
  56 +// 'https://www.tourletent.com/project/safari-tent-in-italy/',
  57 +// 'https://www.tourletent.com/project/glass-igloo-in-china/',
  58 +// 'https://www.tourletent.com/project/tree-house-in-sichuan/'
  59 +// ];
  60 +
  61 +// $project_id = 517;
  62 +// $project_site = 'v6-1gee9.globalso.site';
  63 +// $pages = [
  64 +// 'https://www.beifa.group/help/send-results/',
  65 +// 'https://www.beifa.group/help/terms-of-use/',
  66 +// 'https://www.beifa.group/help/position-3/',
  67 +// 'https://www.beifa.group/help/position-2/',
  68 +// 'https://www.beifa.group/help/position-1/',
  69 +// 'https://www.beifa.group/help/social-media/',
  70 +// 'https://www.beifa.group/help/globle-exibition-2/',
  71 +// 'https://www.beifa.group/help/job/',
  72 +// 'https://www.beifa.group/help/vr/',
  73 +// 'https://www.beifa.group/help/on-live-video/',
  74 +// 'https://www.beifa.group/help/honor/',
  75 +// 'https://www.beifa.group/help/certification/',
  76 +// 'https://www.beifa.group/help/quanity-control/',
  77 +// 'https://www.beifa.group/help/testing-center/',
  78 +// 'https://www.beifa.group/help/rd/',
  79 +// 'https://www.beifa.group/help/design-trend/',
  80 +// 'https://www.beifa.group/help/partner/',
  81 +// 'https://www.beifa.group/help/social-responsibility/',
  82 +// 'https://www.beifa.group/help/contact/',
  83 +// ];
  84 +
  85 + $project_id = 546;
  86 + $project_site = 'v6-kx260.globalso.site';
46 $pages = [ 87 $pages = [
47 - 'https://www.beifa.group/help/send-results/',  
48 - 'https://www.beifa.group/help/terms-of-use/',  
49 - 'https://www.beifa.group/help/position-3/',  
50 - 'https://www.beifa.group/help/position-2/',  
51 - 'https://www.beifa.group/help/position-1/',  
52 - 'https://www.beifa.group/help/social-media/',  
53 - 'https://www.beifa.group/help/globle-exibition-2/',  
54 - 'https://www.beifa.group/help/job/',  
55 - 'https://www.beifa.group/help/vr/',  
56 - 'https://www.beifa.group/help/on-live-video/',  
57 - 'https://www.beifa.group/help/honor/',  
58 - 'https://www.beifa.group/help/certification/',  
59 - 'https://www.beifa.group/help/quanity-control/',  
60 - 'https://www.beifa.group/help/testing-center/',  
61 - 'https://www.beifa.group/help/rd/',  
62 - 'https://www.beifa.group/help/design-trend/',  
63 - 'https://www.beifa.group/help/partner/',  
64 - 'https://www.beifa.group/help/social-responsibility/',  
65 - 'https://www.beifa.group/help/contact/', 88 + 'https://www.grechofiberglass.com/success_stories/',
  89 + 'https://www.grechofiberglass.com/success_stories/achieving-transformative-improvements-for-polyurethane-exterior-insulation-panels-in-france/',
  90 + 'https://www.grechofiberglass.com/success_stories/grechos-fiberglass-rebar-revolutionizing-canadian-construction-projects-with-unparalleled-quality/',
  91 + 'https://www.grechofiberglass.com/success_stories/customer-from-the-uk-purchases-fiberglass-coated-mats-for-plasterboards-from-grecho/',
  92 + 'https://www.grechofiberglass.com/success_stories/supplying-carbon-fiber-to-australian-surfboard-manufacturer/',
  93 + 'https://www.grechofiberglass.com/success_stories/300g-chopped-strand-mat-for-composite-slates-shipped-to-malaysia/',
  94 + 'https://www.grechofiberglass.com/success_stories/fiberglass-roving-for-pipewater-tank-shipped-to-russia/',
  95 + 'https://www.grechofiberglass.com/success_stories/fiberglass-fleece-for-acoustic-ceiling-shipped-to-russia/',
  96 + 'https://www.grechofiberglass.com/success_stories/600g-fiberglass-aluminum-foil-cloth-shipped-to-australia-for-pipe-heat-shielding/',
  97 + 'https://www.grechofiberglass.com/success_stories/shipping-our-first-truck-of-fiberglass-tissue-in-2022/',
66 ]; 98 ];
67 99
68 // $project_id = 586; 100 // $project_id = 586;
@@ -78,6 +110,36 @@ class HtmlCustomCollect extends Command @@ -78,6 +110,36 @@ class HtmlCustomCollect extends Command
78 // 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/', 110 // 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/',
79 // ]; 111 // ];
80 112
  113 +// $project_id = 626;
  114 +// $project_site = 'v6-m342g.globalso.site';
  115 +// $pages = [
  116 +// 'https://www.lecusostreetlight.com/project_catalog/project/',
  117 +// 'https://www.lecusostreetlight.com/project_catalog/project/page/2/',
  118 +// 'https://www.lecusostreetlight.com/project/560pcs-250w-smart-led-street-light-in-manila-city-philippines/',
  119 +// 'https://www.lecusostreetlight.com/project/3200pcs-8m-150w-solar-street-light-in-cebu-philippines/',
  120 +// 'https://lecusostreetlight.com/project/170pcs-100w-split-lithium-battery-solar-street-light-in-tanzania/',
  121 +// 'https://www.lecusostreetlight.com/project/250pcs-40w-sl-series-solar-street-light-in-kuwait/',
  122 +// 'https://www.lecusostreetlight.com/project/272pcs-8m-80w-solar-street-light-in-tanzania/',
  123 +// 'https://www.lecusostreetlight.com/project/185pcs-10m-120w-highway-solar-street-light-in-jordan/',
  124 +// 'https://www.lecusostreetlight.com/project/270pcs-9m-patterned-decorative-light-pole-with-150w-led-cobra-light-in-cambodia/',
  125 +// 'https://www.lecusostreetlight.com/project/48pcs-5m-24w-decorative-aluminium-pole-in-dubai-uae/',
  126 +// 'https://www.lecusostreetlight.com/project/105pcs-9m-100w-led-street-light-in-sri-lanka/',
  127 +// 'https://www.lecusostreetlight.com/project/45pcs-6m-hot-dip-galvanized-double-arm-street-light-pole-in-dubai-uae/',
  128 +// 'https://www.lecusostreetlight.com/project/356pcs-8m-100w-solar-street-light-in-ethiopia/',
  129 +// 'https://www.lecusostreetlight.com/project/52pcs-6m-30w-solar-led-street-light-with-gel-battery-in-poland/',
  130 +// 'https://www.lecusostreetlight.com/project/225pcs-6m-80w-solar-street-light-in-vietnam/',
  131 +// 'https://www.lecusostreetlight.com/project/450pcs-7m-60w-double-arm-solar-light-in-nigeria/',
  132 +// 'https://www.lecusostreetlight.com/project/100pcs-6m-50w-led-street-light-in-maldives/',
  133 +// 'https://www.lecusostreetlight.com/project/202pcs-6m-40w-3000k-solar-street-light-in-manila-philippines/',
  134 +// 'https://www.lecusostreetlight.com/project/245pcs-120w-smart-led-street-light-in-bangkok-thailand/',
  135 +// 'https://www.lecusostreetlight.com/project/170pcs-7m-50w-all-in-one-solar-light-in-davao-philippines/',
  136 +// 'https://www.lecusostreetlight.com/project/80pcs-9m-150w-led-street-light-in-iraq/',
  137 +// 'https://www.lecusostreetlight.com/project/252pcs-6m-40w-separate-solar-street-light-with-lithium-battery-in-thailand/',
  138 +// 'https://www.lecusostreetlight.com/project/198pcs-8m-80w-zc-series-all-in-two-solar-light-in-philippines/',
  139 +// 'https://www.lecusostreetlight.com/project/5m-30w-morden-led-garden-light-in-russian/',
  140 +// 'https://www.lecusostreetlight.com/project/135pcs-all-in-one-solar-street-light-in-uae-dubai-park/'
  141 +// ];
  142 +
81 // $project_id = 633; 143 // $project_id = 633;
82 // $project_site = 'v6-ke5nz.globalso.site'; 144 // $project_site = 'v6-ke5nz.globalso.site';
83 // $pages = [ 145 // $pages = [
@@ -117,53 +179,6 @@ class HtmlCustomCollect extends Command @@ -117,53 +179,6 @@ class HtmlCustomCollect extends Command
117 // 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/' 179 // 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/'
118 // ]; 180 // ];
119 181
120 -// $project_id = 437;  
121 -// $project_site = 'v6-1500k.globalso.site';  
122 -// $pages = [  
123 -// 'https://www.tourletent.com/project/b300-glamping-tent-in-china/',  
124 -// 'https://www.tourletent.com/project/lotus-bell-tent-in-australia/',  
125 -// 'https://www.tourletent.com/project/luxury-resort-in-china/',  
126 -// 'https://www.tourletent.com/project/canvas-safari-tent-inthailand/',  
127 -// 'https://www.tourletent.com/project/safari-tent-for-m8-in-mexcio/',  
128 -// 'https://www.tourletent.com/project/9m-pvc-dome-tent-in-canada/',  
129 -// 'https://www.tourletent.com/project/c900-hotel-tent-in-korea/',  
130 -// 'https://www.tourletent.com/project/safari-tent-in-guizhou/',  
131 -// 'https://www.tourletent.com/project/dome-tent-in-austin/',  
132 -// 'https://www.tourletent.com/project/safari-tent-in-italy/',  
133 -// 'https://www.tourletent.com/project/glass-igloo-in-china/',  
134 -// 'https://www.tourletent.com/project/tree-house-in-sichuan/'  
135 -// ];  
136 -  
137 -// $project_id = 626;  
138 -// $project_site = 'v6-m342g.globalso.site';  
139 -// $pages = [  
140 -// 'https://www.lecusostreetlight.com/project_catalog/project/',  
141 -// 'https://www.lecusostreetlight.com/project_catalog/project/page/2/',  
142 -// 'https://www.lecusostreetlight.com/project/560pcs-250w-smart-led-street-light-in-manila-city-philippines/',  
143 -// 'https://www.lecusostreetlight.com/project/3200pcs-8m-150w-solar-street-light-in-cebu-philippines/',  
144 -// 'https://lecusostreetlight.com/project/170pcs-100w-split-lithium-battery-solar-street-light-in-tanzania/',  
145 -// 'https://www.lecusostreetlight.com/project/250pcs-40w-sl-series-solar-street-light-in-kuwait/',  
146 -// 'https://www.lecusostreetlight.com/project/272pcs-8m-80w-solar-street-light-in-tanzania/',  
147 -// 'https://www.lecusostreetlight.com/project/185pcs-10m-120w-highway-solar-street-light-in-jordan/',  
148 -// 'https://www.lecusostreetlight.com/project/270pcs-9m-patterned-decorative-light-pole-with-150w-led-cobra-light-in-cambodia/',  
149 -// 'https://www.lecusostreetlight.com/project/48pcs-5m-24w-decorative-aluminium-pole-in-dubai-uae/',  
150 -// 'https://www.lecusostreetlight.com/project/105pcs-9m-100w-led-street-light-in-sri-lanka/',  
151 -// 'https://www.lecusostreetlight.com/project/45pcs-6m-hot-dip-galvanized-double-arm-street-light-pole-in-dubai-uae/',  
152 -// 'https://www.lecusostreetlight.com/project/356pcs-8m-100w-solar-street-light-in-ethiopia/',  
153 -// 'https://www.lecusostreetlight.com/project/52pcs-6m-30w-solar-led-street-light-with-gel-battery-in-poland/',  
154 -// 'https://www.lecusostreetlight.com/project/225pcs-6m-80w-solar-street-light-in-vietnam/',  
155 -// 'https://www.lecusostreetlight.com/project/450pcs-7m-60w-double-arm-solar-light-in-nigeria/',  
156 -// 'https://www.lecusostreetlight.com/project/100pcs-6m-50w-led-street-light-in-maldives/',  
157 -// 'https://www.lecusostreetlight.com/project/202pcs-6m-40w-3000k-solar-street-light-in-manila-philippines/',  
158 -// 'https://www.lecusostreetlight.com/project/245pcs-120w-smart-led-street-light-in-bangkok-thailand/',  
159 -// 'https://www.lecusostreetlight.com/project/170pcs-7m-50w-all-in-one-solar-light-in-davao-philippines/',  
160 -// 'https://www.lecusostreetlight.com/project/80pcs-9m-150w-led-street-light-in-iraq/',  
161 -// 'https://www.lecusostreetlight.com/project/252pcs-6m-40w-separate-solar-street-light-with-lithium-battery-in-thailand/',  
162 -// 'https://www.lecusostreetlight.com/project/198pcs-8m-80w-zc-series-all-in-two-solar-light-in-philippines/',  
163 -// 'https://www.lecusostreetlight.com/project/5m-30w-morden-led-garden-light-in-russian/',  
164 -// 'https://www.lecusostreetlight.com/project/135pcs-all-in-one-solar-street-light-in-uae-dubai-park/'  
165 -// ];  
166 -  
167 foreach ($pages as $page) { 182 foreach ($pages as $page) {
168 $this->start_collect(urldecode($page), $project_id, $project_site); 183 $this->start_collect(urldecode($page), $project_id, $project_site);
169 } 184 }
@@ -213,8 +228,19 @@ class HtmlCustomCollect extends Command @@ -213,8 +228,19 @@ class HtmlCustomCollect extends Command
213 $html = str_replace($old_info['home_url'], $project_site, $html); 228 $html = str_replace($old_info['home_url'], $project_site, $html);
214 229
215 //暂时隐藏小语种 230 //暂时隐藏小语种
216 - $html = str_replace('<div class="change-language ensemble">', '<div class="change-language ensemble" style="display: none">', $html);  
217 - $html = str_replace('<div class="language_more">', '<div class="language_more" style="display: none">', $html); 231 +// $html = str_replace('<div class="change-language ensemble">', '<div class="change-language ensemble" style="display: none">', $html);
  232 +// $html = str_replace('<div class="language_more">', '<div class="language_more" style="display: none">', $html);
  233 +
  234 + //处理搜索
  235 + preg_match_all('/<form\s+[^>]*?action\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_search);
  236 + $search = $result_search[2] ?? [];
  237 + foreach ($search as $vc) {
  238 + if((strpos($vc,'search.php') !== false) || (strpos($vc,'index.php') !== false)){
  239 + $html = str_replace($vc,'/search/',$html);
  240 + }
  241 + }
  242 +
  243 + //增加统计代码
218 $html = str_replace('</body>', '<script src="https://ecdn6.globalso.com/public/customerVisit.min.js\"></script></body>', $html); 244 $html = str_replace('</body>', '<script src="https://ecdn6.globalso.com/public/customerVisit.min.js\"></script></body>', $html);
219 245
220 //html写入文件 246 //html写入文件
@@ -138,7 +138,7 @@ class HtmlLanguageCollect extends Command @@ -138,7 +138,7 @@ class HtmlLanguageCollect extends Command
138 } 138 }
139 139
140 140
141 - $update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', '>', UpdateLog::COLLECT_STATUS_COM)->orderBy('collect_status', 'desc')->orderBy('project_id', 'asc')->first(); 141 + $update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', '>', UpdateLog::COLLECT_STATUS_MAIN)->orderBy('collect_status', 'asc')->orderBy('project_id', 'asc')->first();
142 if (!$update_log) { 142 if (!$update_log) {
143 return false; 143 return false;
144 } 144 }
@@ -66,7 +66,7 @@ class HtmlLanguageSpecialCollect extends Command @@ -66,7 +66,7 @@ class HtmlLanguageSpecialCollect extends Command
66 //设置数据库 66 //设置数据库
67 $project = ProjectServer::useProject($project_id); 67 $project = ProjectServer::useProject($project_id);
68 if ($project) { 68 if ($project) {
69 - $collect_info = CollectTask::select(['id', 'domain', 'route', 'language'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->where('language', '!=', '')->first(); 69 + $collect_info = CollectTask::select(['id', 'domain', 'route', 'language'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->where('language', '=', '')->first();
70 70
71 if (!$collect_info) { 71 if (!$collect_info) {
72 sleep(2); 72 sleep(2);
@@ -138,7 +138,7 @@ class HtmlLanguageSpecialCollect extends Command @@ -138,7 +138,7 @@ class HtmlLanguageSpecialCollect extends Command
138 } 138 }
139 139
140 140
141 - $update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', '>', UpdateLog::COLLECT_STATUS_MAIN)->orderBy('collect_status', 'asc')->first(); 141 + $update_log = UpdateLog::whereIn('project_id', [555, 626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->first();
142 if (!$update_log) { 142 if (!$update_log) {
143 return false; 143 return false;
144 } 144 }
@@ -162,7 +162,7 @@ class HtmlLanguageSpecialCollect extends Command @@ -162,7 +162,7 @@ class HtmlLanguageSpecialCollect extends Command
162 //设置数据库 162 //设置数据库
163 $project = ProjectServer::useProject($update_log->project_id); 163 $project = ProjectServer::useProject($update_log->project_id);
164 if ($project) { 164 if ($project) {
165 - $collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '!=', '')->where('status', CollectTask::STATUS_UN)->orderBy('id', 'asc')->limit(50)->get(); 165 + $collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '=', '')->where('status', CollectTask::STATUS_UN)->orderBy('id', 'asc')->limit(50)->get();
166 166
167 if ($collect_list->count() == 0) { 167 if ($collect_list->count() == 0) {
168 $complete = true; 168 $complete = true;
@@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo; @@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo;
13 use App\Models\News\News; 13 use App\Models\News\News;
14 use App\Models\News\NewsCategory; 14 use App\Models\News\NewsCategory;
15 use App\Models\Product\Category; 15 use App\Models\Product\Category;
  16 +use App\Models\Product\Extend;
  17 +use App\Models\Product\ExtendInfo;
16 use App\Models\Product\Keyword; 18 use App\Models\Product\Keyword;
17 use App\Models\Product\Product; 19 use App\Models\Product\Product;
18 use App\Models\RouteMap\RouteMap; 20 use App\Models\RouteMap\RouteMap;
@@ -241,6 +243,8 @@ class ProjectUpdate extends Command @@ -241,6 +243,8 @@ class ProjectUpdate extends Command
241 243
242 $model = new Product(); 244 $model = new Product();
243 $category_model = new Category(); 245 $category_model = new Category();
  246 + $extend_model = new Extend();
  247 + $extend_info_model = new ExtendInfo();
244 $logic = new CategoryLogic(); 248 $logic = new CategoryLogic();
245 249
246 foreach ($items as $item) { 250 foreach ($items as $item) {
@@ -286,12 +290,71 @@ class ProjectUpdate extends Command @@ -286,12 +290,71 @@ class ProjectUpdate extends Command
286 ]); 290 ]);
287 $this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id); 291 $this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id);
288 292
  293 + //扩展字段
  294 + if ($item['extend'] ?? []) {
  295 + foreach (array_reverse($item['extend']) as $ke => $ve) {
  296 + $extend = $extend_model->read(['title' => $ke]);
  297 + if (!$extend) {
  298 + $extend_key = $this->get_extend_key($extend_model);
  299 + $extend_model->add([
  300 + 'project_id' => $project_id,
  301 + 'title' => $ke,
  302 + 'type' => 1,
  303 + 'key' => $extend_key
  304 + ]);
  305 + } else {
  306 + $extend_key = $extend['key'];
  307 + }
  308 +
  309 + $extend_info = $extend_info_model->read(['key' => $extend_key, 'product_id' => $id]);
  310 + if (!$extend_info) {
  311 + $extend_info_model->add([
  312 + 'key' => $extend_key,
  313 + 'project_id' => $project_id,
  314 + 'product_id' => $id,
  315 + 'values' => $ve,
  316 + 'type' => 1
  317 + ]);
  318 + }
  319 + }
  320 + }
  321 +
289 CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $link_type, $language_list, $page_list); 322 CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $link_type, $language_list, $page_list);
290 $is_flush = 1; 323 $is_flush = 1;
291 } catch (\Exception $e) { 324 } catch (\Exception $e) {
292 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; 325 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
293 continue; 326 continue;
294 } 327 }
  328 + }else{
  329 + $id = $product['id'];
  330 + //扩展字段
  331 + if ($item['extend'] ?? []) {
  332 + foreach (array_reverse($item['extend']) as $ke => $ve) {
  333 + $extend = $extend_model->read(['title' => $ke]);
  334 + if (!$extend) {
  335 + $extend_key = $this->get_extend_key($extend_model);
  336 + $extend_model->add([
  337 + 'project_id' => $project_id,
  338 + 'title' => $ke,
  339 + 'type' => 1,
  340 + 'key' => $extend_key
  341 + ]);
  342 + } else {
  343 + $extend_key = $extend['key'];
  344 + }
  345 +
  346 + $extend_info = $extend_info_model->read(['key' => $extend_key, 'product_id' => $id]);
  347 + if (!$extend_info) {
  348 + $extend_info_model->add([
  349 + 'key' => $extend_key,
  350 + 'project_id' => $project_id,
  351 + 'product_id' => $id,
  352 + 'values' => $ve,
  353 + 'type' => 1
  354 + ]);
  355 + }
  356 + }
  357 + }
295 } 358 }
296 } 359 }
297 } 360 }
@@ -646,4 +709,16 @@ class ProjectUpdate extends Command @@ -646,4 +709,16 @@ class ProjectUpdate extends Command
646 return $url_complete; 709 return $url_complete;
647 } 710 }
648 } 711 }
  712 +
  713 + //获取自定义字段key
  714 + protected function get_extend_key($model, $i = 1)
  715 + {
  716 + $key = 'pd_extended_field_';
  717 + $info = $model->read(['key' => $key . $i]);
  718 + if ($info !== false) {
  719 + return $this->get_extend_key($model, $i + 1);
  720 + } else {
  721 + return $key . $i;
  722 + }
  723 + }
649 } 724 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :UpdateRoute.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/20 15:07
  8 + */
  9 +
  10 +namespace App\Console\Commands;
  11 +
  12 +use App\Models\Blog\Blog;
  13 +use App\Models\Blog\BlogCategory;
  14 +use App\Models\News\News;
  15 +use App\Models\News\NewsCategory;
  16 +use App\Models\Product\Category;
  17 +use App\Models\Product\Keyword;
  18 +use App\Models\Product\Product;
  19 +use App\Models\Project\Project;
  20 +use App\Models\RouteMap\RouteMap;
  21 +use App\Models\Template\BTemplate;
  22 +use App\Models\Template\BTemplateMain;
  23 +use App\Services\ProjectServer;
  24 +use Illuminate\Console\Command;
  25 +use Illuminate\Support\Facades\DB;
  26 +
  27 +/**
  28 + * @remark :更新所有项目的路由
  29 + * @name :UpdateRoute
  30 + * @author :lyh
  31 + * @method :post
  32 + * @time :2023/11/20 15:08
  33 + */
  34 +class UpdateMainHtml extends Command
  35 +{
  36 + /**
  37 + * The name and signature of the console command.
  38 + *
  39 + * @var string
  40 + */
  41 + protected $signature = 'update_main';
  42 +
  43 + /**
  44 + * The console command description.
  45 + *
  46 + * @var string
  47 + */
  48 + protected $description = '洗数据';
  49 +
  50 + /**
  51 + * @remark :统一更新路由
  52 + * @name :handle
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2023/11/20 15:13
  56 + */
  57 + public function handle(){
  58 + $projectModel = new Project();
  59 + $list = $projectModel->list(['type'=>['!=',0]]);
  60 + foreach ($list as $v){
  61 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  62 + ProjectServer::useProject($v['id']);
  63 + $this->editMainHtml($v['id']);
  64 + DB::disconnect('custom_mysql');
  65 + }
  66 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  67 + }
  68 +
  69 + /**
  70 + * @remark :洗数据
  71 + * @name :getMainHtml
  72 + * @author :lyh
  73 + * @method :post
  74 + * @time :2023/12/27 18:03
  75 + */
  76 + public function editMainHtml($project_id){
  77 + $templateModel = new BTemplate();
  78 + $info = $templateModel->read(['source'=>4,'source_id'=>0]);
  79 + if($info !== false){
  80 + $mainModel = new BTemplateMain();
  81 + $mainInfo = $mainModel->read(['type'=>4,'is_list'=>1]);
  82 + if($mainInfo === false){
  83 + $data = [
  84 + 'type'=>4,
  85 + 'is_list'=>1,
  86 + 'main_html'=>$info['main_html'],
  87 + 'main_css'=>$info['main_css'],
  88 + 'section_list_id'=>$info['section_list_id'],
  89 + 'project_id'=>$project_id
  90 + ];
  91 + $mainModel->add($data);
  92 + }else{
  93 + $data = [
  94 + 'main_html'=>$info['main_html'],
  95 + 'main_css'=>$info['main_css'],
  96 + 'section_list_id'=>$info['section_list_id'],
  97 + 'project_id'=>$project_id,
  98 + ];
  99 + $mainModel->edit($data,['id'=>$mainInfo['id']]);
  100 + }
  101 + }
  102 + return true;
  103 + }
  104 +}
@@ -29,9 +29,11 @@ class ComController extends BaseController @@ -29,9 +29,11 @@ class ComController extends BaseController
29 public function get_menu(){ 29 public function get_menu(){
30 //根据当前登录用户角色返回用户菜单列表 30 //根据当前登录用户角色返回用户菜单列表
31 $projectMenuModel = new ProjectMenuModel(); 31 $projectMenuModel = new ProjectMenuModel();
  32 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(11111, true) . PHP_EOL, FILE_APPEND);
32 if($this->user['role_id'] != 0){ 33 if($this->user['role_id'] != 0){
33 $this->map = $this->getNoAdminMenuCondition(); 34 $this->map = $this->getNoAdminMenuCondition();
34 }else{ 35 }else{
  36 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($this->map, true) . PHP_EOL, FILE_APPEND);
35 $this->map = $this->getAdminMenuCondition(); 37 $this->map = $this->getAdminMenuCondition();
36 } 38 }
37 $lists = $projectMenuModel->list($this->map,'sort'); 39 $lists = $projectMenuModel->list($this->map,'sort');
@@ -10,6 +10,8 @@ use App\Models\Blog\Blog as BlogModel; @@ -10,6 +10,8 @@ use App\Models\Blog\Blog as BlogModel;
10 use App\Models\Blog\BlogCategory; 10 use App\Models\Blog\BlogCategory;
11 use App\Models\Blog\BlogCategory as BlogCategoryModel; 11 use App\Models\Blog\BlogCategory as BlogCategoryModel;
12 use App\Models\RouteMap\RouteMap; 12 use App\Models\RouteMap\RouteMap;
  13 +use App\Models\Template\BTemplate;
  14 +use App\Models\Template\Setting;
13 use App\Models\User\User; 15 use App\Models\User\User;
14 16
15 class BlogController extends BaseController 17 class BlogController extends BaseController
@@ -32,12 +34,16 @@ class BlogController extends BaseController @@ -32,12 +34,16 @@ class BlogController extends BaseController
32 $lists = $lists->toArray(); 34 $lists = $lists->toArray();
33 // //获取当前项目的所有分类 35 // //获取当前项目的所有分类
34 $data = $this->getCategoryList(); 36 $data = $this->getCategoryList();
  37 + //获取当前用户选择的模版
  38 + $templateSettingModel = new Setting();
  39 + $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
35 $user = new User(); 40 $user = new User();
36 foreach ($lists['list'] as $k => $v){ 41 foreach ($lists['list'] as $k => $v){
37 $v['category_name'] = $this->categoryName($v['category_id'],$data); 42 $v['category_name'] = $this->categoryName($v['category_id'],$data);
38 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']); 43 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']);
39 $v['image_link'] = getImageUrl($v['image']); 44 $v['image_link'] = getImageUrl($v['image']);
40 $v['operator_name'] = $user->getName($v['operator_id']); 45 $v['operator_name'] = $user->getName($v['operator_id']);
  46 + $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
41 $lists['list'][$k] = $v; 47 $lists['list'][$k] = $v;
42 } 48 }
43 } 49 }
@@ -45,6 +51,31 @@ class BlogController extends BaseController @@ -45,6 +51,31 @@ class BlogController extends BaseController
45 } 51 }
46 52
47 /** 53 /**
  54 + * @remark :查看产品是否已装修
  55 + * @name :getProductIsRenovation
  56 + * @author :lyh
  57 + * @method :post
  58 + * @time :2023/9/13 14:02
  59 + */
  60 + public function getProductIsRenovation($info,$id){
  61 + if($info !== false){
  62 + $webTemplateModel = new BTemplate();
  63 + $param = [
  64 + 'source'=>BTemplate::SOURCE_BLOG,
  65 + 'project_id'=>$this->user['project_id'],
  66 + 'source_id'=>$id,
  67 + 'template_id'=>$info['template_id'],
  68 + 'is_list'=>0
  69 + ];
  70 + $templateInfo = $webTemplateModel->read($param);
  71 + if($templateInfo !== false){
  72 + return 1;
  73 + }
  74 + }
  75 + return 0;
  76 + }
  77 +
  78 + /**
48 * @remark :处理列表返回参数 79 * @remark :处理列表返回参数
49 * @name :handleReturnParam 80 * @name :handleReturnParam
50 * @author :lyh 81 * @author :lyh
@@ -24,21 +24,55 @@ class FileManageController extends BaseController @@ -24,21 +24,55 @@ class FileManageController extends BaseController
24 public function __construct(Request $request) 24 public function __construct(Request $request)
25 { 25 {
26 parent::__construct($request); 26 parent::__construct($request);
27 - //判断是否开启  
28 - $project = Project::find($this->user['project_id']);  
29 - if(empty($project['is_upload_manage'])){  
30 - $this->fail('文件上传管理功能未开启'); 27 + if(!empty($this->user)){
  28 + $project = Project::find($this->user['project_id']);
  29 + if(empty($project['is_upload_manage'])){
  30 + $this->fail('文件上传管理功能未开启');
  31 + }
  32 + //判断是否开启
  33 + $this->upload_config = $project['upload_config'];
31 } 34 }
32 - $this->upload_config = $project['upload_config'];  
33 } 35 }
34 36
  37 + /**
  38 + * @remark :列表
  39 + * @name :index
  40 + * @author :lyh
  41 + * @method :post
  42 + * @time :2023/12/28 17:03
  43 + */
35 public function index(FileManage $fileManage){ 44 public function index(FileManage $fileManage){
36 $this->map['project_id'] = $this->user['project_id']; 45 $this->map['project_id'] = $this->user['project_id'];
37 $this->request['name'] && $this->map['name'] = ['like','%'.$this->request['name'].'%']; 46 $this->request['name'] && $this->map['name'] = ['like','%'.$this->request['name'].'%'];
38 $lists = $fileManage->lists($this->map, $this->page, $this->row); 47 $lists = $fileManage->lists($this->map, $this->page, $this->row);
  48 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($lists, true) . PHP_EOL, FILE_APPEND);
  49 + if(!empty($lists) && !empty($lists['list'])){
  50 + foreach ($lists['list'] as $k => $v){
  51 + $v['download_url'] = url('b/file_manager_downLoad?path='.$v['path']);
  52 + $lists['list'][$k] = $v;
  53 + }
  54 + }
39 $this->response('success',Code::SUCCESS,$lists); 55 $this->response('success',Code::SUCCESS,$lists);
40 } 56 }
41 57
  58 + /**
  59 + * @remark :下载方法
  60 + * @name :downLoad
  61 + * @author :lyh
  62 + * @method :post
  63 + * @time :2023/12/28 17:18
  64 + */
  65 + public function downLoad(){
  66 + $username = basename($this->param['path']);
  67 + $fileUrl = 'https://file.globalso.com'.$this->param['path'];
  68 + // 设置响应头
  69 + header('Content-Description: File Transfer');
  70 + header('Content-Type: application/octet-stream');
  71 + header('Content-Disposition: attachment; filename="' . $username . '"');
  72 + // 下载文件
  73 + readfile($fileUrl);
  74 + }
  75 +
42 public function upload(Request $request, FileManage $fileManage){ 76 public function upload(Request $request, FileManage $fileManage){
43 $request->validate([ 77 $request->validate([
44 'file'=>['required'], 78 'file'=>['required'],
@@ -65,7 +65,8 @@ class NewsController extends BaseController @@ -65,7 +65,8 @@ class NewsController extends BaseController
65 'source'=>4, 65 'source'=>4,
66 'project_id'=>$this->user['project_id'], 66 'project_id'=>$this->user['project_id'],
67 'source_id'=>$id, 67 'source_id'=>$id,
68 - 'template_id'=>$info['template_id'] 68 + 'template_id'=>$info['template_id'],
  69 + 'is_list'=>0
69 ]; 70 ];
70 $templateInfo = $webTemplateModel->read($param); 71 $templateInfo = $webTemplateModel->read($param);
71 if($templateInfo !== false){ 72 if($templateInfo !== false){
@@ -132,7 +132,8 @@ class ProductController extends BaseController @@ -132,7 +132,8 @@ class ProductController extends BaseController
132 'source'=>2, 132 'source'=>2,
133 'project_id'=>$this->user['project_id'], 133 'project_id'=>$this->user['project_id'],
134 'source_id'=>$id, 134 'source_id'=>$id,
135 - 'template_id'=>$info['template_id'] 135 + 'template_id'=>$info['template_id'],
  136 + 'is_list'=>0
136 ]; 137 ];
137 $templateInfo = $webTemplateModel->read($param); 138 $templateInfo = $webTemplateModel->read($param);
138 if($templateInfo !== false){ 139 if($templateInfo !== false){
@@ -6,7 +6,9 @@ use App\Enums\Common\Code; @@ -6,7 +6,9 @@ use App\Enums\Common\Code;
6 use App\Exceptions\BsideGlobalException; 6 use App\Exceptions\BsideGlobalException;
7 use App\Http\Controllers\Bside\BaseController; 7 use App\Http\Controllers\Bside\BaseController;
8 use App\Http\Logic\Aside\ProjectAssociation\ProjectAssociationLogic; 8 use App\Http\Logic\Aside\ProjectAssociation\ProjectAssociationLogic;
  9 +use App\Models\ProjectAssociation\ProjectAssociation;
9 use Illuminate\Http\Request; 10 use Illuminate\Http\Request;
  11 +use Illuminate\Support\Facades\DB;
10 use Psr\Container\ContainerExceptionInterface; 12 use Psr\Container\ContainerExceptionInterface;
11 use Psr\Container\NotFoundExceptionInterface; 13 use Psr\Container\NotFoundExceptionInterface;
12 14
@@ -31,9 +33,9 @@ class ProjectAssociationController extends BaseController @@ -31,9 +33,9 @@ class ProjectAssociationController extends BaseController
31 if (empty($project_id)) { 33 if (empty($project_id)) {
32 $this->fail('请选择项目!', Code::USER_PARAMS_ERROE); 34 $this->fail('请选择项目!', Code::USER_PARAMS_ERROE);
33 } 35 }
34 - $status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用 36 + $status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用
35 37
36 - $user_id = (int)request()->post('user_id', 0); 38 + $user_id = (int)env('AICC_WECHAT_USER_ID') ?? 0;
37 if (empty($user_id) && $status) { 39 if (empty($user_id) && $status) {
38 $this->fail('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE); 40 $this->fail('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE);
39 } 41 }
@@ -44,8 +46,58 @@ class ProjectAssociationController extends BaseController @@ -44,8 +46,58 @@ class ProjectAssociationController extends BaseController
44 $nickname = request()->post('nickname', ''); 46 $nickname = request()->post('nickname', '');
45 $user_name = request()->post('user_name', ''); 47 $user_name = request()->post('user_name', '');
46 $image = request()->post('image', ''); 48 $image = request()->post('image', '');
47 - $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image'); 49 + $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image');
48 $this->ProjectAssociationLogic->saveWeChatData($data); 50 $this->ProjectAssociationLogic->saveWeChatData($data);
49 $this->response('success'); 51 $this->response('success');
50 } 52 }
  53 +
  54 + public function check()
  55 + {
  56 + $project_id = (int)request()->input('project_id', 0);
  57 + $status = request()->input('status');
  58 + if (isset($status)) {
  59 + $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED;
  60 + }
  61 + $isRes = $this->ProjectAssociationLogic->normal($project_id);
  62 + DB::beginTransaction();
  63 + try {
  64 + // 当数据不存在时并开启状态,自动添加一条数据
  65 + if (is_null($isRes) && (!is_null($status) && $status)) {
  66 + $isRes = $this->ProjectAssociationLogic->disabled($project_id);
  67 + if (is_null($isRes)) {
  68 + $isRes = new ProjectAssociation();
  69 + }
  70 + $isRes->project_id = $project_id;
  71 + $isRes->user_id = (int)env('AICC_WECHAT_USER_ID');
  72 + $isRes->status = $status;
  73 + $isRes->save();
  74 + DB::commit();
  75 + } // 关闭状态
  76 + elseif (!is_null($isRes) && (!is_null($status) && empty($status))) {
  77 + $isRes->status = $status;
  78 + $isRes->save();
  79 + DB::commit();
  80 + return [
  81 + 'code' => Code::SUCCESS,
  82 + 'data' => [],
  83 + 'message' => '关闭AICC绑定成功!',
  84 + ];
  85 + }
  86 + } catch (\Exception $exception) {
  87 + DB::rollBack();
  88 + $this->response('数据错误,请重试!', Code::SERVER_ERROR);
  89 + }
  90 + if (is_null($isRes)) {
  91 + $this->response('请开启AICC绑定!', Code::USER_ERROR, []);
  92 + }
  93 + $url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL');
  94 + $result = curlGet($url);
  95 + $result['info'] = [
  96 + 'friend_id' => $isRes->friend_id ?? 0,
  97 + 'nickname' => $isRes->nickname ?? '',
  98 + 'user_name' => $isRes->user_name ?? '',
  99 + 'image' => $isRes->image ?? '',
  100 + ];
  101 + $this->response('success', Code::SUCCESS, $result);
  102 + }
51 } 103 }
@@ -8,6 +8,7 @@ use App\Http\Logic\Bside\BTemplate\BTemplateLogic; @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
8 use App\Http\Requests\Bside\Template\TemplateRequest; 8 use App\Http\Requests\Bside\Template\TemplateRequest;
9 use App\Models\Template\BTemplate; 9 use App\Models\Template\BTemplate;
10 use App\Models\Template\BTemplateMain; 10 use App\Models\Template\BTemplateMain;
  11 +use App\Models\Template\Setting;
11 use App\Models\Template\Template; 12 use App\Models\Template\Template;
12 13
13 class BTemplateController extends BaseController 14 class BTemplateController extends BaseController
@@ -31,6 +32,27 @@ class BTemplateController extends BaseController @@ -31,6 +32,27 @@ class BTemplateController extends BaseController
31 } 32 }
32 33
33 /** 34 /**
  35 + * @remark :获取用户模版id
  36 + * @name :getUserTemplate
  37 + * @author :lyh
  38 + * @method :post
  39 + * @time :2023/12/28 15:34
  40 + */
  41 + public function getTemplate(){
  42 + $bSettingModel = new Setting();
  43 + $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  44 + if($info === false){
  45 + $this->fail('请先选择模版');
  46 + }
  47 + $templateModel = new BTemplate();
  48 + $templateInfo = $templateModel->read(['template_id'=>$info['template_id'], 'source'=>BTemplate::SOURCE_HOME, 'source_id'=>0],['updated_at']);
  49 + if($templateInfo !== false){
  50 + $info['updated_at'] = $templateInfo['updated_at'];
  51 + }
  52 + $this->response('success',Code::SUCCESS,$info);
  53 + }
  54 +
  55 + /**
34 * @remark :获取当前已选择的模板 56 * @remark :获取当前已选择的模板
35 * @name :getModuleTemplate 57 * @name :getModuleTemplate
36 * @author :lyh 58 * @author :lyh
@@ -45,7 +67,7 @@ class BTemplateController extends BaseController @@ -45,7 +67,7 @@ class BTemplateController extends BaseController
45 'source.required' => 'source不能为空', 67 'source.required' => 'source不能为空',
46 'source_id.required' => 'source_id不能为空', 68 'source_id.required' => 'source_id不能为空',
47 ]); 69 ]);
48 - $info = $BTemplateLogic->getTemplate(); 70 + $info = $BTemplateLogic->getTemplateHtml();
49 $this->response('success',Code::SUCCESS,$info); 71 $this->response('success',Code::SUCCESS,$info);
50 } 72 }
51 73
@@ -138,28 +160,4 @@ class BTemplateController extends BaseController @@ -138,28 +160,4 @@ class BTemplateController extends BaseController
138 $this->response('模板保存成功'); 160 $this->response('模板保存成功');
139 } 161 }
140 162
141 - /**  
142 - * @remark :获取可视化详情页模板数据  
143 - * @name :getDetailInfo  
144 - * @author :lyh  
145 - * @method :post  
146 - * @time :2023/10/24 11:27  
147 - */  
148 - public function getDetailInfo(BTemplateLogic $BTemplateLogic){  
149 - $html = $BTemplateLogic->getDetail();  
150 - $this->response('success',Code::SUCCESS,['html'=>$html]);  
151 - }  
152 -  
153 - /**  
154 - * @remark :保存详情页模板数据  
155 - * @name :saveDetail  
156 - * @author :lyh  
157 - * @method :post  
158 - * @time :2023/10/24 14:47  
159 - */  
160 - public function saveDetail(BTemplateLogic $BTemplateLogic){  
161 - $BTemplateLogic->saveDetail();  
162 - $this->response('success');  
163 - }  
164 -  
165 } 163 }
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :VisualizationController.php 4 + * @name :InitHtmlController.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 - * @time :2023/11/15 9:55 7 + * @time :2023/12/27 10:37
8 */ 8 */
9 9
10 namespace App\Http\Controllers\Bside\Template; 10 namespace App\Http\Controllers\Bside\Template;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
  15 +use App\Http\Logic\Bside\BTemplate\InitHtmlLogic;
14 use App\Http\Logic\Bside\BTemplate\VisualizationLogic; 16 use App\Http\Logic\Bside\BTemplate\VisualizationLogic;
15 17
16 /** 18 /**
17 - * @remark :定制项目处理  
18 - * @name :VisualizationController 19 + * @remark :初始复合页代码块上传
  20 + * @name :InitHtmlController
19 * @author :lyh 21 * @author :lyh
20 * @method :post 22 * @method :post
21 - * @time :2023/11/15 9:55 23 + * @time :2023/12/27 10:37
22 */ 24 */
23 -class VisualizationController extends BaseController 25 +class InitHtmlController extends BaseController
24 { 26 {
25 /** 27 /**
  28 + * @remark :获取可视化详情页模板数据
  29 + * @name :getDetailInfo
  30 + * @author :lyh
  31 + * @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
  32 + * @time :2023/10/24 11:27
  33 + */
  34 + public function getDetailHtml(InitHtmlLogic $logic){
  35 + $this->request->validate([
  36 + 'type'=>['required'],
  37 + ],[
  38 + 'type.required' => '类型不能为空',
  39 + ]);
  40 + $html = $logic->getDetailHtml();
  41 + $this->response('success',Code::SUCCESS,['html'=>$html]);
  42 + }
  43 +
  44 + /**
  45 + * @remark :保存详情页模板数据
  46 + * @name :saveDetail
  47 + * @author :lyh
  48 + * @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
  49 + * @time :2023/10/24 14:47
  50 + */
  51 + public function saveDetailHtml(InitHtmlLogic $logic){
  52 + $this->request->validate([
  53 + 'type'=>['required'],
  54 + ],[
  55 + 'type.required' => '类型不能为空',
  56 + ]);
  57 + $logic->saveDetailHtml();
  58 + $this->response('success');
  59 + }
  60 +
  61 + /**
26 * @remark :获取当前定制代码块详情 62 * @remark :获取当前定制代码块详情
27 * @name :info 63 * @name :info
28 * @author :lyh 64 * @author :lyh
29 * @method :post 65 * @method :post
30 * @time :2023/11/15 10:26 66 * @time :2023/11/15 10:26
31 */ 67 */
32 - public function info(VisualizationLogic $logic){  
33 - $info = $logic->getVisualizationInfo(); 68 + public function getCustomizedHtml(InitHtmlLogic $logic){
  69 + $this->request->validate([
  70 + 'type'=>['required'],
  71 + ],[
  72 + 'type.required' => '类型不能为空',
  73 + ]);
  74 + $info = $logic->getCustomizedHtml();
34 if($info === false){ 75 if($info === false){
35 $info = []; 76 $info = [];
36 } 77 }
@@ -44,8 +85,13 @@ class VisualizationController extends BaseController @@ -44,8 +85,13 @@ class VisualizationController extends BaseController
44 * @method :post 85 * @method :post
45 * @time :2023/11/15 10:08 86 * @time :2023/11/15 10:08
46 */ 87 */
47 - public function save(VisualizationLogic $logic){  
48 - $logic->saveVisualization(); 88 + public function saveCustomizedHtml(InitHtmlLogic $logic){
  89 + $this->request->validate([
  90 + 'type'=>['required'],
  91 + ],[
  92 + 'type.required' => '类型不能为空',
  93 + ]);
  94 + $logic->saveCustomizedHtml();
49 $this->response('success'); 95 $this->response('success');
50 } 96 }
51 } 97 }
@@ -5,6 +5,8 @@ namespace App\Http\Logic\Aside\ProjectAssociation; @@ -5,6 +5,8 @@ namespace App\Http\Logic\Aside\ProjectAssociation;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Logic\Logic; 6 use App\Http\Logic\Logic;
7 use App\Models\ProjectAssociation\ProjectAssociation; 7 use App\Models\ProjectAssociation\ProjectAssociation;
  8 +use Illuminate\Database\Eloquent\Builder;
  9 +use Illuminate\Database\Eloquent\Model;
8 use Illuminate\Support\Facades\DB; 10 use Illuminate\Support\Facades\DB;
9 11
10 class ProjectAssociationLogic extends Logic 12 class ProjectAssociationLogic extends Logic
@@ -24,4 +26,25 @@ class ProjectAssociationLogic extends Logic @@ -24,4 +26,25 @@ class ProjectAssociationLogic extends Logic
24 } 26 }
25 return $status; 27 return $status;
26 } 28 }
  29 +
  30 + /**
  31 + * status - 正常
  32 + * @param $project_id
  33 + * @return ProjectAssociation|Builder|Model|object|null
  34 + */
  35 + public function normal($project_id)
  36 + {
  37 + return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first();
  38 + }
  39 +
  40 +
  41 + /**
  42 + * status - 禁用
  43 + * @param $project_id
  44 + * @return ProjectAssociation|Builder|Model|object|null
  45 + */
  46 + public function disabled($project_id)
  47 + {
  48 + return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_DISABLED)->first();
  49 + }
27 } 50 }
@@ -57,48 +57,42 @@ class BTemplateLogic extends BaseLogic @@ -57,48 +57,42 @@ class BTemplateLogic extends BaseLogic
57 } 57 }
58 58
59 /** 59 /**
60 - * @remark :获取当前选择使用的模板  
61 - * @name :getModuleTemplate  
62 - * @author :lyh  
63 - * @method :post  
64 - * @time :2023/6/29 9:44  
65 - */  
66 - public function getTemplate(){  
67 - $template_id = $this->getSettingTemplate($this->param['source'],$this->param['source_id']);//设置的模版id  
68 - $data = $this->getHtml($template_id,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0);  
69 - return $this->success($data);  
70 - }  
71 -  
72 - /**  
73 - * @remark :获取可视化装修的html 60 + * @remark :获取可视化html
74 * @name :getTemplateHtml 61 * @name :getTemplateHtml
75 * @author :lyh 62 * @author :lyh
76 * @method :post 63 * @method :post
77 - * @time :2023/12/13 10:47 64 + * @time :2023/12/27 14:48
78 */ 65 */
79 - public function getHtml($template_id,$source,$source_id,$is_custom){  
80 - $templateInfo = $this->webTemplateInfo($template_id,$source,$source_id,$is_custom); 66 + public function getTemplateHtml(){
  67 + $is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块
  68 + $is_list = $this->param['is_list'] ?? 0;//是否为列表页
  69 + $template_id = $this->getSettingTemplate($this->param['source'],$is_list);//设置的模版id
  70 + $templateInfo = $this->model->read([
  71 + 'template_id'=>$template_id, 'source'=>$this->param['source'],
  72 + 'project_id'=>$this->user['project_id'], 'source_id'=>$this->param['source_id'],
  73 + 'is_custom'=>$is_custom, 'is_list'=>$is_list
  74 + ]);
81 if($templateInfo === false){ 75 if($templateInfo === false){
82 if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据 76 if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据
83 - $html = $this->isCustomizedPage($source,$source_id);//查看当前页面是否定制 77 + $html = $this->isCustomizedPage($this->param['source'],$is_list);//获取定制页面的html
84 return $this->success(['html'=>$html,'template_id'=>$template_id]); 78 return $this->success(['html'=>$html,'template_id'=>$template_id]);
85 } 79 }
86 - $mainInfo = $this->getCommonMain($source,$source_id,$is_custom);//获取中间部分代码 80 + $mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码
87 }else{ 81 }else{
88 if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码 82 if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
89 - $type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型  
90 - $commonInfo = $this->getCommonPage($type,$this->user['project_id'],0);//获取定制头部 83 + $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,0);//获取定制头部
91 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); 84 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
92 return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); 85 return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
93 } 86 }
94 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; 87 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']];
95 } 88 }
96 - $commonInfo = $this->getCommonPage($source,$source_id,$template_id);//获取头部 89 + $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id);//获取定制头部
97 $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. 90 $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
98 $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; 91 $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
99 $html = $this->getHeadFooter($html); 92 $html = $this->getHeadFooter($html);
100 $result = ['html'=>$html,'template_id'=>$template_id]; 93 $result = ['html'=>$html,'template_id'=>$template_id];
101 - if($templateInfo !== false){ 94 + if($templateInfo !== false)
  95 + {
102 $result['id'] = $templateInfo['id']; 96 $result['id'] = $templateInfo['id'];
103 $result['updated_at'] = $templateInfo['updated_at']; 97 $result['updated_at'] = $templateInfo['updated_at'];
104 } 98 }
@@ -106,6 +100,43 @@ class BTemplateLogic extends BaseLogic @@ -106,6 +100,43 @@ class BTemplateLogic extends BaseLogic
106 } 100 }
107 101
108 /** 102 /**
  103 + * @remark :获取中间部分的html
  104 + * @name :getMAinHtml
  105 + * @author :lyh
  106 + * @method :post
  107 + * @time :2023/12/27 15:00
  108 + */
  109 + public function getMAinHtml($type,$is_custom,$is_list){
  110 + //获取设置的默认中间部分
  111 + $bTemplateMainModel = new BTemplateMain();
  112 + $mainInfo = $bTemplateMainModel->read(['type'=>$type,'is_list'=>$is_list,'is_custom'=>$is_custom]);
  113 + if($mainInfo === false){
  114 + $main_html = $this->getInitModule($type,$is_custom,$is_list);
  115 + $main_css = "<style id='globalsojs-styles'></style>";
  116 + }else{
  117 + $main_html = $mainInfo['main_html'];
  118 + $main_css = $mainInfo['main_css'];
  119 + }
  120 + return ['main_html'=>$main_html,'main_css'=>$main_css];
  121 + }
  122 +
  123 + /**
  124 + * @remark :默认复合页数据
  125 + * @name :getProductModule
  126 + * @author :lyh
  127 + * @method :post
  128 + * @time :2023/7/27 15:08
  129 + */
  130 + public function getInitModule($type,$is_custom,$is_list){
  131 + if($is_custom == BTemplate::SOURCE_CUSTOM) {
  132 + $type = BTemplate::TYPE_CUSTOM;
  133 + }
  134 + $mainModel = new TemplateTypeMain();
  135 + $info = $mainModel->read(['type'=>$type,'is_list'=>$is_list]);
  136 + return $info['main_html'];
  137 + }
  138 +
  139 + /**
109 * @remark :返回整个html截取代码 140 * @remark :返回整个html截取代码
110 * @name :handleAllHtml 141 * @name :handleAllHtml
111 * @author :lyh 142 * @author :lyh
@@ -129,19 +160,19 @@ class BTemplateLogic extends BaseLogic @@ -129,19 +160,19 @@ class BTemplateLogic extends BaseLogic
129 * @method :post 160 * @method :post
130 * @time :2023/12/13 10:55 161 * @time :2023/12/13 10:55
131 */ 162 */
132 - public function isCustomizedPage($source,$source_id) 163 + public function isCustomizedPage($source,$is_list)
133 { 164 {
134 - $type = $this->getCustomizedType($source, $source_id);//获取定制界面类型 165 + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
135 //查看当前页面是否定制,是否开启可视化 166 //查看当前页面是否定制,是否开启可视化
136 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 167 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
137 if (in_array($type, $page_array)) {//是定制界面 168 if (in_array($type, $page_array)) {//是定制界面
138 //TODO::获取初始代码 169 //TODO::获取初始代码
139 $bTemplateMainModel = new BTemplateMain(); 170 $bTemplateMainModel = new BTemplateMain();
140 - $customHtmlInfo = $bTemplateMainModel->read(['type'=>$type]); 171 + $customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_list'=>$is_list]);
141 if($customHtmlInfo === false){ 172 if($customHtmlInfo === false){
142 $this->fail('定制页面,请先上传代码块'); 173 $this->fail('定制页面,请先上传代码块');
143 } 174 }
144 - $commonInfo = $this->getCommonPage($type,$this->user['project_id'],0);//获取定制头部 175 + $commonInfo = $this->getCommonHtml($type,$is_list,0);//获取定制头部
145 if($commonInfo !== false){ 176 if($commonInfo !== false){
146 $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); 177 $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
147 } 178 }
@@ -151,22 +182,34 @@ class BTemplateLogic extends BaseLogic @@ -151,22 +182,34 @@ class BTemplateLogic extends BaseLogic
151 } 182 }
152 183
153 /** 184 /**
154 - * @remark :定制界面根据source+source_id获取type类型 185 + * @remark :根据source获取type类型
155 * @name :getType 186 * @name :getType
156 * @author :lyh 187 * @author :lyh
157 * @method :post 188 * @method :post
158 * @time :2023/11/16 11:20 189 * @time :2023/11/16 11:20
159 */ 190 */
160 - public function getCustomizedType($source,$source_id){ 191 + public function getCustomizedType($source,$is_list){
161 $type = BTemplate::TYPE_ONE; 192 $type = BTemplate::TYPE_ONE;
162 if($source == BTemplate::SOURCE_PRODUCT){ 193 if($source == BTemplate::SOURCE_PRODUCT){
163 - if($source_id == 0){$type = BTemplate::TYPE_THREE;}else{$type = BTemplate::TYPE_TWO;} 194 + if($is_list == BTemplate::IS_LIST){
  195 + $type = BTemplate::TYPE_THREE;
  196 + }else{
  197 + $type = BTemplate::TYPE_TWO;
  198 + }
164 } 199 }
165 if($source == BTemplate::SOURCE_BLOG){ 200 if($source == BTemplate::SOURCE_BLOG){
166 - if($source_id == 0){$type = BTemplate::TYPE_FIVE;}else{$type = BTemplate::TYPE_FOUR;} 201 + if($is_list == BTemplate::IS_LIST){
  202 + $type = BTemplate::TYPE_FIVE;
  203 + }else{
  204 + $type = BTemplate::TYPE_FOUR;
  205 + }
167 } 206 }
168 if($source == BTemplate::SOURCE_NEWS){ 207 if($source == BTemplate::SOURCE_NEWS){
169 - if($source_id == 0){$type = BTemplate::TYPE_SEVEN;}else{$type = BTemplate::TYPE_SIX;} 208 + if($is_list == BTemplate::IS_LIST){
  209 + $type = BTemplate::TYPE_SEVEN;
  210 + }else{
  211 + $type = BTemplate::TYPE_SIX;
  212 + }
170 } 213 }
171 return $type; 214 return $type;
172 } 215 }
@@ -178,13 +221,14 @@ class BTemplateLogic extends BaseLogic @@ -178,13 +221,14 @@ class BTemplateLogic extends BaseLogic
178 * @method :post 221 * @method :post
179 * @time :2023/12/13 10:48 222 * @time :2023/12/13 10:48
180 */ 223 */
181 - public function getSettingTemplate($source,$source_id){ 224 + public function getSettingTemplate($source,$is_list){
  225 + $template_id = 0;
182 if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION) {//定制项目 226 if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION) {//定制项目
183 - $type = $this->getCustomizedType($source, $source_id);//获取定制界面类型 227 + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
184 //查看当前页面是否定制,是否开启可视化 228 //查看当前页面是否定制,是否开启可视化
185 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 229 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
186 if (in_array($type, $page_array)) {//是定制界面 230 if (in_array($type, $page_array)) {//是定制界面
187 - return 0; 231 + return $this->success($template_id);
188 } 232 }
189 } 233 }
190 $bSettingModel = new Setting(); 234 $bSettingModel = new Setting();
@@ -192,56 +236,8 @@ class BTemplateLogic extends BaseLogic @@ -192,56 +236,8 @@ class BTemplateLogic extends BaseLogic
192 if($info === false){ 236 if($info === false){
193 $this->fail('请先选择模版'); 237 $this->fail('请先选择模版');
194 } 238 }
195 - return $info['template_id'];  
196 - }  
197 -  
198 - /**  
199 - * @remark :根据参数获取数据详情  
200 - * @name :webTemplateInfo  
201 - * @author :lyh  
202 - * @method :post  
203 - * @time :2023/7/25 16:41  
204 - */  
205 - public function webTemplateInfo($template_id,$source,$source_id,$is_custom = 0){  
206 - //查看当前模板是否已编辑保存web_template  
207 - $TemplateInfo = $this->model->read([  
208 - 'template_id'=>$template_id,  
209 - 'source'=>$source,  
210 - 'project_id'=>$this->user['project_id'],  
211 - 'source_id'=>$source_id,  
212 - 'is_custom'=>$is_custom  
213 - ]);  
214 - return $this->success($TemplateInfo);  
215 - }  
216 -  
217 - /**  
218 - * @remark :获取中间公共部分  
219 - * @name :getCommonMain  
220 - * @author :lyh  
221 - * @method :post  
222 - * @time :2023/10/24 15:58  
223 - */  
224 - public function getCommonMain($source,$source_id,$is_custom){  
225 - $data = [];  
226 - if($is_custom == BTemplate::SOURCE_CUSTOM){  
227 - if($source_id != 0){$type = BTemplate::TYPE_CUSTOM_DETAIL;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}  
228 - }else{  
229 - if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}  
230 - if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}  
231 - if ($source == BTemplate::SOURCE_NEWS) {if ($source_id != 0) {$type = BTemplate::TYPE_SIX;} else {$type = BTemplate::TYPE_SEVEN;}}  
232 - if ($source == BTemplate::SOURCE_KEYWORD) {$type = BTemplate::TYPE_EIGHT;}  
233 - }  
234 - //查询有没有公共详情模板  
235 - $bTemplateMainModel = new BTemplateMain();  
236 - $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$type]);  
237 - if($mainInfo === false){  
238 - $data['main_html'] = $this->getModule($type);  
239 - $data['main_css'] = "<style id='globalsojs-styles'></style>";  
240 - }else{  
241 - $data['main_html'] = $mainInfo['main_html'];  
242 - $data['main_css'] = $mainInfo['main_css'];  
243 - }  
244 - return $data; 239 + $template_id = $info['template_id'];
  240 + return $this->success($template_id);
245 } 241 }
246 242
247 /** 243 /**
@@ -251,38 +247,25 @@ class BTemplateLogic extends BaseLogic @@ -251,38 +247,25 @@ class BTemplateLogic extends BaseLogic
251 * @method :post 247 * @method :post
252 * @time :2023/10/21 16:55 248 * @time :2023/10/21 16:55
253 */ 249 */
254 - public function getCommonPage($source,$source_id,$template_id){  
255 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {  
256 - //查看页面是否设置自定义头部底部  
257 - $pageSettingModel = new PageSetting();  
258 - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);  
259 - if ($pageInfo != false) {  
260 - $commonTemplateModel = new BTemplateCommon();  
261 - $data = [  
262 - 'template_id' => $template_id,  
263 - 'project_id' => $this->user['project_id']  
264 - ];  
265 - if ($source == BTemplate::SOURCE_PRODUCT) {//产品页  
266 - if($source_id != 0){$data['type'] = BTemplate::TYPE_TWO;if ($pageInfo['product_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
267 - else {$data['type'] = BTemplate::TYPE_THREE;if ($pageInfo['product_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}  
268 - if ($source == BTemplate::SOURCE_BLOG) {//博客页  
269 - if ($source_id != 0) {$data['type'] = BTemplate::TYPE_FOUR;if ($pageInfo['blog_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
270 - else {$data['type'] = BTemplate::TYPE_FIVE;if ($pageInfo['blog_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}  
271 - if ($source == BTemplate::SOURCE_NEWS) {//新闻页  
272 - if ($source_id != 0) {$data['type'] = BTemplate::TYPE_SIX;if ($pageInfo['news_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
273 - else {$data['type'] = BTemplate::TYPE_SEVEN;if ($pageInfo['news_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}  
274 - if ($source == BTemplate::SOURCE_KEYWORD) {//聚合页  
275 - $data['type'] = BTemplate::TYPE_EIGHT;if ($pageInfo['polymerization'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
276 - }  
277 - }  
278 - //获取首页公共的头部和底部  
279 - if(!isset($commonInfo) || $commonInfo === false){  
280 - $commonTemplateModel = new BTemplateCommon();  
281 - $commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>BTemplate::TYPE_ONE]); 250 + public function getCommonHtml($source,$is_list,$template_id){
  251 + $type = $this->getType($source,$is_list,$template_id);
  252 + $data = [
  253 + 'template_id' => $template_id,
  254 + 'project_id' => $this->user['project_id'],
  255 + 'type'=>$type
  256 + ];
  257 + $commonTemplateModel = new BTemplateCommon();
  258 + $commonInfo = $commonTemplateModel->read($data);
  259 + if($commonInfo === false){
  260 + $data['type'] = BTemplate::SOURCE_HOME;
  261 + $commonInfo = $commonTemplateModel->read($data);
282 } 262 }
283 - return $commonInfo; 263 + return $this->success($commonInfo);
284 } 264 }
285 265
  266 +
  267 +
  268 +
286 /** 269 /**
287 * @remark :保存修改后的模版 270 * @remark :保存修改后的模版
288 * @name :templateSave 271 * @name :templateSave
@@ -293,28 +276,40 @@ class BTemplateLogic extends BaseLogic @@ -293,28 +276,40 @@ class BTemplateLogic extends BaseLogic
293 public function templateSave(){ 276 public function templateSave(){
294 //演示项目不允许修改 277 //演示项目不允许修改
295 $this->showProjectNoEdit($this->param['source']); 278 $this->showProjectNoEdit($this->param['source']);
296 - DB::beginTransaction();  
297 - try {  
298 - $this->param = $this->handleDefaultString($this->param);//设置默认字符  
299 - $templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],  
300 - $this->param['source_id'],$this->param['is_custom']);  
301 - if($templateInfo === false){//执行新增  
302 - $this->templateAddHtml($this->param['html'], $this->param['source'], $this->param['source_id'],  
303 - $this->param['template_id'], $this->param['section_list_id'], $this->param['is_custom']);  
304 - }else{//执行编辑  
305 - $this->templateEditHtml($this->param['html'],$this->param['source'],$this->param['source_id'],  
306 - $this->param['template_id'],$this->param['section_list_id'], $this->param['is_custom']);  
307 - }  
308 - //更新头部信息  
309 - $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);  
310 - $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);  
311 - DB::commit();  
312 - }catch (\Exception $e){  
313 - DB::rollBack();  
314 - $this->fail('系统错误,请联系管理员'); 279 + $this->param = $this->handleDefaultString($this->param);//设置默认数据
  280 + $templateInfo = $this->model->read([
  281 + 'template_id'=>$this->param['template_id'],
  282 + 'source'=>$this->param['source'],
  283 + 'source_id'=>$this->param['source_id'],
  284 + 'is_custom'=>$this->param['is_custom'],
  285 + 'is_list'=>$this->param['is_list']
  286 + ]);
  287 + if($templateInfo === false){//执行新增
  288 + $data = [
  289 + 'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],'type'=>BTemplate::PAGE_HTML,
  290 + 'template_id'=>$this->param['template_id'], 'project_id'=>$this->user['project_id'],
  291 + 'section_list_id'=>$this->param['section_list_id'],'is_custom'=>$this->param['is_custom'],
  292 + 'is_list'=>$this->param['is_list']
  293 + ];
  294 + $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data);
  295 + $this->model->add($data);
  296 + }else{//执行编辑
  297 + $condition = [
  298 + 'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],
  299 + 'is_custom'=>$this->param['is_custom'], 'template_id'=>$this->param['template_id'],
  300 + 'is_list'=>$this->param['is_list']
  301 + ];
  302 + $data = [
  303 + 'section_list_id'=>$this->param['section_list_id']
  304 + ];
  305 + $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data);
  306 + $this->model->edit($data,$condition);
315 } 307 }
  308 + //更新头部信息
  309 + $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id']);
  310 + $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
316 //通知更新 311 //通知更新
317 - $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']); 312 + $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']);
318 return $this->success(); 313 return $this->success();
319 } 314 }
320 315
@@ -326,66 +321,23 @@ class BTemplateLogic extends BaseLogic @@ -326,66 +321,23 @@ class BTemplateLogic extends BaseLogic
326 * @time :2023/12/15 10:30 321 * @time :2023/12/15 10:30
327 */ 322 */
328 public function handleDefaultString($param){ 323 public function handleDefaultString($param){
329 - if(!isset($param['template_id'])){  
330 - $param['template_id'] = 0;  
331 - }  
332 - if(!isset($param['is_custom'])){  
333 - $param['is_custom'] = 0;  
334 - }  
335 - if(!isset($param['section_list_id'])){  
336 - $param['section_list_id'] = '';  
337 - } 324 + $param['template_id'] = $param['template_id'] ?? 0;
  325 + $param['is_custom'] = $param['is_custom'] ?? 0;
  326 + $param['section_list_id'] = $param['section_list_id'] ?? '';
  327 + $param['is_list'] = $param['is_list'] ?? 0;
338 return $this->success($param); 328 return $this->success($param);
339 } 329 }
340 330
341 /** 331 /**
342 - * @remark :可视化添加数据  
343 - * @name :templateAddHtml  
344 - * @author :lyh  
345 - * @method :post  
346 - * @time :2023/12/15 10:15  
347 - */  
348 - public function templateAddHtml($html,$source,$source_id,$template,$section_list_id,$is_custom){  
349 - $data = [  
350 - 'source'=>$source, 'source_id'=>$source_id,'type'=>BTemplate::PAGE_HTML,  
351 - 'template_id'=>$template, 'project_id'=>$this->user['project_id'],  
352 - 'section_list_id'=>$section_list_id,'is_custom'=>$is_custom,  
353 - ];  
354 - $data = $this->handleVisualizationParam($html,$source,$source_id,$data);  
355 - $this->model->add($data);  
356 - return true;  
357 - }  
358 -  
359 - /**  
360 - * @remark :可视化更新html  
361 - * @name :templateEditHtml  
362 - * @author :lyh  
363 - * @method :post  
364 - * @time :2023/12/15 10:26  
365 - */  
366 - public function templateEditHtml($html,$source,$source_id,$template,$section_list_id,$is_custom){  
367 - $condition = [  
368 - 'source'=>$source, 'source_id'=>$source_id,  
369 - 'is_custom'=>$is_custom, 'template_id'=>$template  
370 - ];  
371 - $data = [  
372 - 'section_list_id'=>$section_list_id  
373 - ];  
374 - $data = $this->handleVisualizationParam($html,$source,$source_id,$data);  
375 - $this->model->edit($data,$condition);  
376 - return true;  
377 - }  
378 -  
379 - /**  
380 * @remark :处理可视化数据 332 * @remark :处理可视化数据
381 * @name :handleProjectParam 333 * @name :handleProjectParam
382 * @author :lyh 334 * @author :lyh
383 * @method :post 335 * @method :post
384 * @time :2023/12/15 10:59 336 * @time :2023/12/15 10:59
385 */ 337 */
386 - public function handleVisualizationParam($html,$source, $source_id,$data){ 338 + public function handleVisualizationParam($html,$source, $is_list,$data){
387 if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//定制项目 339 if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//定制项目
388 - $type = $this->getCustomizedType($source, $source_id);//获取定制界面类型 340 + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
389 //查看当前页面是否定制,是否开启可视化 341 //查看当前页面是否定制,是否开启可视化
390 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 342 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
391 if (in_array($type, $page_array)) {//当前页面是定制界面 343 if (in_array($type, $page_array)) {//当前页面是定制界面
@@ -412,8 +364,8 @@ class BTemplateLogic extends BaseLogic @@ -412,8 +364,8 @@ class BTemplateLogic extends BaseLogic
412 * @method :post 364 * @method :post
413 * @time :2023/12/13 17:05 365 * @time :2023/12/13 17:05
414 */ 366 */
415 - public function saveCommonHtml($html,$source,$source_id,$template_id){  
416 - $type = $this->getType($source,$source_id,$template_id);//获取头部类型1-9(首页到自定义页面) 367 + public function saveCommonHtml($html,$source,$is_list,$template_id){
  368 + $type = $this->getType($source,$is_list,$template_id);//获取头部类型1-9(首页到自定义页面)
417 $templateCommonModel = new BTemplateCommon(); 369 $templateCommonModel = new BTemplateCommon();
418 $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 370 $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在
419 $handleInfo = $this->handleCommonParam($html); 371 $handleInfo = $this->handleCommonParam($html);
@@ -482,32 +434,34 @@ class BTemplateLogic extends BaseLogic @@ -482,32 +434,34 @@ class BTemplateLogic extends BaseLogic
482 return $this->success($param); 434 return $this->success($param);
483 } 435 }
484 /** 436 /**
485 - * @remark :获取设置的类型 437 + * @remark :保存时获取获取设置的类型
486 * @name :getType 438 * @name :getType
487 * @author :lyh 439 * @author :lyh
488 * @method :post 440 * @method :post
489 * @time :2023/10/21 17:29 441 * @time :2023/10/21 17:29
490 */ 442 */
491 - public function getType($source,$source_id,$template_id){  
492 - $type = 1;//首页公共头部底部 443 + public function getType($source,$is_list,$template_id){
  444 + $type = BTemplate::SOURCE_HOME;//首页公共头部底部
  445 + $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
493 if($template_id == 0){//保存上传的代码块时,默认为独立头部 446 if($template_id == 0){//保存上传的代码块时,默认为独立头部
494 - $this->user['configuration']['is_head'] == 1; 447 + $is_head == BTemplate::IS_HEADER;
495 } 448 }
496 //查看页面是否设置自定义头部底部 449 //查看页面是否设置自定义头部底部
497 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) { 450 + if($is_head != BTemplate::IS_NO_HEADER) {
498 $pageSettingModel = new PageSetting(); 451 $pageSettingModel = new PageSetting();
499 $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); 452 $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
500 - if ($pageInfo !== false) {  
501 - if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_TWO;}}  
502 - else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_THREE;}}}  
503 - if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_FOUR;}}  
504 - else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_FIVE;}}}  
505 - if ($source == BTemplate::SOURCE_NEWS) {if ($source_id != 0) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_SIX;}}  
506 - else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_SEVEN;}}}  
507 - if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_EIGHT;}} 453 + if ($pageInfo === false) {
  454 + return $this->success($type);
508 } 455 }
  456 + if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list == 0) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_TWO;}}
  457 + else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_THREE;}}}
  458 + if ($source == BTemplate::SOURCE_BLOG) {if ($is_list == 0) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_FOUR;}}
  459 + else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_FIVE;}}}
  460 + if ($source == BTemplate::SOURCE_NEWS) {if ($is_list == 0) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_SIX;}}
  461 + else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_SEVEN;}}}
  462 + if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_EIGHT;}}
509 } 463 }
510 - return $type; 464 + return $this->success($type);
511 } 465 }
512 466
513 /** 467 /**
@@ -518,6 +472,9 @@ class BTemplateLogic extends BaseLogic @@ -518,6 +472,9 @@ class BTemplateLogic extends BaseLogic
518 * @time :2023/8/23 11:16 472 * @time :2023/8/23 11:16
519 */ 473 */
520 public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom,$type = 0){ 474 public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom,$type = 0){
  475 + if($source != BTemplate::SOURCE_HOME){
  476 + return true;
  477 + }
521 $data = [ 478 $data = [
522 'template_id'=>$template_id, 479 'template_id'=>$template_id,
523 'project_id'=>$this->user['project_id'], 480 'project_id'=>$this->user['project_id'],
@@ -547,22 +504,38 @@ class BTemplateLogic extends BaseLogic @@ -547,22 +504,38 @@ class BTemplateLogic extends BaseLogic
547 * @method :post 504 * @method :post
548 * @time :2023/7/31 16:05 505 * @time :2023/7/31 16:05
549 */ 506 */
550 - public function homeOrProduct($source,$source_id = 0,$is_custom = 0){ 507 + public function homeOrProduct($source,$source_id = 0,$is_custom = 0,$is_list = 0){
551 if($is_custom == 0){ 508 if($is_custom == 0){
552 if($source == BTemplate::SOURCE_HOME){ 509 if($source == BTemplate::SOURCE_HOME){
553 RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']); 510 RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
554 $type = RouteMap::SOURCE_PAGE; 511 $type = RouteMap::SOURCE_PAGE;
555 }elseif($source == BTemplate::SOURCE_PRODUCT){ 512 }elseif($source == BTemplate::SOURCE_PRODUCT){
556 - $type = RouteMap::SOURCE_PRODUCT; 513 + if($is_list == BTemplate::IS_LIST){
  514 + $type = RouteMap::SOURCE_PRODUCT_CATE;
  515 + }else{
  516 + $type = RouteMap::SOURCE_PRODUCT;
  517 + }
557 }elseif($source == BTemplate::SOURCE_BLOG){ 518 }elseif($source == BTemplate::SOURCE_BLOG){
558 - $type = RouteMap::SOURCE_BLOG; 519 + if($is_list == BTemplate::IS_LIST){
  520 + $type = RouteMap::SOURCE_BLOG_CATE;
  521 + }else{
  522 + $type = RouteMap::SOURCE_BLOG;
  523 + }
559 }elseif($source == BTemplate::SOURCE_NEWS){ 524 }elseif($source == BTemplate::SOURCE_NEWS){
560 - $type = RouteMap::SOURCE_NEWS; 525 + if($is_list == BTemplate::IS_LIST){
  526 + $type = RouteMap::SOURCE_NEWS_CATE;
  527 + }else{
  528 + $type = RouteMap::SOURCE_NEWS;
  529 + }
561 }else{ 530 }else{
562 $type = 'all'; 531 $type = 'all';
563 } 532 }
564 }else{ 533 }else{
565 - $type = RouteMap::SOURCE_MODULE; 534 + if($is_list == BTemplate::IS_LIST){
  535 + $type = RouteMap::SOURCE_MODULE_CATE;
  536 + }else{
  537 + $type = RouteMap::SOURCE_MODULE;
  538 + }
566 } 539 }
567 $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']); 540 $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
568 $this->addUpdateNotify($type,$route); 541 $this->addUpdateNotify($type,$route);
@@ -615,19 +588,6 @@ class BTemplateLogic extends BaseLogic @@ -615,19 +588,6 @@ class BTemplateLogic extends BaseLogic
615 } 588 }
616 589
617 /** 590 /**
618 - * @remark :默认产品模块  
619 - * @name :getProductModule  
620 - * @author :lyh  
621 - * @method :post  
622 - * @time :2023/7/27 15:08  
623 - */  
624 - public function getModule($type){  
625 - $mainModel = new TemplateTypeMain();  
626 - $info = $mainModel->read(['type'=>$type]);  
627 - return $info['main_html'];  
628 - }  
629 -  
630 - /**  
631 * @remark :设置主题公共head 591 * @remark :设置主题公共head
632 * @name :setHeadInfo 592 * @name :setHeadInfo
633 * @author :lyh 593 * @author :lyh
@@ -823,134 +783,4 @@ class BTemplateLogic extends BaseLogic @@ -823,134 +783,4 @@ class BTemplateLogic extends BaseLogic
823 } 783 }
824 return $this->success(); 784 return $this->success();
825 } 785 }
826 -  
827 - /**  
828 - * @remark :获取详情模板详情  
829 - * @name :getDetail  
830 - * @author :lyh  
831 - * @method :post  
832 - * @time :2023/10/24 11:29  
833 - */  
834 - public function getDetail(){  
835 - $bSettingModel = new Setting();  
836 - $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);  
837 - if($bSettingInfo === false){  
838 - $this->fail('请先设置模板');  
839 - }  
840 - $is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版  
841 - $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);  
842 - //获取设置的默认中间部分  
843 - $bTemplateMainModel = new BTemplateMain();  
844 - $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom]);  
845 - if($mainInfo === false){  
846 - if($is_custom == BTemplate::SOURCE_CUSTOM) {  
847 - $this->param['type'] = BTemplate::TYPE_CUSTOM_DETAIL;  
848 - }  
849 - $main_html = $this->getModule($this->param['type']);  
850 - $main_style = "<style id='globalsojs-styles'></style>";  
851 - }else{  
852 - $main_html = $mainInfo['main_html'];  
853 - $main_style = $mainInfo['main_css'];  
854 - }  
855 - $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].  
856 - $commonInfo['head_html'].$main_html.$commonInfo['footer_html'];  
857 - $html = $this->getHeadFooter($html);//组装数据  
858 - return $this->success($html);  
859 - }  
860 -  
861 - /**  
862 - * @remark :根据type获取html  
863 - * @name :getHeaderFooter  
864 - * @author :lyh  
865 - * @method :post  
866 - * @time :2023/12/15 18:06  
867 - */  
868 - public function getTypeCommonHtml($template_id,$type,$is_custom){  
869 - //获取首页公共部分  
870 - $templateCommonModel = new BTemplateCommon();  
871 - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);  
872 - if($is_custom == BTemplate::SOURCE_CUSTOM){  
873 - return $this->success($commonInfo);  
874 - }  
875 - //判断当前项目是否有设置独立头部的权限  
876 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {  
877 - //有权限时,获取独立头部  
878 - $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);  
879 - if($commonTypeInfo !== false){  
880 - $commonInfo = $commonTypeInfo;  
881 - }  
882 - }  
883 - return $this->success($commonInfo);  
884 - }  
885 -  
886 - /**  
887 - * @remark :保存详情模板数据  
888 - * @name :saveDetail  
889 - * @author :lyh  
890 - * @method :post  
891 - * @time :2023/10/24 11:53  
892 - */  
893 - public function saveDetail(){  
894 - $bSettingModel = new Setting();  
895 - $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);  
896 - if($bSettingInfo === false){  
897 - $this->fail('请先设置模板');  
898 - }  
899 - $is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版  
900 - $data = [  
901 - 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'),  
902 - 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'),  
903 - ];  
904 - $data['section_list_id'] = $this->param['section_list_id'];  
905 - //保存中间部分  
906 - $bTemplateMainModel = new BTemplateMain();  
907 - $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom]);  
908 - if($mainInfo === false){  
909 - $data['project_id'] = $this->user['project_id'];  
910 - $data['type'] = $this->param['type'];  
911 - $data['is_custom'] = $is_custom;  
912 - $bTemplateMainModel->add($data);  
913 - }else{  
914 - $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]);  
915 - }  
916 - $this->saveDetailCommonHtml($is_custom,$this->param['type'],$bSettingInfo['template_id'],$this->param['html']);  
917 - return $this->success();  
918 - }  
919 -  
920 - /**  
921 - * @remark :保存详情页模版头部底部  
922 - * @name :saveDetailCommonHtml  
923 - * @author :lyh  
924 - * @method :post  
925 - * @time :2023/12/15 18:12  
926 - */  
927 - public function saveDetailCommonHtml($is_custom,$type,$template_id,$html){  
928 - $publicData = [  
929 - 'head_html' => characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),  
930 - 'head_css' => characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),  
931 - 'footer_html' => characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),  
932 - 'footer_css' => characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),  
933 - 'other'=>str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")),  
934 - ];  
935 - //查看当前模板是否有独立头部,有独立头部,更新独立头部,无独立头部,更新公共头部  
936 - if($is_custom == BTemplate::SOURCE_CUSTOM){//扩展模块  
937 - $this->user['configuration']['is_head'] = BTemplate::SOURCE_NO_CUSTOM;  
938 - }  
939 - $templateCommonModel = new BTemplateCommon();  
940 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {  
941 - $templateCommonInfo = $templateCommonModel->read(['type'=>$type,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);  
942 - if($templateCommonInfo === false){  
943 - $publicData['type'] = $type;  
944 - $publicData['project_id'] = $this->user['project_id'];  
945 - $publicData['template_id'] = $template_id;  
946 - $templateCommonModel->add($publicData);  
947 - }else{  
948 - $templateCommonModel->edit($publicData,['id'=>$templateCommonInfo['id']]);  
949 - }  
950 - }else{  
951 - //更新首页头部底部  
952 - $templateCommonModel->edit($publicData,['type'=>1,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);  
953 - }  
954 - return true;  
955 - }  
956 } 786 }
@@ -29,7 +29,7 @@ class CustomTemplateLogic extends BaseLogic @@ -29,7 +29,7 @@ class CustomTemplateLogic extends BaseLogic
29 * @time :2023/6/29 15:46 29 * @time :2023/6/29 15:46
30 */ 30 */
31 public function customTemplateLists($map,$page,$row,$order = 'created_at'){ 31 public function customTemplateLists($map,$page,$row,$order = 'created_at'){
32 - $filed = ['id','name','status','url','title','keywords','description','project_id','created_at','updated_at']; 32 + $filed = ['id','name','status','url','title','keywords','description','project_id','is_upgrade','six_read','created_at','updated_at'];
33 $map['deleted_status'] = 0; 33 $map['deleted_status'] = 0;
34 $map['project_id'] = $this->user['project_id']; 34 $map['project_id'] = $this->user['project_id'];
35 $lists = $this->model->lists($map,$page,$row,$order,$filed); 35 $lists = $this->model->lists($map,$page,$row,$order,$filed);
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :InitHtmlLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/12/27 10:39
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\BTemplate;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\RouteMap\RouteMap;
  14 +use App\Models\Service\Service as ServiceSettingModel;
  15 +use App\Models\Template\BTemplate;
  16 +use App\Models\Template\BTemplateCommon;
  17 +use App\Models\Template\BTemplateMain;
  18 +use App\Models\Template\Setting;
  19 +use App\Models\Template\TemplateTypeMain;
  20 +
  21 +class InitHtmlLogic extends BaseLogic
  22 +{
  23 + public function __construct()
  24 + {
  25 + parent::__construct();
  26 + $this->param = $this->requestAll;
  27 + }
  28 +
  29 + /**
  30 + * @remark :获取非定制项目复合页数据
  31 + * @name :getDetailHtml
  32 + * @author :lyh
  33 + * @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
  34 + * @time :2023/12/27 10:50
  35 + */
  36 + public function getDetailHtml(){
  37 + $template_id = $this->getTemplateId();
  38 + $is_custom = $this->param['is_custom'] ?? 0;//TODO::1:代表扩展模块
  39 + $is_list = $this->param['is_list'] ?? 0;//TODO::1:代表分类列表模块
  40 + //获取设置的默认中间部分
  41 + $bTemplateMainModel = new BTemplateMain();
  42 + $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_list'=>$is_list,'is_custom'=>$is_custom]);
  43 + if($mainInfo === false){
  44 + $main_html = $this->getInitModule($this->param['type'],$is_custom,$is_list);
  45 + $main_style = "<style id='globalsojs-styles'></style>";
  46 + }else{
  47 + $main_html = $mainInfo['main_html'];
  48 + $main_style = $mainInfo['main_css'];
  49 + }
  50 + $commonInfo = $this->getTypeCommonHtml($template_id,$this->param['type'],$is_custom,$is_list); //获取头部
  51 + $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
  52 + $html = $this->getHeadFooter($html);//组装数据
  53 + return $this->success($html);
  54 + }
  55 +
  56 + /**
  57 + * @remark :拼接获取公共头部底部
  58 + * @name :getHeadFooter
  59 + * @author :lyh
  60 + * @method :post
  61 + * @time :2023/7/21 17:22
  62 + */
  63 + public function getHeadFooter($html){
  64 + //获取公共主题头部底部
  65 + $serviceSettingModel = new ServiceSettingModel();
  66 + $list = $serviceSettingModel->list(['type'=>2],'created_at');
  67 + //拼接html
  68 + foreach ($list as $v){
  69 + if($v['key'] == 'head'){
  70 + $html = $v['values'].$html;
  71 + }
  72 + if($v['key'] == 'footer'){
  73 + $html = $html.$v['values'];
  74 + }
  75 + }
  76 + return $html;
  77 + }
  78 +
  79 + /**
  80 + * @remark :保存复合页数据
  81 + * @name :saveDetailHtml
  82 + * @author :lyh
  83 + * @method :post
  84 + * @time :2023/12/27 11:57
  85 + */
  86 + public function saveDetailHtml(){
  87 + $template_id = $this->getTemplateId();
  88 + $is_custom = $this->param['is_custom'] ?? 0;//TODO::1:代表扩展模块
  89 + $is_list = $this->param['is_list'] ?? 0;//TODO::1:代表分类列表模块
  90 + //保存中间部分
  91 + $bTemplateMainModel = new BTemplateMain();
  92 + $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]);
  93 + if($mainInfo === false){
  94 + $data = [
  95 + 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'),
  96 + 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'),
  97 + 'section_list_id'=>$this->param['section_list_id'] ?? '',
  98 + 'project_id'=>$this->user['project_id'],
  99 + 'type'=>$this->param['type'],
  100 + 'is_custom'=>$is_custom,
  101 + 'is_list'=>$is_list
  102 + ];
  103 + $bTemplateMainModel->add($data);
  104 + }else{
  105 + $data = [
  106 + 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'),
  107 + 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'),
  108 + 'section_list_id'=>$this->param['section_list_id'] ?? '',
  109 + ];
  110 + $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]);
  111 + }
  112 + $this->saveDetailCommonHtml($this->param['html'],$this->param['type'],$template_id,$is_custom,$is_list);
  113 + $route = RouteMap::getRoute('all',0,$this->user['project_id']);
  114 + $this->curlDelRoute(['route'=>$route,'new_route'=>$route]);
  115 + return $this->success();
  116 + }
  117 + /**
  118 + * @remark :保存详情页模版头部底部
  119 + * @name :saveDetailCommonHtml
  120 + * @author :lyh
  121 + * @method :post
  122 + * @time :2023/12/15 18:12
  123 + */
  124 + public function saveDetailCommonHtml($html,$type,$template_id,$is_custom,$is_list){
  125 + $publicData = $this->handleCommonParam($html);
  126 + $templateCommonModel = new BTemplateCommon();
  127 + //查看当前模板是否有独立头部,有独立头部,更新独立头部,无独立头部,更新公共头部
  128 + $is_head = $this->user['configuration']['is_head'] ?? 0;
  129 + if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::扩展模块无独立头部底部
  130 + $is_head = BTemplate::IS_NO_HEADER;
  131 + }
  132 + if($is_head == BTemplate::IS_HEADER) {
  133 + //有独立头部,更新独立头部
  134 + $commonType = $this->getHeaderType($type,$is_list);
  135 + $templateCommonInfo = $templateCommonModel->read(['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'type'=>$commonType]);
  136 + if($templateCommonInfo === false){
  137 + $publicData['type'] = $type;
  138 + $publicData['project_id'] = $this->user['project_id'];
  139 + $publicData['template_id'] = $template_id;
  140 + $templateCommonModel->add($publicData);
  141 + }else{
  142 + $templateCommonModel->edit($publicData,['id'=>$templateCommonInfo['id']]);
  143 + }
  144 + }else{
  145 + //更新首页头部底部
  146 + $templateCommonModel->edit($publicData,['type'=>BTemplate::SOURCE_HOME,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
  147 + }
  148 + return $this->success();
  149 + }
  150 +
  151 + /**
  152 + * @remark :保存时字符串处理
  153 + * @name :handleCommonParam
  154 + * @author :lyh
  155 + * @method :post
  156 + * @time :2023/6/29 15:35
  157 + */
  158 + public function handleCommonParam($html){
  159 + //字符串截取
  160 + $param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s');
  161 + $param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s');
  162 + $param['head_css'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s');
  163 + $param['footer_css'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s');
  164 + $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
  165 + $param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
  166 + return $this->success($param);
  167 + }
  168 +
  169 + /**
  170 + * @remark :默认复合页数据
  171 + * @name :getProductModule
  172 + * @author :lyh
  173 + * @method :post
  174 + * @time :2023/7/27 15:08
  175 + */
  176 + public function getInitModule($type,$is_custom,$is_list){
  177 + if($is_custom == BTemplate::SOURCE_CUSTOM) {
  178 + $type = BTemplate::TYPE_CUSTOM;
  179 + }
  180 + $mainModel = new TemplateTypeMain();
  181 + $info = $mainModel->read(['type'=>$type,'is_list'=>$is_list]);
  182 + return $info['main_html'];
  183 + }
  184 +
  185 + /**
  186 + * @remark :根据type获取头部html
  187 + * @name :getHeaderFooter
  188 + * @author :lyh
  189 + * @method :post
  190 + * @time :2023/12/15 18:06
  191 + */
  192 + public function getTypeCommonHtml($template_id,$type,$is_custom,$is_list){
  193 + //判断当前项目是否有设置独立头部的权限
  194 + $is_head = $this->user['configuration']['is_head'] ?? 0;
  195 + if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::拓展模块默认取首页
  196 + $is_head = BTemplate::IS_NO_HEADER;
  197 + }
  198 + //获取首页公共部分
  199 + $templateCommonModel = new BTemplateCommon();
  200 + if($is_head == BTemplate::IS_HEADER) {
  201 + //有独立头部,获取独立头部
  202 + $commonType = $this->getHeaderType($type,$is_list);
  203 + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$commonType]);
  204 + if($commonInfo !== false){
  205 + return $this->success($commonInfo);
  206 + }
  207 + }
  208 + //首页头底
  209 + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>BTemplate::SOURCE_HOME]);
  210 + return $this->success($commonInfo);
  211 + }
  212 +
  213 + /**
  214 + * @remark :独立头部获取头部底部类型
  215 + * @name :getHeaderType
  216 + * @author :lyh
  217 + * @method :post
  218 + * @time :2023/12/27 11:36
  219 + */
  220 + public function getHeaderType($type,$is_list){
  221 + $resultType = BTemplate::SOURCE_HOME;
  222 + if($type == BTemplate::SOURCE_PRODUCT){
  223 + if($is_list == BTemplate::IS_LIST){
  224 + $resultType = BTemplate::TYPE_THREE;
  225 + }else{
  226 + $resultType = BTemplate::TYPE_TWO;
  227 + }
  228 + }
  229 + if($type == BTemplate::SOURCE_BLOG){
  230 + if($is_list == BTemplate::IS_LIST){
  231 + $resultType = BTemplate::TYPE_FIVE;
  232 + }else{
  233 + $resultType = BTemplate::TYPE_FOUR;
  234 + }
  235 + }
  236 + if($type == BTemplate::SOURCE_NEWS){
  237 + if($is_list == BTemplate::IS_LIST){
  238 + $resultType = BTemplate::TYPE_SEVEN;
  239 + }else{
  240 + $resultType = BTemplate::TYPE_SIX;
  241 + }
  242 + }
  243 + return $this->success($resultType);
  244 + }
  245 +
  246 + /**
  247 + * @remark :获取模版id
  248 + * @name :getTemplateId
  249 + * @author :lyh
  250 + * @method :post
  251 + * @time :2023/12/27 10:51
  252 + */
  253 + public function getTemplateId(){
  254 + $bSettingModel = new Setting();
  255 + $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']],['id','template_id']);
  256 + if($bSettingInfo === false){
  257 + $this->fail('请先设置模板');
  258 + }
  259 + return $this->success($bSettingInfo['template_id']);
  260 + }
  261 +
  262 + /**
  263 + * @remark :获取代码块
  264 + * @name :getVisualizationInfo
  265 + * @author :lyh
  266 + * @method :post
  267 + * @time :2023/11/17 14:44
  268 + */
  269 + public function getCustomizedHtml(){
  270 + $is_list = $this->param['is_list'] ?? 0;
  271 + $bTemplateMainModel = new BTemplateMain();
  272 + $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]);
  273 + if($info === false){
  274 + $html = '';
  275 + }else{
  276 + $html = $info['main_html'];
  277 + }
  278 + return $this->success(['html'=>$html]);
  279 + }
  280 +
  281 + /**
  282 + * @remark :保存定制html
  283 + * @name :saveHtml
  284 + * @author :lyh
  285 + * @method :post
  286 + * @time :2023/11/15 10:12
  287 + */
  288 + public function saveCustomizedHtml(){
  289 + try {
  290 + $is_list = $this->param['is_list'] ?? 0;
  291 + $bTemplateMainModel = new BTemplateMain();
  292 + $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]);
  293 + if($mainInfo === false){
  294 + $mainData = [
  295 + 'project_id'=>$this->user['project_id'],
  296 + 'type'=>$this->param['type'],
  297 + 'is_list'=>$is_list,
  298 + 'main_html'=>$this->param['html']
  299 + ];
  300 + $bTemplateMainModel->add($mainData);
  301 + }else{
  302 + $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]);
  303 + }
  304 + }catch (\Exception $exception){
  305 + $this->fail('保存失败,请联系开发人员');
  306 + }
  307 + return $this->success();
  308 + }
  309 +}
1 -<?php  
2 -/**  
3 - * @remark :  
4 - * @name :VisualizationLogic.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2023/11/15 10:09  
8 - */  
9 -  
10 -namespace App\Http\Logic\Bside\BTemplate;  
11 -  
12 -use App\Http\Logic\Bside\BaseLogic;  
13 -use App\Models\Blog\Blog;  
14 -use App\Models\News\News;  
15 -use App\Models\Product\Product;  
16 -use App\Models\Project\PageSetting;  
17 -use App\Models\RouteMap\RouteMap;  
18 -use App\Models\Service\Service as ServiceSettingModel;  
19 -use App\Models\Template\BTemplate;  
20 -use App\Models\Template\BTemplateCommon;  
21 -use App\Models\Template\BTemplateLog;  
22 -use App\Models\Template\BTemplateMain;  
23 -use App\Models\Template\Setting;  
24 -use App\Models\Template\Template;  
25 -use App\Models\Template\TemplateTypeMain;  
26 -use App\Models\Visualization\Visualization;  
27 -  
28 -class VisualizationLogic extends BaseLogic  
29 -{  
30 - public function __construct()  
31 - {  
32 - parent::__construct();  
33 - $this->model = new BTemplateMain();  
34 - $this->param = $this->requestAll;  
35 - }  
36 -  
37 - /**  
38 - * @remark :获取代码块  
39 - * @name :getVisualizationInfo  
40 - * @author :lyh  
41 - * @method :post  
42 - * @time :2023/11/17 14:44  
43 - */  
44 - public function getVisualizationInfo(){  
45 - $bTemplateMainModel = new BTemplateMain();  
46 - $info = $bTemplateMainModel->read(['type'=>$this->param['type']]);  
47 - if($info === false){  
48 - $html = '';  
49 - }else{  
50 - $html = $info['main_html'];  
51 - }  
52 - return $this->success(['html'=>$html]);  
53 - }  
54 -  
55 - /**  
56 - * @remark :保存定制html  
57 - * @name :saveHtml  
58 - * @author :lyh  
59 - * @method :post  
60 - * @time :2023/11/15 10:12  
61 - */  
62 - public function saveVisualization(){  
63 - try {  
64 - $type = $this->param['type'];  
65 - $bTemplateMainModel = new BTemplateMain();  
66 - $mainInfo = $bTemplateMainModel->read(['type'=>$type]);  
67 - if($mainInfo === false){  
68 - $mainData = [  
69 - 'project_id'=>$this->user['project_id'],  
70 - 'type'=>$type,  
71 - 'main_html'=>$this->param['html']  
72 - ];  
73 - $bTemplateMainModel->add($mainData);  
74 - }else{  
75 - $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]);  
76 - }  
77 - }catch (\Exception $e){  
78 - $this->fail('系统错误,请联系管理员');  
79 - }  
80 - return $this->success();  
81 - }  
82 -}  
1 -<?php  
2 -  
3 -namespace App\Models\File;  
4 -  
5 -use App\Models\Base;  
6 -  
7 -class DataFile extends Base  
8 -{  
9 - protected $table = 'gl_data_file';  
10 -  
11 - public function saveData(array $data): bool  
12 - {  
13 - # v6项目ID  
14 - $project_id = (int)$data['project_id'] ?? 0;  
15 - $isRes = self::query()->where('project_id', $project_id)->where('created_at', 'like', $data['time'] . '%')->first();  
16 - if (!$isRes) {  
17 - $isRes = new self();  
18 - $isRes->project_id = $project_id;  
19 - # AICC用户ID  
20 - $isRes->user_id = $data['user_id'];  
21 - # 第三方朋友ID  
22 - $isRes->friend_id = $data['friend_id'];  
23 - # 生成文件路径  
24 - $isRes->file_path = $data['file_path'];  
25 - }  
26 - return $isRes->save();  
27 - }  
28 -  
29 - /**  
30 - * @param int $page  
31 - * @param int $perPage  
32 - * @return array  
33 - */  
34 - public function allData(int $page = 1, int $perPage = 15)  
35 - {  
36 - $lists = self::query()->paginate($perPage, ['*'], 'page', $page);  
37 - $items = $lists->Items();  
38 - $totalPage = $lists->lastPage();  
39 - $total = $lists->total();  
40 - $currentPage = $lists->currentPage();  
41 - return compact('total', 'items', 'totalPage', 'currentPage');  
42 - }  
43 -  
44 -}  
  1 +<?php
  2 +
  3 +namespace App\Models\File;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +/**
  8 + * App\Models\File\PdfFile
  9 + *
  10 + * @property int $id
  11 + * @property int $pid AICC用户ID
  12 + * @property string $file_path 生成文件路径
  13 + * @property int $is_pdf 0 - 未生成 1 - 已生成 2 - 其它问题
  14 + * @property int|null $is_push 0 - 未推送 1 - 已推送 2 - 其他问题
  15 + * @property \Illuminate\Support\Carbon|null $created_at
  16 + * @property \Illuminate\Support\Carbon|null $updated_at
  17 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile newModelQuery()
  18 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile newQuery()
  19 + * @method static \Illuminate\Database\Eloquent\Builder|PdfFile query()
  20 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereCreatedAt($value)
  21 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereFilePath($value)
  22 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereId($value)
  23 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereIsPdf($value)
  24 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereIsPush($value)
  25 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile wherePid($value)
  26 + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereUpdatedAt($value)
  27 + * @mixin \Eloquent
  28 + */
  29 +class PdfFile extends Base
  30 +{
  31 + protected $table = 'gl_pdf_file';
  32 +
  33 + /** @var int PDF - 未生成 */
  34 + const GENERATE_NOT_PDF = 0;
  35 +
  36 + /** @var int PDF - 已生成 */
  37 + const GENERATE_PDF = 1;
  38 +
  39 + /** @var int PDF - 其它问题 */
  40 + const GENERATE_OTHER_PDF = 2;
  41 +
  42 + /** @var int AICC - 未推送 */
  43 + const GENERATE_NOT_PUSH = 0;
  44 + /** @var int AICC - 已推送 */
  45 + const GENERATE_PUSH = 1;
  46 + /** @var int AICC - 其他问题 */
  47 + const GENERATE_OTHER_PUSH = 2;
  48 +
  49 + public function saveData(array $data): bool
  50 + {
  51 + # v6项目ID
  52 + $pid = (int)$data['pid'] ?? 0;
  53 + $time = $data['time'] ?? date('Y-m-d');
  54 + $isRes = self::query()->wherePid($pid)->where('created_at', 'like', $time . '%')->first();
  55 + if (!$isRes) {
  56 + $isRes = new self();
  57 + $isRes->pid = $pid;
  58 + # 生成文件路径
  59 + $isRes->file_path = $data['file_path'] ?? '';
  60 + }
  61 + return $isRes->save();
  62 + }
  63 +
  64 +}
@@ -5,10 +5,47 @@ namespace App\Models\ProjectAssociation; @@ -5,10 +5,47 @@ namespace App\Models\ProjectAssociation;
5 use Illuminate\Database\Eloquent\Builder; 5 use Illuminate\Database\Eloquent\Builder;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
  8 +/**
  9 + * App\Models\ProjectAssociation\ProjectAssociation
  10 + *
  11 + * @property int $id
  12 + * @property int $project_id V6项目ID
  13 + * @property int $friend_id AICC朋友ID
  14 + * @property int $user_id AICC用户ID
  15 + * @property string|null $nickname AICC朋友昵称
  16 + * @property string|null $user_name AICC用户姓名
  17 + * @property string|null $image AICC朋友头像
  18 + * @property int|null $status 1 - 正常, 0 - 禁用
  19 + * @property int|null $m_status 统计当月是否生成数据
  20 + * @property \Illuminate\Support\Carbon|null $created_at
  21 + * @property \Illuminate\Support\Carbon|null $updated_at
  22 + * @method Builder|ProjectAssociation newModelQuery()
  23 + * @method Builder|ProjectAssociation newQuery()
  24 + * @method static Builder|ProjectAssociation query()
  25 + * @method Builder|ProjectAssociation whereCreatedAt($value)
  26 + * @method Builder|ProjectAssociation whereFriendId($value)
  27 + * @method Builder|ProjectAssociation whereId($value)
  28 + * @method Builder|ProjectAssociation whereImage($value)
  29 + * @method Builder|ProjectAssociation whereMStatus($value)
  30 + * @method Builder|ProjectAssociation whereNickname($value)
  31 + * @method Builder|ProjectAssociation whereProjectId($value)
  32 + * @method Builder|ProjectAssociation whereStatus($value)
  33 + * @method Builder|ProjectAssociation whereUpdatedAt($value)
  34 + * @method Builder|ProjectAssociation whereUserId($value)
  35 + * @method Builder|ProjectAssociation whereUserName($value)
  36 + * @mixin \Eloquent
  37 + */
8 class ProjectAssociation extends Model 38 class ProjectAssociation extends Model
9 { 39 {
  40 +
10 protected $table = 'gl_project_association'; 41 protected $table = 'gl_project_association';
11 42
  43 + /** @var int 数据状态 - 正常 */
  44 + const STATUS_NORMAL = 1;
  45 +
  46 + /** @var int 数据状态 - 禁用 */
  47 + const STATUS_DISABLED = 0;
  48 +
12 /** 49 /**
13 * 保存|修改数据 50 * 保存|修改数据
14 * @param array $data 51 * @param array $data
@@ -36,8 +36,10 @@ class BTemplate extends Base @@ -36,8 +36,10 @@ class BTemplate extends Base
36 const TYPE_SEVEN = 7;//新闻列表 36 const TYPE_SEVEN = 7;//新闻列表
37 const TYPE_EIGHT = 8;//自定义页面 37 const TYPE_EIGHT = 8;//自定义页面
38 38
39 - const TYPE_CUSTOM_DETAIL = 11;//扩展详情  
40 - const TYPE_CUSTOM_LIST = 12;//扩展列表 39 + const TYPE_CUSTOM = 7;//扩展详情
  40 + const IS_LIST = 1;//列表页
  41 + const IS_HEADER = 1;//独立头部底部
  42 + const IS_NO_HEADER = 0;//非独立头部底部
41 43
42 protected $table = 'gl_web_template'; 44 protected $table = 'gl_web_template';
43 //连接数据库 45 //连接数据库
@@ -21,7 +21,7 @@ class CosService @@ -21,7 +21,7 @@ class CosService
21 * @method :post 21 * @method :post
22 * @time :2023/7/19 15:28 22 * @time :2023/7/19 15:28
23 */ 23 */
24 - public function uploadFile(&$files,$path,$filename) 24 + public function uploadFile(&$files,$path,$filename, $binary = false)
25 { 25 {
26 $cos = config('filesystems.disks.cos'); 26 $cos = config('filesystems.disks.cos');
27 $cosClient = new Client([ 27 $cosClient = new Client([
@@ -32,10 +32,11 @@ class CosService @@ -32,10 +32,11 @@ class CosService
32 ], 32 ],
33 ]); 33 ]);
34 $key = $path.'/'.$filename; 34 $key = $path.'/'.$filename;
  35 + $Body = $binary ? $files : fopen($files->getRealPath(), 'r');
35 $cosClient->putObject([ 36 $cosClient->putObject([
36 'Bucket' => $cos['bucket'], 37 'Bucket' => $cos['bucket'],
37 'Key' => $key, 38 'Key' => $key,
38 - 'Body' => fopen($files->getRealPath(), 'r'), 39 + 'Body' => $Body,
39 ]); 40 ]);
40 return $key; 41 return $key;
41 } 42 }
@@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
23 "swooletw/laravel-swoole": "^2.13" 23 "swooletw/laravel-swoole": "^2.13"
24 }, 24 },
25 "require-dev": { 25 "require-dev": {
  26 + "barryvdh/laravel-ide-helper": "^2.13",
26 "facade/ignition": "^2.5", 27 "facade/ignition": "^2.5",
27 "fakerphp/faker": "^1.9.1", 28 "fakerphp/faker": "^1.9.1",
28 "laravel/sail": "^1.0.1", 29 "laravel/sail": "^1.0.1",
@@ -73,6 +73,8 @@ Route::middleware(['aloginauth'])->group(function () { @@ -73,6 +73,8 @@ Route::middleware(['aloginauth'])->group(function () {
73 Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); 73 Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists');
74 // 绑定AICC微信应用 74 // 绑定AICC微信应用
75 Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat'); 75 Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat');
  76 + // OA后台开启关闭AICC用户绑定
  77 + Route::post('/check', [ProjectAssociationController::class, 'check'])->name('admin.aicc.check');
76 }); 78 });
77 //特殊模块权限设置 79 //特殊模块权限设置
78 Route::prefix('special')->group(function () { 80 Route::prefix('special')->group(function () {
@@ -306,6 +306,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -306,6 +306,7 @@ Route::middleware(['bloginauth'])->group(function () {
306 Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists'); 306 Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists');
307 //获取选中的主题模版 307 //获取选中的主题模版
308 Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate'); 308 Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate');
  309 + Route::any('/getTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTemplate'])->name('template_getTemplate');
309 //保存修改后的模版 310 //保存修改后的模版
310 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'save'])->name('template_save'); 311 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'save'])->name('template_save');
311 //可视化保存获取数据类型 312 //可视化保存获取数据类型
@@ -341,12 +342,12 @@ Route::middleware(['bloginauth'])->group(function () { @@ -341,12 +342,12 @@ Route::middleware(['bloginauth'])->group(function () {
341 }); 342 });
342 }); 343 });
343 344
344 - //定制项目上传代码块  
345 - Route::prefix('visualization')->group(function () {  
346 - Route::any('/info', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'info'])->name('visualization_info');  
347 - Route::any('/save', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'save'])->name('visualization_save');  
348 - Route::any('/getHtml', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'getHtml'])->name('visualization_getHtml');  
349 - Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'saveHtml'])->name('visualization_saveHtml'); 345 + //初始代码块
  346 + Route::prefix('init_html')->group(function () {
  347 + Route::any('/getCustomizedHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getCustomizedHtml'])->name('init_getCustomizedHtml');
  348 + Route::any('/saveCustomizedHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveCustomizedHtml'])->name('init_saveCustomizedHtml');
  349 + Route::any('/getDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getDetailHtml'])->name('init_getDetailHtml');
  350 + Route::any('/saveDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveDetailHtml'])->name('init_saveDetailHtml');
350 }); 351 });
351 352
352 // 自定义页面,专题页 353 // 自定义页面,专题页
@@ -434,6 +435,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -434,6 +435,7 @@ Route::middleware(['bloginauth'])->group(function () {
434 //自定义模板 435 //自定义模板
435 Route::prefix('custom_module')->group(function () { 436 Route::prefix('custom_module')->group(function () {
436 Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'lists'])->name('custom_lists'); 437 Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'lists'])->name('custom_lists');
  438 + Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'info'])->name('custom_info');
437 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'save'])->name('custom_save'); 439 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'save'])->name('custom_save');
438 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'del'])->name('custom_del'); 440 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'del'])->name('custom_del');
439 441
@@ -468,6 +470,7 @@ Route::group([], function () { @@ -468,6 +470,7 @@ Route::group([], function () {
468 Route::any('/login', [\App\Http\Controllers\Bside\LoginController::class, 'login'])->name('login'); 470 Route::any('/login', [\App\Http\Controllers\Bside\LoginController::class, 'login'])->name('login');
469 Route::any('/projectLogin', [\App\Http\Controllers\Bside\LoginController::class, 'projectLogin'])->name('projectLogin'); 471 Route::any('/projectLogin', [\App\Http\Controllers\Bside\LoginController::class, 'projectLogin'])->name('projectLogin');
470 Route::any('/ceshi', [\App\Http\Controllers\Bside\LoginController::class, 'ceshi'])->name('ceshi'); 472 Route::any('/ceshi', [\App\Http\Controllers\Bside\LoginController::class, 'ceshi'])->name('ceshi');
  473 + Route::any('/file_manager_downLoad', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'downLoad'])->name('file_manager_downLoad');
471 Route::any('/stringTranslation', [\App\Http\Controllers\Bside\LoginController::class, 'stringTranslation'])->name('stringTranslation'); 474 Route::any('/stringTranslation', [\App\Http\Controllers\Bside\LoginController::class, 'stringTranslation'])->name('stringTranslation');
472 Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\LoginController::class, 'sendLoginSms'])->name('sendLoginSms'); 475 Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\LoginController::class, 'sendLoginSms'])->name('sendLoginSms');
473 Route::any('/autologin', [\App\Http\Controllers\Bside\LoginController::class, 'autologin'])->name('autologin'); 476 Route::any('/autologin', [\App\Http\Controllers\Bside\LoginController::class, 'autologin'])->name('autologin');