作者 lyh

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6

正在显示 35 个修改的文件 包含 1140 行增加134 行删除
  1 +<?php
  2 +
  3 +namespace App\Console\Commands;
  4 +
  5 +use App\Http\Logic\Aside\Project\DomainInfoLogic;
  6 +use App\Models\Com\UpdateNotify;
  7 +use App\Models\Devops\DevopsTask as DevopsTaskModel;
  8 +use App\Models\Devops\DevopsTaskLog;
  9 +use App\Models\Domain\DomainInfo;
  10 +use App\Models\File\File;
  11 +use App\Models\File\Image;
  12 +use App\Models\Product\CategoryRelated;
  13 +use App\Models\Product\Product;
  14 +use App\Models\Project\Project;
  15 +use App\Models\RouteMap\RouteMap;
  16 +use App\Models\Template\BCustomTemplate;
  17 +use App\Services\ProjectServer;
  18 +use Illuminate\Console\Command;
  19 +use Illuminate\Database\QueryException;
  20 +use Illuminate\Support\Facades\DB;
  21 +
  22 +/**
  23 + * 测试
  24 + * Class Traffic
  25 + * @package App\Console\Commands
  26 + * @author zbj
  27 + * @date 2023/5/18
  28 + */
  29 +class Test extends Command
  30 +{
  31 + /**
  32 + * The name and signature of the console command.
  33 + *
  34 + * @var string
  35 + */
  36 + protected $signature = 'test';
  37 +
  38 + /**
  39 + * The console command description.
  40 + *
  41 + * @var string
  42 + */
  43 + protected $description = '测试';
  44 +
  45 + /**
  46 + * Create a new command instance.
  47 + *
  48 + * @return void
  49 + */
  50 + public function __construct()
  51 + {
  52 + parent::__construct();
  53 + }
  54 +
  55 + /**
  56 + * @return bool
  57 + */
  58 + public function handle()
  59 + {
  60 + $projects = Project::all();
  61 + foreach ($projects as $project){
  62 + echo "project " . $project->id;
  63 +
  64 + if(!ProjectServer::useProject($project->id)){
  65 + echo '-->' . '未配置数据库' . PHP_EOL;
  66 + continue;
  67 + }
  68 +
  69 + try {
  70 + $page = BCustomTemplate::where('url', '404')->first();
  71 + if(!$page){
  72 + $page = new BCustomTemplate();
  73 + }
  74 + $page->project_id = $project->id;
  75 + $page->name = '404';
  76 + $page->status = 1;
  77 + $page->url = '404';
  78 + $page->html = '<main>
  79 + <section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
  80 + id="sectionIdyxqu938">
  81 + <div class="layout" data-unable="demo01-error404">
  82 + <img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
  83 + </div>
  84 + <p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>
  85 + <style>
  86 + .section-block-error404 .layout {
  87 + height: 700px;
  88 + display: flex;
  89 + align-items: center;
  90 + justify-content: center;
  91 + }
  92 + .section-block-error404 img {
  93 + width: 400px;
  94 + }
  95 + @media only screen and (max-width:500) {
  96 + .section-block-error404 img {
  97 + max-width: 100%;
  98 + }
  99 + }
  100 + </style>
  101 + <script>
  102 + </script>
  103 + </section>
  104 + </main>';
  105 + $page->html_style = '<style id="globalsojs-styles"></style>';
  106 + $page->description = 'Sorry. The page has either moved or cannot be found.';
  107 + $page->title = '404-Page not found';
  108 + $page->save();
  109 +
  110 + $domain = (new DomainInfo())->getDomain($project['deploy_optimize']['domain']);
  111 + $url = $domain.'api/delHtml/?project_id='.$project->id.'&route=404';
  112 + curlGet($url);
  113 + }catch (QueryException | \Exception $e){
  114 + echo '-->' . $e->getMessage() . PHP_EOL;
  115 + continue;
  116 + }
  117 + echo '-->成功:' . PHP_EOL;
  118 + }
  119 + }
  120 +
  121 +}
@@ -3,6 +3,10 @@ @@ -3,6 +3,10 @@
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
5 use App\Helper\Common; 5 use App\Helper\Common;
  6 +use App\Helper\Translate;
  7 +use App\Models\Ai\AiCommand as AiCommandModel;
  8 +use App\Models\Project\DeployOptimize;
  9 +use App\Models\Project\Project;
6 use App\Services\ProjectServer; 10 use App\Services\ProjectServer;
7 use Illuminate\Console\Command; 11 use Illuminate\Console\Command;
8 use Illuminate\Support\Facades\DB; 12 use Illuminate\Support\Facades\DB;
@@ -57,17 +61,19 @@ class UpdateSeoTdk extends Command @@ -57,17 +61,19 @@ class UpdateSeoTdk extends Command
57 try { 61 try {
58 ProjectServer::useProject($project_id); 62 ProjectServer::useProject($project_id);
59 $this->updateProduct($project_id); 63 $this->updateProduct($project_id);
  64 + $this->updateProductCate($project_id);
60 $this->updateBlogs($project_id); 65 $this->updateBlogs($project_id);
  66 + $this->updateBlogCate($project_id);
61 $this->updateNews($project_id); 67 $this->updateNews($project_id);
  68 + $this->updateNewsCate($project_id);
  69 + $this->updatePage($project_id);
62 DB::disconnect('custom_mysql'); 70 DB::disconnect('custom_mysql');
63 }catch (\Exception $e){ 71 }catch (\Exception $e){
64 echo date('Y-m-d H:i:s') . ' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL; 72 echo date('Y-m-d H:i:s') . ' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
65 } 73 }
66 -  
67 echo date('Y-m-d H:i:s') . ' end: ' . $project_id . PHP_EOL; 74 echo date('Y-m-d H:i:s') . ' end: ' . $project_id . PHP_EOL;
68 } 75 }
69 } 76 }
70 -  
71 /** 77 /**
72 * @remark :更新产品tdk 78 * @remark :更新产品tdk
73 * @name :updateProduct 79 * @name :updateProduct
@@ -83,20 +89,64 @@ class UpdateSeoTdk extends Command @@ -83,20 +89,64 @@ class UpdateSeoTdk extends Command
83 $seo_arr = json_decode($v['seo_mate'], true) ?: []; 89 $seo_arr = json_decode($v['seo_mate'], true) ?: [];
84 //更新seo_title 90 //更新seo_title
85 if(!isset($seo_arr['title'])){ 91 if(!isset($seo_arr['title'])){
  92 + $setting = DB::connection('custom_mysql')->table('gl_web_setting_seo')->where(['project_id'=>$project_id])->first();
86 //生成seo_title 93 //生成seo_title
87 - $seo_arr['title'] = $this->ai_send('product_seo_title',$v['title']); 94 + if(!empty($setting['product_prefix']) && !empty($setting['product_suffix'])){
  95 + $seo_arr['title'] = $setting['product_prefix'] . '-' . $seo_arr['title'] . '-' . $setting['product_suffix'];
  96 + }else{
  97 + $seo_arr['title'] = $this->ai_send('seo_title',$seo_arr['title']);
  98 + }
88 } 99 }
89 //更新seo_keyword 100 //更新seo_keyword
90 if(!isset($seo_arr['keyword'])){ 101 if(!isset($seo_arr['keyword'])){
91 - $seo_arr['keyword'] = $this->ai_send('product_seo_keyword',$v['title']); 102 + $seo_arr['keyword'] = $this->ai_send('seo_keywords',$v['title']);
92 } 103 }
93 //更新seo_keyword 104 //更新seo_keyword
94 if(!isset($seo_arr['description'])){ 105 if(!isset($seo_arr['description'])){
95 - $seo_arr['description'] = $this->ai_send('product_seo_description',$v['title']); 106 + $seo_arr['description'] = $this->ai_send('seo_meta_description',$v['title']);
96 } 107 }
97 $ser_str = json_encode($seo_arr,true); 108 $ser_str = json_encode($seo_arr,true);
98 DB::connection('custom_mysql')->table('gl_product')->where(['id'=>$v['id']])->update(['seo_mate'=>$ser_str]); 109 DB::connection('custom_mysql')->table('gl_product')->where(['id'=>$v['id']])->update(['seo_mate'=>$ser_str]);
99 } 110 }
  111 +
  112 + }
  113 + return true;
  114 + }
  115 +
  116 + /**
  117 + * @remark :更新产品tdk
  118 + * @name :updateProduct
  119 + * @author :lyh
  120 + * @method :post
  121 + * @time :2023/8/19 9:25
  122 + */
  123 + public function updateProductCate($project_id){
  124 + $list = DB::connection('custom_mysql')->table('gl_product_category')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
  125 + if(!empty($list)){
  126 + foreach ($list as $v){
  127 + $v = (array)$v;
  128 + $data = [];
  129 + if(empty($v['seo_title'])){
  130 + $setting = DB::connection('custom_mysql')->table('gl_web_setting_seo')->where(['project_id'=>$project_id])->first();
  131 + //生成seo_title
  132 + if(!empty($setting['product_cate_prefix']) && !empty($setting['product_cate_suffix'])){
  133 + $data['seo_title'] = $setting['product_cate_prefix'] . '-' . $v['title'] . '-' . $setting['product_cate_suffix'];
  134 + }else{
  135 + $data['seo_title'] = $this->ai_send('seo_title',$v['title']);
  136 + }
  137 + }
  138 + if(empty($v['seo_keywords'])){
  139 + $data['seo_keywords'] = $this->ai_send('seo_keywords',$v['title']);
  140 + }
  141 + if(empty($v['seo_des'])){
  142 + $name = $this->companyName($project_id);
  143 + $data['seo_des'] = $this->ai_send('page_meta_description',$v['title'],$name);
  144 + }
  145 + if(!$data){
  146 + continue;
  147 + }
  148 + DB::connection('custom_mysql')->table('gl_product_category')->where(['id'=>$v['id']])->update($data);
  149 + }
100 } 150 }
101 return true; 151 return true;
102 } 152 }
@@ -115,13 +165,19 @@ class UpdateSeoTdk extends Command @@ -115,13 +165,19 @@ class UpdateSeoTdk extends Command
115 $v = (array)$v; 165 $v = (array)$v;
116 $data = []; 166 $data = [];
117 if(empty($v['seo_title'])){ 167 if(empty($v['seo_title'])){
118 - $data['seo_title'] = $this->ai_send('news_seo_title',$v['name']); 168 + $setting = DB::connection('custom_mysql')->table('gl_web_setting_seo')->where(['project_id'=>$project_id])->first();
  169 + //生成seo_title
  170 + if(!empty($setting['single_page_suffix'])){
  171 + $data['seo_title'] = $v['name'] . '-' . $setting['single_page_suffix'];
  172 + }else{
  173 + $data['seo_title'] = $this->ai_send('seo_title',$v['name']);
  174 + }
119 } 175 }
120 if(empty($v['seo_keywords'])){ 176 if(empty($v['seo_keywords'])){
121 - $data['seo_keywords'] = $this->ai_send('news_seo_keyword',$v['name']); 177 + $data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
122 } 178 }
123 if(empty($v['seo_description'])){ 179 if(empty($v['seo_description'])){
124 - $data['seo_description'] = $this->ai_send('news_seo_description',$v['name']); 180 + $data['seo_description'] = $this->ai_send('seo_meta_description',$v['name']);
125 } 181 }
126 if(!$data){ 182 if(!$data){
127 continue; 183 continue;
@@ -133,6 +189,44 @@ class UpdateSeoTdk extends Command @@ -133,6 +189,44 @@ class UpdateSeoTdk extends Command
133 } 189 }
134 190
135 /** 191 /**
  192 + * @remark :更新新闻Tdk
  193 + * @name :updateNews
  194 + * @author :lyh
  195 + * @method :post
  196 + * @time :2023/8/19 10:06
  197 + */
  198 + public function updateNewsCate($project_id){
  199 + $list = DB::connection('custom_mysql')->table('gl_news_category')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
  200 + if(!empty($list)){
  201 + foreach ($list as $k => $v){
  202 + $v = (array)$v;
  203 + $data = [];
  204 + if(empty($v['seo_title'])){
  205 + $setting = DB::connection('custom_mysql')->table('gl_web_setting_seo')->where(['project_id'=>$project_id])->first();
  206 + //生成seo_title
  207 + if(!empty($setting['single_page_suffix'])){
  208 + $data['seo_title'] = $v['name'] . '-' . $setting['single_page_suffix'];
  209 + }else{
  210 + $data['seo_title'] = $this->ai_send('seo_title',$v['name']);
  211 + }
  212 + }
  213 + if(empty($v['seo_keywords'])){
  214 + $data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
  215 + }
  216 + if(empty($v['seo_des'])){
  217 + $name = $this->companyName($project_id);
  218 + $data['seo_des'] = $this->ai_send('page_meta_description',$v['title'],$name);
  219 + }
  220 + if(!$data){
  221 + continue;
  222 + }
  223 + DB::connection('custom_mysql')->table('gl_news_category')->where(['id'=>$v['id']])->update($data);
  224 + }
  225 + }
  226 + return true;
  227 + }
  228 +
  229 + /**
136 * @remark :更新blogTdk 230 * @remark :更新blogTdk
137 * @name :updateBlogs 231 * @name :updateBlogs
138 * @author :lyh 232 * @author :lyh
@@ -146,13 +240,19 @@ class UpdateSeoTdk extends Command @@ -146,13 +240,19 @@ class UpdateSeoTdk extends Command
146 $v = (array)$v; 240 $v = (array)$v;
147 $data = []; 241 $data = [];
148 if(empty($v['seo_title'])){ 242 if(empty($v['seo_title'])){
149 - $data['seo_title'] = $this->ai_send('blog_seo_title',$v['name']); 243 + $setting = DB::connection('custom_mysql')->table('gl_web_setting_seo')->where(['project_id'=>$project_id])->first();
  244 + //生成seo_title
  245 + if(!empty($setting['single_page_suffix'])){
  246 + $data['seo_title'] = $v['name'] . '-' . $setting['single_page_suffix'];
  247 + }else{
  248 + $data['seo_title'] = $this->ai_send('seo_title',$v['name']);
  249 + }
150 } 250 }
151 if(empty($v['seo_keywords'])){ 251 if(empty($v['seo_keywords'])){
152 - $data['seo_keywords'] = $this->ai_send('blog_seo_keyword',$v['name']); 252 + $data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
153 } 253 }
154 if(empty($v['seo_description'])){ 254 if(empty($v['seo_description'])){
155 - $data['seo_description'] = $this->ai_send('blog_seo_description',$v['name']); 255 + $data['seo_description'] = $this->ai_send('seo_meta_description',$v['name']);
156 } 256 }
157 if(!$data){ 257 if(!$data){
158 continue; 258 continue;
@@ -164,19 +264,134 @@ class UpdateSeoTdk extends Command @@ -164,19 +264,134 @@ class UpdateSeoTdk extends Command
164 } 264 }
165 265
166 /** 266 /**
  267 + * @remark :更新新闻Tdk
  268 + * @name :updateNews
  269 + * @author :lyh
  270 + * @method :post
  271 + * @time :2023/8/19 10:06
  272 + */
  273 + public function updateBlogCate($project_id){
  274 + $list = DB::connection('custom_mysql')->table('gl_blog_category')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
  275 + if(!empty($list)){
  276 + foreach ($list as $k => $v){
  277 + $v = (array)$v;
  278 + $data = [];
  279 + if(empty($v['seo_title'])){
  280 + $setting = DB::connection('custom_mysql')->table('gl_web_setting_seo')->where(['project_id'=>$project_id])->first();
  281 + //生成seo_title
  282 + if(!empty($setting['single_page_suffix'])){
  283 + $data['seo_title'] = $v['name'] . '-' . $setting['single_page_suffix'];
  284 + }else{
  285 + $data['seo_title'] = $this->ai_send('seo_title',$v['name']);
  286 + }
  287 + }
  288 + if(empty($v['seo_keywords'])){
  289 + $data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
  290 + }
  291 + if(empty($v['seo_des'])){
  292 + $name = $this->companyName($project_id);
  293 + $data['seo_des'] = $this->ai_send('page_meta_description',$v['title'],$name);
  294 + }
  295 + if(!$data){
  296 + continue;
  297 + }
  298 + DB::connection('custom_mysql')->table('gl_blog_category')->where(['id'=>$v['id']])->update($data);
  299 + }
  300 + }
  301 + return true;
  302 + }
  303 +
  304 + /**
  305 + * @remark :单页面更新tdk
  306 + * @name :updatePage
  307 + * @author :lyh
  308 + * @method :post
  309 + * @time :2023/10/30 11:04
  310 + */
  311 + public function updatePage($project_id){
  312 + $list = DB::connection('custom_mysql')->table('gl_web_custom_template')->select(['id','title','keywords','description','project_id'])->where(['project_id'=>$project_id])->get()->toArray();
  313 + if(!empty($list)){
  314 + foreach ($list as $v){
  315 + $v = (array)$v;
  316 + $data = [];
  317 + if(empty($v['seo_title'])){
  318 + $setting = DB::connection('custom_mysql')->table('gl_web_setting_seo')->where(['project_id'=>$project_id])->first();
  319 + //生成seo_title
  320 + if(!empty($setting['single_page_suffix'])){
  321 + $data['title'] = $v['title'] . '-' . $setting['single_page_suffix'];
  322 + }else{
  323 + $data['title'] = $this->ai_send('seo_title',$v['title']);
  324 + }
  325 + }
  326 + if(empty($v['keywords'])){
  327 + //获取核心关键词
  328 + $main_keyword = $this->mainKeywords($project_id);
  329 + if(!empty($main_keyword)){
  330 + $data['keywords'] = $this->ai_send('seo_keywords',$main_keyword);
  331 + }else{
  332 + $data['keywords'] = $this->ai_send('seo_keywords',$v['title']);
  333 + }
  334 + }
  335 + if(empty($v['description'])){
  336 + $name = $this->companyName($project_id);
  337 + $data['description'] = $this->ai_send('page_meta_description',$v['title'],$name);
  338 + }
  339 + if(!$data){
  340 + continue;
  341 + }
  342 + DB::connection('custom_mysql')->table('gl_web_custom_template')->where(['id'=>$v['id']])->update($data);
  343 + }
  344 + }
  345 + }
  346 +
  347 + /**
  348 + * @remark :获取公司名称
  349 + * @name :companyName
  350 + * @author :lyh
  351 + * @method :post
  352 + * @time :2023/10/30 11:22
  353 + */
  354 + public function companyName($project_id){
  355 + $projectModel = new Project();
  356 + $info = $projectModel->read(['id'=>$project_id],['id','company']);
  357 + return $info['company'];
  358 + }
  359 +
  360 + /**
  361 + * @remark :获取公司核心关键词
  362 + * @name :mainKeywords
  363 + * @author :lyh
  364 + * @method :post
  365 + * @time :2023/10/30 11:22
  366 + */
  367 + public function mainKeywords($project_id){
  368 + $str = '';
  369 + $projectOptimizeModel = new DeployOptimize();
  370 + $info = $projectOptimizeModel->read(['project_id'=>$project_id],['id','main_keywords']);
  371 + if($info === false){
  372 + $arr = explode(',',$info['main_keywords']);
  373 + if(isset($arr[0])){
  374 + $str = $arr[0];
  375 + }
  376 + }
  377 + return $str;
  378 + }
  379 +
  380 + /**
167 * @remark :AI发送 381 * @remark :AI发送
168 * @name :ai_send 382 * @name :ai_send
169 * @author :lyh 383 * @author :lyh
170 * @method :post 384 * @method :post
171 * @time :2023/8/19 10:40 385 * @time :2023/8/19 10:40
172 */ 386 */
173 - public function ai_send($key,$keywords){  
174 - $chat_url = 'v2/openai_chat'; 387 + public function ai_send($key,$keywords,$name = ''){
  388 + $chat_url = 'v2/openai_chat_qqs';
175 $param = [ 389 $param = [
176 'key'=>$key, 390 'key'=>$key,
177 'keywords'=>$keywords, 391 'keywords'=>$keywords,
178 ]; 392 ];
179 - $data = Common::send_openai_msg($chat_url,$param); 393 + $data = Common::send_openai_msg($chat_url,$param,$name);
180 return $data['text']; 394 return $data['text'];
181 } 395 }
  396 +
182 } 397 }
@@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel @@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel
24 $schedule->command('rank_data_indexed_pages')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次 24 $schedule->command('rank_data_indexed_pages')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
25 $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次 25 $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
26 $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 26 $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
27 - $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 27 +// $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
28 $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 28 $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
29 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 29 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
30 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 30 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Helper; 3 namespace App\Helper;
4 4
5 use App\Models\Ai\AiCommand as AiCommandModel; 5 use App\Models\Ai\AiCommand as AiCommandModel;
  6 +use App\Models\Project\Project;
6 use App\Models\User\UserLog as UserLogModel; 7 use App\Models\User\UserLog as UserLogModel;
7 use App\Models\User\UserLogin as UserLoginModel; 8 use App\Models\User\UserLogin as UserLoginModel;
8 use Illuminate\Encryption\Encrypter; 9 use Illuminate\Encryption\Encrypter;
@@ -54,7 +55,7 @@ class Common @@ -54,7 +55,7 @@ class Common
54 * @author :liyuhang 55 * @author :liyuhang
55 * @method 56 * @method
56 */ 57 */
57 - public static function send_openai_msg($url,$param){ 58 + public static function send_openai_msg($url,$param,$name = ''){
58 $url = HTTP_OPENAI_URL.$url; 59 $url = HTTP_OPENAI_URL.$url;
59 $aiCommandModel = New AiCommandModel(); 60 $aiCommandModel = New AiCommandModel();
60 //指定库获取指令 61 //指定库获取指令
@@ -79,6 +80,8 @@ class Common @@ -79,6 +80,8 @@ class Common
79 $str = 'Please answer in '.$lang; 80 $str = 'Please answer in '.$lang;
80 //替换关键字 81 //替换关键字
81 $content = str_replace('$keyword$', $param['keywords'], $info['ai']); 82 $content = str_replace('$keyword$', $param['keywords'], $info['ai']);
  83 + //$company$变量时替换为公司名
  84 + $content = str_replace('$company$', $name , $content);
82 $data = [ 85 $data = [
83 'messages'=>[ 86 'messages'=>[
84 // ['role'=>'system','content'=>$info['scene']], 87 // ['role'=>'system','content'=>$info['scene']],
@@ -183,4 +186,38 @@ class Common @@ -183,4 +186,38 @@ class Common
183 return $crypt->decrypt($string); 186 return $crypt->decrypt($string);
184 } 187 }
185 188
  189 + //处理关键词
  190 + public function deal_keywords($data){
  191 + $str = ['1. ','2. ','3. ','4. ','5. ','6. ','7. ','8. ','1) ','2) ','3) ','4) ','5) ','6) ','7) ','7) ','8) '];
  192 + $ar_keywords_t = explode("\n",$data);
  193 + $ar_keywords = [];
  194 + foreach ($ar_keywords_t as $v){
  195 + if(trim($v)){
  196 + $keyword = trim($v);
  197 + if(strpos($keyword,'search keyword') !== false){
  198 + $tmp_first = explode('1. ',$keyword);
  199 + if(count($tmp_first) > 1){
  200 + $keyword = $tmp_first[1];
  201 + }else{
  202 + $tmp_first = explode('1) ',$keyword);
  203 + if(count($tmp_first) > 1){
  204 + $keyword = $tmp_first[1];
  205 + }
  206 + }
  207 + }
  208 + $keyword = str_replace($str,'',$keyword);
  209 + $keyword = trim($keyword,'.');
  210 + if(strpos(strtolower($keyword),'hope') === false && strpos(strtolower($keyword),'remember') === false && strpos(strtolower($keyword),'help') === false && strpos(strtolower($keyword),'website') === false && strpos(strtolower($keyword),'search keywords') === false && strpos(strtolower($keyword),'here are 8') === false && strpos(strtolower($keyword),'search keywords') === false && strpos(strtolower($keyword),'thank you') === false && strpos(strtolower($keyword),'thanks') === false && strpos(strtolower($keyword),'copywriter') === false ){
  211 + $ar_keywords[] = $keyword;
  212 + }
  213 + }
  214 + }
  215 + return implode(',',$ar_keywords);
  216 + }
  217 +
  218 +
  219 +//过滤特殊字符
  220 + public function deal_str($str){
  221 + return str_replace(['{','}','”','“','"'],'',$str);
  222 + }
186 } 223 }
@@ -5,7 +5,9 @@ namespace App\Http\Controllers\Aside; @@ -5,7 +5,9 @@ namespace App\Http\Controllers\Aside;
5 5
6 use App\Enums\Common\Code; 6 use App\Enums\Common\Code;
7 use App\Http\Logic\Aside\LoginLogic; 7 use App\Http\Logic\Aside\LoginLogic;
  8 +use App\Models\Domain\DomainInfo;
8 use App\Models\Manage\Manage; 9 use App\Models\Manage\Manage;
  10 +use App\Models\Project\Project;
9 use App\Models\Sms\SmsLog; 11 use App\Models\Sms\SmsLog;
10 use App\Rules\Mobile; 12 use App\Rules\Mobile;
11 use Illuminate\Http\Request; 13 use Illuminate\Http\Request;
@@ -98,5 +100,4 @@ class LoginController extends BaseController @@ -98,5 +100,4 @@ class LoginController extends BaseController
98 SmsLog::createLog($mobile, $code['code'],SmsLog::TYPE_MANAGER_LOGIN); 100 SmsLog::createLog($mobile, $code['code'],SmsLog::TYPE_MANAGER_LOGIN);
99 $this->response('success'); 101 $this->response('success');
100 } 102 }
101 -  
102 } 103 }
@@ -672,4 +672,6 @@ class ProjectController extends BaseController @@ -672,4 +672,6 @@ class ProjectController extends BaseController
672 $lists = $renewLog->lists($this->map,$this->page,$this->row,$this->order); 672 $lists = $renewLog->lists($this->map,$this->page,$this->row,$this->order);
673 $this->response('success',Code::SUCCESS,$lists); 673 $this->response('success',Code::SUCCESS,$lists);
674 } 674 }
  675 +
  676 +
675 } 677 }
@@ -53,4 +53,5 @@ class AiCommandController extends BaseController @@ -53,4 +53,5 @@ class AiCommandController extends BaseController
53 $aiLog = new AiLog(); 53 $aiLog = new AiLog();
54 return $aiLog->add($param); 54 return $aiLog->add($param);
55 } 55 }
  56 +
56 } 57 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :PageSettingController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/10/21 15:25
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\BCom;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\Project\PageSetting;
  15 +
  16 +class PageSettingController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :根据项目设置获取页面是否使用公共头部底部
  20 + * @name :read
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2023/10/21 15:26
  24 + */
  25 + public function info(){
  26 + $pageSettingModel = new PageSetting();
  27 + $info = $pageSettingModel->read(['project_id'=>$this->user['project_id']]);
  28 + if($info === false){
  29 + $info = [
  30 + 'project_id'=>$this->user['project_id'],
  31 + 'product_list'=>0,
  32 + 'product_details'=>0,
  33 + 'page_keyword'=>0,
  34 + 'blog_lists'=>0,
  35 + 'blog_details'=>0,
  36 + 'news_list'=>0,
  37 + 'news_details'=>0,
  38 + 'polymerization'=>0,
  39 + ];
  40 + $pageSettingModel->add($info);
  41 + }
  42 + $this->response('success',Code::SUCCESS,$info);
  43 + }
  44 +
  45 + /**
  46 + * @remark :设置是否使用公共头和底
  47 + * @name :edit
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2023/10/21 15:36
  51 + */
  52 + public function edit(){
  53 + $pageSettingModel = new PageSetting();
  54 + $rs = $pageSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]);
  55 + if($rs === false){
  56 + $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR);
  57 + }
  58 + $this->response('success');
  59 + }
  60 +}
@@ -21,13 +21,13 @@ class BlogCategoryController extends BaseController @@ -21,13 +21,13 @@ class BlogCategoryController extends BaseController
21 //搜索条件 21 //搜索条件
22 $this->map['project_id'] = $this->user['project_id']; 22 $this->map['project_id'] = $this->user['project_id'];
23 $filed = ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at']; 23 $filed = ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at'];
24 - $lists = $blogCategoryModel->list($this->map,$this->order,$filed); 24 + $lists = $blogCategoryModel->list($this->map,$this->order = ['sort','id'],$filed);
25 $data = []; 25 $data = [];
26 if(!empty($lists)){ 26 if(!empty($lists)){
27 $blogModel = new BlogModel(); 27 $blogModel = new BlogModel();
28 foreach ($lists as $k => $v){ 28 foreach ($lists as $k => $v){
29 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 29 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
30 - $v['url'] = $this->user['domain'] . RouteMap::PATH_BLOG_CATE . '/' . $v['alias']; 30 + $v['url'] = $this->user['domain'] . $v['alias'].'/';
31 $lists[$k] = $v; 31 $lists[$k] = $v;
32 } 32 }
33 if(!isset($this->map['name'])){ 33 if(!isset($this->map['name'])){
@@ -35,7 +35,7 @@ class BlogController extends BaseController @@ -35,7 +35,7 @@ class BlogController extends BaseController
35 $user = new User(); 35 $user = new User();
36 foreach ($lists['list'] as $k => $v){ 36 foreach ($lists['list'] as $k => $v){
37 $v['category_name'] = $this->categoryName($v['category_id'],$data); 37 $v['category_name'] = $this->categoryName($v['category_id'],$data);
38 - $v['url'] = $this->user['domain'] .$v['url']; 38 + $v['url'] = $this->user['domain'] .$v['url'].'/';
39 $v['image_link'] = getImageUrl($v['image']); 39 $v['image_link'] = getImageUrl($v['image']);
40 $v['operator_name'] = $user->getName($v['operator_id']); 40 $v['operator_name'] = $user->getName($v['operator_id']);
41 $lists['list'][$k] = $v; 41 $lists['list'][$k] = $v;
@@ -65,6 +65,9 @@ class BlogController extends BaseController @@ -65,6 +65,9 @@ class BlogController extends BaseController
65 if(isset($this->map['status'])){ 65 if(isset($this->map['status'])){
66 $query = $query->where('status',$this->map['status']); 66 $query = $query->where('status',$this->map['status']);
67 } 67 }
  68 + if(isset($this->map['name']) && !empty($this->map['name'])){
  69 + $query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
  70 + }
68 if(!empty($this->map['start_at']) && !empty($this->map['end_at'])){ 71 if(!empty($this->map['start_at']) && !empty($this->map['end_at'])){
69 $query->whereBetween('created_at', [$this->map['start_at'],$this->map['end_at']]); 72 $query->whereBetween('created_at', [$this->map['start_at'],$this->map['end_at']]);
70 } 73 }
@@ -16,6 +16,7 @@ use App\Helper\Common; @@ -16,6 +16,7 @@ use App\Helper\Common;
16 use App\Helper\Translate; 16 use App\Helper\Translate;
17 use App\Helper\Wechat; 17 use App\Helper\Wechat;
18 use App\Http\Logic\Bside\User\UserLoginLogic; 18 use App\Http\Logic\Bside\User\UserLoginLogic;
  19 +use App\Models\Domain\DomainInfo;
19 use App\Models\Project\Project; 20 use App\Models\Project\Project;
20 use App\Models\Service\Service; 21 use App\Models\Service\Service;
21 use App\Models\Sms\SmsLog; 22 use App\Models\Sms\SmsLog;
@@ -293,5 +294,4 @@ class LoginController extends BaseController @@ -293,5 +294,4 @@ class LoginController extends BaseController
293 } 294 }
294 return $data; 295 return $data;
295 } 296 }
296 -  
297 } 297 }
@@ -21,13 +21,13 @@ class NewsCategoryController extends BaseController @@ -21,13 +21,13 @@ class NewsCategoryController extends BaseController
21 //搜索条件 21 //搜索条件
22 $this->map['project_id'] = $this->user['project_id']; 22 $this->map['project_id'] = $this->user['project_id'];
23 $filed = ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at']; 23 $filed = ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at'];
24 - $lists = $newsCategory->list($this->map,$this->order,$filed); 24 + $lists = $newsCategory->list($this->map,$this->order = ['sort','id'],$filed);
25 $data = []; 25 $data = [];
26 if(!empty($lists)){ 26 if(!empty($lists)){
27 $newsModel = new NewsModel(); 27 $newsModel = new NewsModel();
28 foreach ($lists as $k => $v){ 28 foreach ($lists as $k => $v){
29 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 29 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
30 - $v['url'] = $this->user['domain'] . RouteMap::PATH_BLOG_CATE . '/' . $v['alias']; 30 + $v['url'] = $this->user['domain'] . $v['alias'].'/';
31 $lists[$k] = $v; 31 $lists[$k] = $v;
32 } 32 }
33 if(!isset($this->map['name'])){ 33 if(!isset($this->map['name'])){
@@ -35,7 +35,7 @@ class NewsController extends BaseController @@ -35,7 +35,7 @@ class NewsController extends BaseController
35 $user = new User(); 35 $user = new User();
36 foreach ($lists['list'] as $k => $v){ 36 foreach ($lists['list'] as $k => $v){
37 $v['category_name'] = $this->categoryName($v['category_id'],$data); 37 $v['category_name'] = $this->categoryName($v['category_id'],$data);
38 - $v['url'] = $this->user['domain'] .$v['url']; 38 + $v['url'] = $this->user['domain'] .$v['url'].'/';
39 $v['image_link'] = getImageUrl($v['image']); 39 $v['image_link'] = getImageUrl($v['image']);
40 $v['operator_name'] = $user->getName($v['operator_id']); 40 $v['operator_name'] = $user->getName($v['operator_id']);
41 $lists['list'][$k] = $v; 41 $lists['list'][$k] = $v;
@@ -65,6 +65,9 @@ class NewsController extends BaseController @@ -65,6 +65,9 @@ class NewsController extends BaseController
65 if(isset($this->map['status'])){ 65 if(isset($this->map['status'])){
66 $query = $query->where('status',$this->map['status']); 66 $query = $query->where('status',$this->map['status']);
67 } 67 }
  68 + if(isset($this->map['name']) && !empty($this->map['name'])){
  69 + $query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
  70 + }
68 if(!empty($this->map['start_at']) && !empty($this->map['end_at'])){ 71 if(!empty($this->map['start_at']) && !empty($this->map['end_at'])){
69 $query->whereBetween('created_at', [$this->map['start_at'],$this->map['end_at']]); 72 $query->whereBetween('created_at', [$this->map['start_at'],$this->map['end_at']]);
70 } 73 }
@@ -37,7 +37,7 @@ class CategoryController extends BaseController @@ -37,7 +37,7 @@ class CategoryController extends BaseController
37 $data = []; 37 $data = [];
38 if(!empty($list)){ 38 if(!empty($list)){
39 foreach ($list as $k =>$v){ 39 foreach ($list as $k =>$v){
40 - $v['url'] = $this->user['domain'] . $v['route']; 40 + $v['url'] = $this->user['domain'] . $v['route'].'/';
41 $v['product_num'] = Category::getProductNum($v['id']); 41 $v['product_num'] = Category::getProductNum($v['id']);
42 $v['image_link'] = getImageUrl($v['image']); 42 $v['image_link'] = getImageUrl($v['image']);
43 $list[$k] = $v; 43 $list[$k] = $v;
@@ -46,7 +46,7 @@ class KeywordController extends BaseController @@ -46,7 +46,7 @@ class KeywordController extends BaseController
46 }else{ 46 }else{
47 $v['tdk'] = 0; 47 $v['tdk'] = 0;
48 } 48 }
49 - $v['url'] = $this->user['domain'] . $v['route']; 49 + $v['url'] = $this->user['domain'] . $v['route'].'/';
50 } 50 }
51 } 51 }
52 return $this->response('success',Code::SUCCESS,$data); 52 return $this->response('success',Code::SUCCESS,$data);
@@ -65,8 +65,8 @@ class KeywordController extends BaseController @@ -65,8 +65,8 @@ class KeywordController extends BaseController
65 ],[ 65 ],[
66 'id.required' => 'ID不能为空' 66 'id.required' => 'ID不能为空'
67 ]); 67 ]);
68 - $data = $logic->getInfo($this->param['id']);  
69 - return $this->success(Arr::twoKeepKeys($data, ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'created_at', 'route', 'url'])); 68 + $data = $logic->getKeywordInfo();
  69 + return $this->success($data);
70 } 70 }
71 71
72 /** 72 /**
@@ -59,7 +59,7 @@ class ProductController extends BaseController @@ -59,7 +59,7 @@ class ProductController extends BaseController
59 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 59 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
60 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 60 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
61 $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); 61 $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
62 - $v['url'] = $this->user['domain'].$v['route']; 62 + $v['url'] = $this->user['domain'].$v['route'].'/';
63 $lists['list'][$k] = $v; 63 $lists['list'][$k] = $v;
64 } 64 }
65 } 65 }
@@ -287,6 +287,18 @@ class ProductController extends BaseController @@ -287,6 +287,18 @@ class ProductController extends BaseController
287 } 287 }
288 288
289 /** 289 /**
  290 + * @remark :直接编辑列表数据
  291 + * @name :editList
  292 + * @author :lyh
  293 + * @method :post
  294 + * @time :2023/10/26 9:48
  295 + */
  296 + public function editList(ProductLogic $logic){
  297 + $logic->editList();
  298 + $this->response('success');
  299 + }
  300 +
  301 + /**
290 * @remark :删除 302 * @remark :删除
291 * @name :delete 303 * @name :delete
292 * @author :lyh 304 * @author :lyh
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AggregationSettingController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/10/23 11:06
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Setting;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Helper\Arr;
  14 +use App\Http\Controllers\Bside\BaseController;
  15 +use App\Models\WebSetting\AggregationSetting;
  16 +
  17 +/**
  18 + * @remark :聚合页
  19 + * @name :AggregationSettingController
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/10/23 11:06
  23 + */
  24 +class AggregationSettingController extends BaseController
  25 +{
  26 + /**
  27 + * @remark :获取聚合页设置详情
  28 + * @name :info
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2023/10/23 11:08
  32 + */
  33 + public function info(){
  34 + $aggSettingModel = new AggregationSetting();
  35 + $info = $aggSettingModel->read(['project_id'=>$this->user['project_id']]);
  36 + if($info === false){
  37 + $data = [
  38 + 'title'=>'',
  39 + 'content'=>'',
  40 + 'top_banner'=>json_encode([]),
  41 + 'foot_banner'=>json_encode([]),
  42 + 'project_id'=>$this->user['project_id']
  43 + ];
  44 + $aggSettingModel->add($data);
  45 + $info = $data;
  46 + }
  47 + $this->response('success',Code::SUCCESS,$info);
  48 + }
  49 +
  50 + /**
  51 + * @remark :修改聚合页设置
  52 + * @name :edit
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2023/10/23 11:11
  56 + */
  57 + public function edit(){
  58 + $aggSettingModel = new AggregationSetting();
  59 + if(isset($this->param['top_banner']) && !empty($this->param['top_banner'])){
  60 + $this->param['top_banner'] = Arr::a2s($this->param['top_banner']);
  61 + }
  62 + if(isset($this->param['foot_banner']) && !empty($this->param['foot_banner'])){
  63 + $this->param['foot_banner'] = Arr::a2s($this->param['foot_banner']);
  64 + }
  65 + $rs = $aggSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]);
  66 + if($rs === false){
  67 + $this->response('系统错误请联系管理员',Code::SYSTEM_ERROR);
  68 + }
  69 + $this->response('success');
  70 + }
  71 +}
@@ -7,6 +7,7 @@ use App\Http\Controllers\Bside\BaseController; @@ -7,6 +7,7 @@ use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\BTemplate\BTemplateLogic; 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\Template; 11 use App\Models\Template\Template;
11 12
12 class BTemplateController extends BaseController 13 class BTemplateController extends BaseController
@@ -141,4 +142,28 @@ class BTemplateController extends BaseController @@ -141,4 +142,28 @@ class BTemplateController extends BaseController
141 $BTemplateLogic->savePublicTemplateHtml(); 142 $BTemplateLogic->savePublicTemplateHtml();
142 $this->response('模板保存成功'); 143 $this->response('模板保存成功');
143 } 144 }
  145 +
  146 + /**
  147 + * @remark :获取可视化详情页模板数据
  148 + * @name :getDetailInfo
  149 + * @author :lyh
  150 + * @method :post
  151 + * @time :2023/10/24 11:27
  152 + */
  153 + public function getDetailInfo(BTemplateLogic $BTemplateLogic){
  154 + $html = $BTemplateLogic->getDetail();
  155 + $this->response('success',Code::SUCCESS,['html'=>$html]);
  156 + }
  157 +
  158 + /**
  159 + * @remark :保存详情页模板数据
  160 + * @name :saveDetail
  161 + * @author :lyh
  162 + * @method :post
  163 + * @time :2023/10/24 14:47
  164 + */
  165 + public function saveDetail(BTemplateLogic $BTemplateLogic){
  166 + $BTemplateLogic->saveDetail();
  167 + $this->response('success');
  168 + }
144 } 169 }
@@ -26,6 +26,7 @@ class CustomTemplateController extends BaseController @@ -26,6 +26,7 @@ class CustomTemplateController extends BaseController
26 $lists = $customTemplateLogic->customTemplateLists($this->map,$this->page,$this->row,$this->order); 26 $lists = $customTemplateLogic->customTemplateLists($this->map,$this->page,$this->row,$this->order);
27 if (!empty($lists)){ 27 if (!empty($lists)){
28 foreach ($lists['list'] as $k => $v){ 28 foreach ($lists['list'] as $k => $v){
  29 + $v['url'] = $v['url'].'/';
29 $lists['list'][$k] = $v; 30 $lists['list'][$k] = $v;
30 } 31 }
31 } 32 }
@@ -266,18 +266,6 @@ class ProjectLogic extends BaseLogic @@ -266,18 +266,6 @@ class ProjectLogic extends BaseLogic
266 if($param['type'] == Project::TYPE_ONE){ 266 if($param['type'] == Project::TYPE_ONE){
267 //改为异步 267 //改为异步
268 NoticeLog::createLog(NoticeLog::TYPE_INIT_PROJECT, ['project_id' => $param['id']]); 268 NoticeLog::createLog(NoticeLog::TYPE_INIT_PROJECT, ['project_id' => $param['id']]);
269 -// //初始化数据库  
270 -// if(isset($param['mysql_id']) && !empty($param['mysql_id'])){  
271 -// $this->initializationMysql($param['id']);  
272 -// }  
273 -// //初始账号  
274 -// if(isset($param['mobile']) && !empty($param['mobile'])){  
275 -// $this->createUser($param['mobile'],$param['id'],$param['lead_name']);  
276 -// }  
277 -// //更改服务器状态  
278 -// if(isset($param['serve_id']) && !empty($param['serve_id'])){  
279 -// $this->updateServe($param['serve_id']);  
280 -// }  
281 } 269 }
282 return $this->success(); 270 return $this->success();
283 } 271 }
@@ -7,13 +7,16 @@ use App\Models\Blog\BlogCategory; @@ -7,13 +7,16 @@ use App\Models\Blog\BlogCategory;
7 use App\Models\News\NewsCategory; 7 use App\Models\News\NewsCategory;
8 use App\Models\Product\Category; 8 use App\Models\Product\Category;
9 use App\Models\Product\Product; 9 use App\Models\Product\Product;
  10 +use App\Models\Project\PageSetting;
10 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
11 use App\Models\Service\Service as ServiceSettingModel; 12 use App\Models\Service\Service as ServiceSettingModel;
12 use App\Models\Template\BTemplateCommon; 13 use App\Models\Template\BTemplateCommon;
  14 +use App\Models\Template\BTemplateMain;
13 use App\Models\Template\Setting; 15 use App\Models\Template\Setting;
14 use App\Models\Template\BTemplate; 16 use App\Models\Template\BTemplate;
15 use App\Models\Template\BTemplateLog; 17 use App\Models\Template\BTemplateLog;
16 use App\Models\Template\Template; 18 use App\Models\Template\Template;
  19 +use App\Models\Template\TemplateTypeMain;
17 use Illuminate\Support\Facades\Cache; 20 use Illuminate\Support\Facades\Cache;
18 use Illuminate\Support\Facades\DB; 21 use Illuminate\Support\Facades\DB;
19 use mysql_xdevapi\Exception; 22 use mysql_xdevapi\Exception;
@@ -61,12 +64,10 @@ class BTemplateLogic extends BaseLogic @@ -61,12 +64,10 @@ class BTemplateLogic extends BaseLogic
61 if($info === false){ 64 if($info === false){
62 $this->fail('请先选择模版'); 65 $this->fail('请先选择模版');
63 } 66 }
64 - $TemplateInfo = [];  
65 if($this->param['source'] == $this->model::SOURCE_HOME){//首页 67 if($this->param['source'] == $this->model::SOURCE_HOME){//首页
66 $TemplateInfo = $this->homeHtml($info,$this->param['source'],$this->param['source_id']); 68 $TemplateInfo = $this->homeHtml($info,$this->param['source'],$this->param['source_id']);
67 - }  
68 - if($this->param['source'] == $this->model::SOURCE_PRODUCT){//产品页  
69 - $TemplateInfo = $this->productHtml($info,$this->param['source'],$this->param['source_id']); 69 + }else{
  70 + $TemplateInfo = $this->otherHtml($info,$this->param['source'],$this->param['source_id']);
70 } 71 }
71 return $this->success($TemplateInfo); 72 return $this->success($TemplateInfo);
72 } 73 }
@@ -120,13 +121,13 @@ class BTemplateLogic extends BaseLogic @@ -120,13 +121,13 @@ class BTemplateLogic extends BaseLogic
120 } 121 }
121 122
122 /** 123 /**
123 - * @remark :处理产品页数据 124 + * @remark :处理其他页数据
124 * @name :ProductHtml 125 * @name :ProductHtml
125 * @author :lyh 126 * @author :lyh
126 * @method :post 127 * @method :post
127 * @time :2023/7/25 16:40 128 * @time :2023/7/25 16:40
128 */ 129 */
129 - public function productHtml($info,$source,$source_id){ 130 + public function otherHtml($info,$source,$source_id){
130 $homeTemplateInfo = $this->webTemplateInfo($info['template_id'],1,0); 131 $homeTemplateInfo = $this->webTemplateInfo($info['template_id'],1,0);
131 if($homeTemplateInfo === false){ 132 if($homeTemplateInfo === false){
132 $this->fail('请先装修首页'); 133 $this->fail('请先装修首页');
@@ -134,15 +135,15 @@ class BTemplateLogic extends BaseLogic @@ -134,15 +135,15 @@ class BTemplateLogic extends BaseLogic
134 //查看当前模板是否已编辑保存web_template 135 //查看当前模板是否已编辑保存web_template
135 $TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id); 136 $TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id);
136 if($TemplateInfo === false){ 137 if($TemplateInfo === false){
137 - $main_html = "<main>{$this->getProductModule()}</main>";  
138 - $main_style = "<style id='globalsojs-styles'></style>"; 138 + $mainInfo = $this->getCommonMain($source,$source_id);
  139 + $main_html = $mainInfo['main_html'];
  140 + $main_style = $mainInfo['main_css'];
  141 + $TemplateInfo['template_id'] = $info['template_id'];
139 }else{ 142 }else{
140 $main_html = $TemplateInfo['main_html']; 143 $main_html = $TemplateInfo['main_html'];
141 $main_style = $TemplateInfo['main_css']; 144 $main_style = $TemplateInfo['main_css'];
142 } 145 }
143 - //兼容老数据  
144 - $commonTemplateModel = new BTemplateCommon();  
145 - $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]); 146 + $commonInfo = $this->getCommonPage($source,$source_id,$info['template_id']);
146 if($commonInfo !== false){ 147 if($commonInfo !== false){
147 $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other']. 148 $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].
148 $commonInfo['head_html'].$main_html.$commonInfo['footer_html']; 149 $commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
@@ -155,6 +156,72 @@ class BTemplateLogic extends BaseLogic @@ -155,6 +156,72 @@ class BTemplateLogic extends BaseLogic
155 } 156 }
156 157
157 /** 158 /**
  159 + * @remark :获取中间公共部分
  160 + * @name :getCommonMain
  161 + * @author :lyh
  162 + * @method :post
  163 + * @time :2023/10/24 15:58
  164 + */
  165 + public function getCommonMain($source,$source_id){
  166 + $data = [];
  167 + if ($source == 2) {if ($source_id != 0) {$type = 2;} else {$type = 3;}}
  168 + if ($source == 3) {if ($source_id != 0) {$type = 4;} else {$type = 5;}}
  169 + if ($source == 4) {if ($source_id != 0) {$type = 6;} else {$type = 7;}}
  170 + if ($source == 5) {$type = 8;}
  171 + //查询有没有公共模板详情样式
  172 + $bTemplateMainModel = new BTemplateMain();
  173 + $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$type]);
  174 + if($mainInfo === false){
  175 + $data['main_html'] = $this->getModule($type);
  176 + $data['main_css'] = "<style id='globalsojs-styles'></style>";
  177 + }else{
  178 + $data['main_html'] = $mainInfo['main_html'];
  179 + $data['main_css'] = $mainInfo['main_css'];
  180 + }
  181 + return $data;
  182 + }
  183 +
  184 + /**
  185 + * @remark :根据类型获取公共头和底
  186 + * @name :getCommonPage
  187 + * @author :lyh
  188 + * @method :post
  189 + * @time :2023/10/21 16:55
  190 + */
  191 + public function getCommonPage($source,$source_id,$template_id){
  192 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  193 + //查看页面是否设置自定义头部底部
  194 + $pageSettingModel = new PageSetting();
  195 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  196 + if ($pageInfo != false) {
  197 + $commonTemplateModel = new BTemplateCommon();
  198 + $data = [
  199 + 'template_id' => $template_id,
  200 + 'project_id' => $this->user['project_id']
  201 + ];
  202 + if ($source == 2) {//产品页
  203 + if($source_id != 0){$data['type'] = 2;if ($pageInfo['product_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  204 + else {$data['type'] = 3;if ($pageInfo['product_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}
  205 + if ($source == 3) {//博客页
  206 + if ($source_id != 0) {$data['type'] = 4;if ($pageInfo['blog_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  207 + else {$data['type'] = 5;if ($pageInfo['blog_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}
  208 + if ($source == 4) {//新闻页
  209 + if ($source_id != 0) {$data['type'] = 6;if ($pageInfo['news_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  210 + else {$data['type'] = 7;if ($pageInfo['news_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}
  211 + if ($source == 5) {//聚合页
  212 + $data['type'] = 8;if ($pageInfo['polymerization'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  213 + }
  214 + }
  215 + //获取首页公共的头部和底部
  216 + if(!isset($commonInfo) || $commonInfo === false){
  217 + $commonTemplateModel = new BTemplateCommon();
  218 + $commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
  219 + }
  220 + return $commonInfo;
  221 + }
  222 +
  223 +
  224 + /**
158 * @remark :设置模板 225 * @remark :设置模板
159 * @name :setTemplate 226 * @name :setTemplate
160 * @author :lyh 227 * @author :lyh
@@ -197,6 +264,7 @@ class BTemplateLogic extends BaseLogic @@ -197,6 +264,7 @@ class BTemplateLogic extends BaseLogic
197 $info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']); 264 $info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
198 //字符串截取 265 //字符串截取
199 $this->param = $this->stringProcessing($this->param); 266 $this->param = $this->stringProcessing($this->param);
  267 + //保存头部信息
200 $this->saveCommonTemplate($this->param); 268 $this->saveCommonTemplate($this->param);
201 $this->param = $this->templateSaveParam($this->param);//组装数据 269 $this->param = $this->templateSaveParam($this->param);//组装数据
202 if($info === false){ 270 if($info === false){
@@ -224,8 +292,9 @@ class BTemplateLogic extends BaseLogic @@ -224,8 +292,9 @@ class BTemplateLogic extends BaseLogic
224 * @time :2023/10/13 14:27 292 * @time :2023/10/13 14:27
225 */ 293 */
226 public function saveCommonTemplate($param){ 294 public function saveCommonTemplate($param){
  295 + $type = $this->getType($param['source'],$param['source_id']);
227 $templateCommonModel = new BTemplateCommon(); 296 $templateCommonModel = new BTemplateCommon();
228 - $info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]); 297 + $info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id'],'type'=>$type]);
229 $data = [ 298 $data = [
230 'head_html'=>$param['head_html'], 299 'head_html'=>$param['head_html'],
231 'head_css'=>$param['head_css'], 300 'head_css'=>$param['head_css'],
@@ -236,7 +305,7 @@ class BTemplateLogic extends BaseLogic @@ -236,7 +305,7 @@ class BTemplateLogic extends BaseLogic
236 if($info === false){ 305 if($info === false){
237 $data['template_id'] = $param['template_id']; 306 $data['template_id'] = $param['template_id'];
238 $data['project_id'] = $this->user['project_id']; 307 $data['project_id'] = $this->user['project_id'];
239 - $data['type'] = 1; 308 + $data['type'] = $type;
240 $templateCommonModel->add($data); 309 $templateCommonModel->add($data);
241 }else{ 310 }else{
242 $templateCommonModel->edit($data,['id'=>$info['id']]); 311 $templateCommonModel->edit($data,['id'=>$info['id']]);
@@ -245,6 +314,29 @@ class BTemplateLogic extends BaseLogic @@ -245,6 +314,29 @@ class BTemplateLogic extends BaseLogic
245 } 314 }
246 315
247 /** 316 /**
  317 + * @remark :获取设置的类型
  318 + * @name :getType
  319 + * @author :lyh
  320 + * @method :post
  321 + * @time :2023/10/21 17:29
  322 + */
  323 + public function getType($source,$source_id){
  324 + $type = 1;//首页公共头部底部
  325 + //查看页面是否设置自定义头部底部
  326 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  327 + $pageSettingModel = new PageSetting();
  328 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  329 + if ($pageInfo !== false) {
  330 + if ($source == 2) {if ($source_id != 0) {if ($pageInfo['product_details'] != 0) {$type = 2;}} else {if ($pageInfo['product_list'] != 0) {$type = 3;}}}
  331 + if ($source == 3) {if ($source_id != 0) {if ($pageInfo['blog_details'] != 0) {$type = 4;}} else {if ($pageInfo['blog_list'] != 0) {$type = 5;}}}
  332 + if ($source == 4) {if ($source_id != 0) {if ($pageInfo['news_details'] != 0) {$type = 6;}} else {if ($pageInfo['news_list'] != 0) {$type = 7;}}}
  333 + if ($source == 5) {if ($pageInfo['polymerization'] != 0) {$type = 8;}}
  334 + }
  335 + }
  336 + return $type;
  337 + }
  338 +
  339 + /**
248 * @remark :生成记录 340 * @remark :生成记录
249 * @name :setTemplateLog 341 * @name :setTemplateLog
250 * @author :lyh 342 * @author :lyh
@@ -281,15 +373,9 @@ class BTemplateLogic extends BaseLogic @@ -281,15 +373,9 @@ class BTemplateLogic extends BaseLogic
281 if($source == BTemplate::SOURCE_HOME){ 373 if($source == BTemplate::SOURCE_HOME){
282 $type = 'index'; 374 $type = 'index';
283 $route = ''; 375 $route = '';
284 - //路由映射  
285 - RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);  
286 - }elseif($source == BTemplate::SOURCE_PRODUCT){  
287 - $type = RouteMap::SOURCE_PRODUCT;  
288 - $productModel = new Product();  
289 - $info = $productModel->read(['id'=>$source_id]);  
290 - $route = $info['route']; 376 + return $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route]);
291 } 377 }
292 - return $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route]); 378 + return $this->success();
293 } 379 }
294 380
295 /** 381 /**
@@ -357,11 +443,11 @@ class BTemplateLogic extends BaseLogic @@ -357,11 +443,11 @@ class BTemplateLogic extends BaseLogic
357 * @method :post 443 * @method :post
358 * @time :2023/7/27 15:08 444 * @time :2023/7/27 15:08
359 */ 445 */
360 - public function getProductModule(){ 446 + public function getModule($type){
361 //获取公共主题头部底部 447 //获取公共主题头部底部
362 - $serviceSettingModel = new ServiceSettingModel();  
363 - $info = $serviceSettingModel->read(['type'=>$serviceSettingModel::TYPE_PRODUCT]);  
364 - return $info['values']; 448 + $mainModel = new TemplateTypeMain();
  449 + $info = $mainModel->read(['type'=>$type]);
  450 + return $info['main_html'];
365 } 451 }
366 452
367 /** 453 /**
@@ -419,19 +505,13 @@ class BTemplateLogic extends BaseLogic @@ -419,19 +505,13 @@ class BTemplateLogic extends BaseLogic
419 $newCategory = NewsCategory::where($map)->get(); 505 $newCategory = NewsCategory::where($map)->get();
420 $blogCategory = BlogCategory::where($map)->get(); 506 $blogCategory = BlogCategory::where($map)->get();
421 if (!empty($productCategory)){ 507 if (!empty($productCategory)){
422 - foreach ($productCategory as $item){  
423 - $data["products"]["category"][] =$item;  
424 - } 508 + foreach ($productCategory as $item){$data["products"]["category"][] =$item;}
425 } 509 }
426 if (!empty($newCategory)){ 510 if (!empty($newCategory)){
427 - foreach ($newCategory as $item){  
428 - $data["news"]["category"][] =$item;  
429 - } 511 + foreach ($newCategory as $item){$data["news"]["category"][] =$item;}
430 } 512 }
431 if (!empty($blogCategory)){ 513 if (!empty($blogCategory)){
432 - foreach ($blogCategory as $item){  
433 - $data["blogs"]["category"][] =$item;  
434 - } 514 + foreach ($blogCategory as $item){$data["blogs"]["category"][] =$item;}
435 } 515 }
436 //返回 516 //返回
437 return $this->success($data); 517 return $this->success($data);
@@ -455,4 +535,100 @@ class BTemplateLogic extends BaseLogic @@ -455,4 +535,100 @@ class BTemplateLogic extends BaseLogic
455 } 535 }
456 return $this->success(); 536 return $this->success();
457 } 537 }
  538 +
  539 + /**
  540 + * @remark :获取详情模板详情
  541 + * @name :getDetail
  542 + * @author :lyh
  543 + * @method :post
  544 + * @time :2023/10/24 11:29
  545 + */
  546 + public function getDetail(){
  547 + $bSettingModel = new Setting();
  548 + $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  549 + if($bSettingInfo === false){
  550 + $this->fail('请先设置模板');
  551 + }
  552 + //获取首页公共部分
  553 + $templateCommonModel = new BTemplateCommon();
  554 + $commonInfo = $templateCommonModel->read(['template_id'=>$bSettingInfo['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
  555 + if($commonInfo === false){
  556 + $this->fail('已装修的项目使用当前功能时,可视化保存首页数据一次,未装修首页请先装修首页');
  557 + }
  558 + //判断当前项目是否有设置独立头部的权限
  559 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  560 + //有权限时,获取独立头部
  561 + $commonTypeInfo = $templateCommonModel->read(['template_id'=>$bSettingInfo['template_id'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
  562 + if($commonTypeInfo !== false){
  563 + $commonInfo = $commonTypeInfo;
  564 + }
  565 + }
  566 + //获取设置的默认中间部分
  567 + $bTemplateMainModel = new BTemplateMain();
  568 + $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
  569 + if($mainInfo === false){
  570 + $main_html = "<main>{$this->getModule($this->param['type'])}</main>";
  571 + $main_style = "<style id='globalsojs-styles'></style>";
  572 + }else{
  573 + $main_html = $mainInfo['main_html'];
  574 + $main_style = $mainInfo['main_css'];
  575 + }
  576 + $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].
  577 + $commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
  578 + $html = $this->getHeadFooter($html);//组装数据
  579 + return $this->success($html);
  580 + }
  581 +
  582 + /**
  583 + * @remark :保存详情模板数据
  584 + * @name :saveDetail
  585 + * @author :lyh
  586 + * @method :post
  587 + * @time :2023/10/24 11:53
  588 + */
  589 + public function saveDetail(){
  590 + $bSettingModel = new Setting();
  591 + $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  592 + if($bSettingInfo === false){
  593 + $this->fail('请先设置模板');
  594 + }
  595 + $data = [
  596 + 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'),
  597 + 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'),
  598 + ];
  599 + $data['section_list_id'] = $this->param['section_list_id'];
  600 + //保存中间部分
  601 + $bTemplateMainModel = new BTemplateMain();
  602 + $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
  603 + if($mainInfo === false){
  604 + $data['project_id'] = $this->user['project_id'];
  605 + $data['type'] = $this->param['type'];
  606 + $bTemplateMainModel->add($data);
  607 + }else{
  608 + $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]);
  609 + }
  610 + $publicData = [
  611 + 'head_html' => characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s'),
  612 + 'head_css' => characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s'),
  613 + 'footer_html' => characterTruncation($this->param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s'),
  614 + 'footer_css' => characterTruncation($this->param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
  615 + ];
  616 + //查看当前模板是否有独立头部,有独立头部,更新独立头部,无独立头部,更新公共头部
  617 + $templateCommonModel = new BTemplateCommon();
  618 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  619 + $templateCommonInfo = $templateCommonModel->read(['type'=>$this->param['type'],'project_id'=>$this->user['project_id'],'template_id'=>$bSettingInfo['template_id']]);
  620 + if($templateCommonInfo === false){
  621 + $publicData['type'] = $this->param['type'];
  622 + $publicData['project_id'] = $this->user['project_id'];
  623 + $publicData['template_id'] = $bSettingInfo['template_id'];
  624 + $templateCommonModel->add($publicData);
  625 + }else{
  626 + $templateCommonModel->edit($publicData,['id'=>$templateCommonInfo['id']]);
  627 + }
  628 + }else{
  629 + //更新首页头部底部
  630 + $templateCommonModel->edit($publicData,['type'=>1,'project_id'=>$this->user['project_id'],'template_id'=>$bSettingInfo['template_id']]);
  631 + }
  632 + return $this->success();
  633 + }
458 } 634 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Bside\BTemplate; 3 namespace App\Http\Logic\Bside\BTemplate;
4 4
5 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Project\PageSetting;
6 use App\Models\RouteMap\RouteMap; 7 use App\Models\RouteMap\RouteMap;
7 use App\Models\Service\Service as ServiceSettingModel; 8 use App\Models\Service\Service as ServiceSettingModel;
8 use App\Models\Template\BCustomTemplate; 9 use App\Models\Template\BCustomTemplate;
@@ -109,30 +110,49 @@ class CustomTemplateLogic extends BaseLogic @@ -109,30 +110,49 @@ class CustomTemplateLogic extends BaseLogic
109 * @method :post 110 * @method :post
110 * @time :2023/10/13 14:27 111 * @time :2023/10/13 14:27
111 */ 112 */
112 - public function saveCommonTemplate($html){  
113 - //获取设置的默认模版  
114 - $bSettingModel = new Setting();  
115 - $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);  
116 - if($settingInfo === false){  
117 - $this->fail('请先设置模版');  
118 - }  
119 - //查看当前 113 + public function saveCommonTemplate($param){
  114 + $type = $this->getType();
120 $templateCommonModel = new BTemplateCommon(); 115 $templateCommonModel = new BTemplateCommon();
121 - $commonInfo = $templateCommonModel->read(['template_id'=>$settingInfo['template_id'],'project_id'=>$this->user['project_id']]);  
122 - if($commonInfo === false){  
123 - $this->fail('请先装修首页');  
124 - } 116 + $info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id'],'type'=>$type]);
125 $data = [ 117 $data = [
126 - 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),  
127 - 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),  
128 - 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),  
129 - 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),  
130 - 'other'=>str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")), 118 + 'head_html'=>$param['head_html'],
  119 + 'head_css'=>$param['head_css'],
  120 + 'footer_html'=>$param['footer_html'],
  121 + 'footer_css'=>$param['footer_css'],
  122 + 'other'=>str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")),
131 ]; 123 ];
132 - $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); 124 + if($info === false){
  125 + $data['template_id'] = $param['template_id'];
  126 + $data['project_id'] = $this->user['project_id'];
  127 + $data['type'] = $type;
  128 + $templateCommonModel->add($data);
  129 + }else{
  130 + $templateCommonModel->edit($data,['id'=>$info['id']]);
  131 + }
133 return $this->success(); 132 return $this->success();
134 } 133 }
135 134
  135 + /**
  136 + * @remark :获取设置的类型
  137 + * @name :getType
  138 + * @author :lyh
  139 + * @method :post
  140 + * @time :2023/10/21 17:29
  141 + */
  142 + public function getType(){
  143 + $type = 1;//首页公共头部底部
  144 + //查看页面是否设置自定义头部底部
  145 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  146 + $pageSettingModel = new PageSetting();
  147 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  148 + if ($pageInfo !== false) {
  149 + if ($pageInfo['page_list'] != 0) {
  150 + $type = 9;
  151 + }
  152 + }
  153 + }
  154 + return $type;
  155 + }
136 156
137 /** 157 /**
138 * @remark :查看路由是否更新 158 * @remark :查看路由是否更新
@@ -224,9 +244,8 @@ class CustomTemplateLogic extends BaseLogic @@ -224,9 +244,8 @@ class CustomTemplateLogic extends BaseLogic
224 if($info === false){ 244 if($info === false){
225 $this->fail('请先设置模版'); 245 $this->fail('请先设置模版');
226 } 246 }
227 -  
228 - $commonTemplateModel = new BTemplateCommon();  
229 - $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); 247 + //获取type类型
  248 + $commonInfo = $this->getCommonPage($info['template_id']);
230 $html = ''; 249 $html = '';
231 if($commonInfo !== false){ 250 if($commonInfo !== false){
232 $html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other']. 251 $html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other'].
@@ -249,6 +268,34 @@ class CustomTemplateLogic extends BaseLogic @@ -249,6 +268,34 @@ class CustomTemplateLogic extends BaseLogic
249 } 268 }
250 269
251 /** 270 /**
  271 + * @remark :根据类型获取公共头和底
  272 + * @name :getCommonPage
  273 + * @author :lyh
  274 + * @method :post
  275 + * @time :2023/10/21 16:55
  276 + */
  277 + public function getCommonPage($template_id){
  278 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  279 + //查看页面是否设置自定义头部底部
  280 + $pageSettingModel = new PageSetting();
  281 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  282 + if ($pageInfo !== false) {
  283 + $commonTemplateModel = new BTemplateCommon();
  284 + if ($pageInfo['page_list'] != 0) {
  285 + //使用独立头和底
  286 + $commonInfo = $commonTemplateModel->read(['template_id' => $template_id, 'project_id' => $this->user['project_id'], 'type' => 9]);
  287 + }
  288 + }
  289 + }
  290 + if(!isset($commonInfo) || $commonInfo === false){
  291 + //获取首页公共的头部和底部
  292 + $commonTemplateModel = new BTemplateCommon();
  293 + $commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
  294 + }
  295 + return $commonInfo;
  296 + }
  297 +
  298 + /**
252 * @remark :拼接获取公共头部底部 299 * @remark :拼接获取公共头部底部
253 * @name :getHeadFooter 300 * @name :getHeadFooter
254 * @author :lyh 301 * @author :lyh
@@ -10,6 +10,7 @@ use App\Models\Com\UpdateNotify; @@ -10,6 +10,7 @@ use App\Models\Com\UpdateNotify;
10 use App\Models\Project\Project; 10 use App\Models\Project\Project;
11 use App\Models\RouteMap\RouteDelete; 11 use App\Models\RouteMap\RouteDelete;
12 use Illuminate\Support\Facades\Cache; 12 use Illuminate\Support\Facades\Cache;
  13 +use Illuminate\Support\Str;
13 14
14 /** 15 /**
15 * @notes: 逻辑层基类 控制器调用 统一返回 统一抛出异常 16 * @notes: 逻辑层基类 控制器调用 统一返回 统一抛出异常
@@ -69,6 +70,15 @@ class BaseLogic extends Logic @@ -69,6 +70,15 @@ class BaseLogic extends Logic
69 */ 70 */
70 public function getParam(){ 71 public function getParam(){
71 $requestAll = $this->request->all(); 72 $requestAll = $this->request->all();
  73 + foreach ($requestAll as $k => $v){
  74 + if(is_array($v)){
  75 + continue;
  76 + }else{
  77 + if(Str::endsWith($k, '_link')){
  78 + unset($requestAll[$k]);
  79 + }
  80 + }
  81 + }
72 return $this->success($requestAll); 82 return $this->success($requestAll);
73 } 83 }
74 84
@@ -59,8 +59,8 @@ class NewsLogic extends BaseLogic @@ -59,8 +59,8 @@ class NewsLogic extends BaseLogic
59 public function newsSave() 59 public function newsSave()
60 { 60 {
61 //拼接参数 61 //拼接参数
62 - DB::beginTransaction();  
63 - try { 62 +// DB::beginTransaction();
  63 +// try {
64 $this->param = $this->paramProcessing($this->param); 64 $this->param = $this->paramProcessing($this->param);
65 if (isset($this->param['id']) && !empty($this->param['id'])) { 65 if (isset($this->param['id']) && !empty($this->param['id'])) {
66 //是否更新路由 66 //是否更新路由
@@ -72,11 +72,11 @@ class NewsLogic extends BaseLogic @@ -72,11 +72,11 @@ class NewsLogic extends BaseLogic
72 //更新路由 72 //更新路由
73 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 73 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
74 $this->edit(['url' => $route], ['id' => $id]); 74 $this->edit(['url' => $route], ['id' => $id]);
75 - DB::commit();  
76 - } catch (\Exception $e) {  
77 - DB::rollBack();  
78 - $this->fail('系统错误,请联系管理员');  
79 - } 75 +// DB::commit();
  76 +// } catch (\Exception $e) {
  77 +// DB::rollBack();
  78 +// $this->fail('系统错误,请联系管理员');
  79 +// }
80 //通知更新 80 //通知更新
81 $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]); 81 $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);
82 return $this->success(); 82 return $this->success();
@@ -241,25 +241,22 @@ class CategoryLogic extends BaseLogic @@ -241,25 +241,22 @@ class CategoryLogic extends BaseLogic
241 */ 241 */
242 public function categoryDelete(){ 242 public function categoryDelete(){
243 $ids = $this->param['ids']; 243 $ids = $this->param['ids'];
244 - DB::beginTransaction();  
245 - try { 244 + foreach ($ids as $id){
  245 + $info = $this->model->read(['pid'=>$id],['id']);
  246 + if($info !== false){
  247 + $this->fail('分类id:'.$id.'拥有子集不允许删除');
  248 + }
246 $productModel = new Product(); 249 $productModel = new Product();
247 - foreach ($ids as $id){  
248 - $product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]);  
249 - if($product_info !== false){  
250 - $this->fail('当前分类拥有产品不允许删除');  
251 - }  
252 - //删除路由  
253 - $this->delRoute($id);  
254 - $this->model->del(['id'=>$id]); 250 + $product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]);
  251 + if($product_info !== false){
  252 + $this->fail('当前分类拥有产品不允许删除');
255 } 253 }
256 - //清除缓存  
257 - Common::del_user_cache('product_category',$this->user['project_id']);  
258 - DB::commit();  
259 - }catch (\Exception $e){  
260 - DB::rollBack();  
261 - $this->fail('删除失败'); 254 + //删除路由
  255 + $this->delRoute($id);
  256 + $this->model->del(['id'=>$id]);
262 } 257 }
  258 + //清除缓存
  259 + Common::del_user_cache('product_category',$this->user['project_id']);
263 return $this->success(); 260 return $this->success();
264 } 261 }
265 262
@@ -34,9 +34,9 @@ class KeywordLogic extends BaseLogic @@ -34,9 +34,9 @@ class KeywordLogic extends BaseLogic
34 * @method :post 34 * @method :post
35 * @time :2023/8/23 16:50 35 * @time :2023/8/23 16:50
36 */ 36 */
37 - public function getInfo($id) 37 + public function getKeywordInfo()
38 { 38 {
39 - $info = parent::getInfo($id); 39 + $info = $this->model->read($this->param);
40 $info['url'] = $this->user['domain'] . $info['route']; 40 $info['url'] = $this->user['domain'] . $info['route'];
41 return $this->success($info); 41 return $this->success($info);
42 } 42 }
@@ -51,6 +51,7 @@ class KeywordLogic extends BaseLogic @@ -51,6 +51,7 @@ class KeywordLogic extends BaseLogic
51 public function keywordSave(){ 51 public function keywordSave(){
52 DB::beginTransaction(); 52 DB::beginTransaction();
53 try { 53 try {
  54 + $this->param = $this->handleSaveParam($this->param);
54 if(isset($this->param['id']) && !empty($this->param['id'])){ 55 if(isset($this->param['id']) && !empty($this->param['id'])){
55 $info = $this->model->read(['id'=>$this->param['id']],['id','route']); 56 $info = $this->model->read(['id'=>$this->param['id']],['id','route']);
56 $route = $info['route']; 57 $route = $info['route'];
@@ -77,6 +78,23 @@ class KeywordLogic extends BaseLogic @@ -77,6 +78,23 @@ class KeywordLogic extends BaseLogic
77 } 78 }
78 79
79 /** 80 /**
  81 + * @remark :保存数据时参数处理
  82 + * @name :handleSaveParam
  83 + * @author :lyh
  84 + * @method :post
  85 + * @time :2023/10/23 14:47
  86 + */
  87 + public function handleSaveParam($param){
  88 + if(isset($param['keyword_top_banner']) && !empty($param['keyword_top_banner'])){
  89 + $param['keyword_top_banner'] = str_replace_url($param['keyword_top_banner']);
  90 + }
  91 + if(isset($param['keyword_foot_banner']) && !empty($param['keyword_foot_banner'])){
  92 + $param['keyword_foot_banner'] = str_replace_url($param['keyword_foot_banner']);
  93 + }
  94 + return $param;
  95 + }
  96 +
  97 + /**
80 * @remark :批量添加数据 98 * @remark :批量添加数据
81 * @name :batchAdd 99 * @name :batchAdd
82 * @author :lyh 100 * @author :lyh
@@ -3,9 +3,11 @@ @@ -3,9 +3,11 @@
3 namespace App\Http\Logic\Bside\Product; 3 namespace App\Http\Logic\Bside\Product;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
  6 +use App\Helper\Common;
6 use App\Http\Logic\Bside\BaseLogic; 7 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\Product\Category; 8 use App\Models\Product\Category;
8 use App\Models\Product\CategoryRelated; 9 use App\Models\Product\CategoryRelated;
  10 +use App\Models\Product\Keyword;
9 use App\Models\Product\Product; 11 use App\Models\Product\Product;
10 use App\Models\RouteMap\RouteMap; 12 use App\Models\RouteMap\RouteMap;
11 use App\Models\Template\BTemplate; 13 use App\Models\Template\BTemplate;
@@ -66,6 +68,55 @@ class ProductLogic extends BaseLogic @@ -66,6 +68,55 @@ class ProductLogic extends BaseLogic
66 } 68 }
67 69
68 /** 70 /**
  71 + * @remark :编辑列表数据
  72 + * @name :editList
  73 + * @author :lyh
  74 + * @method :post
  75 + * @time :2023/10/26 9:49
  76 + */
  77 + public function editList(){
  78 + $this->param['category_id'] = $this->getLastCategory($this->param['category_id']);
  79 + $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
  80 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  81 + return $this->success();
  82 + }
  83 +
  84 + /**
  85 + * @remark :保存关键字标签处理
  86 + * @name :saveKeyword
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2023/10/26 9:51
  90 + */
  91 + public function saveKeyword($keyword){
  92 + $str = '';
  93 + if(isset($keyword) && !empty($keyword)){
  94 + $arr = [];
  95 + $keywordModel = new Keyword();
  96 + foreach ($keyword as $v){
  97 + //查询当前关键字是否存在
  98 + $info = $keywordModel->read(['title'=>$v],['id']);
  99 + if($info === false){
  100 + $param['project_id'] = $this->user['project_id'];
  101 + $param['created_at'] = date('Y-m-d H:i:s');
  102 + $param['updated_at'] = $param['created_at'];
  103 + $param['title'] = $v;
  104 + $id = $keywordModel->insertGetId($param);
  105 + $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
  106 + $this->model->edit(['route'=>$route],['id'=>$id]);
  107 + //清除缓存
  108 + Common::del_user_cache('product_keyword',$this->user['project_id']);
  109 + $arr[] = $id;
  110 + }else{
  111 + $arr[] = $info['id'];
  112 + }
  113 + }
  114 + $str = ','.implode(',',$arr).',';
  115 + }
  116 + return $str;
  117 + }
  118 +
  119 + /**
69 * @remark :不使用save处理参数 120 * @remark :不使用save处理参数
70 * @name :handleSaveParam 121 * @name :handleSaveParam
71 * @author :lyh 122 * @author :lyh
@@ -84,9 +135,7 @@ class ProductLogic extends BaseLogic @@ -84,9 +135,7 @@ class ProductLogic extends BaseLogic
84 } 135 }
85 $param['attrs'] = Arr::a2s($param['attrs'] ?? ''); 136 $param['attrs'] = Arr::a2s($param['attrs'] ?? '');
86 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? ''); 137 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
87 - if(isset($param['category_id']) && !empty($param['category_id'])){  
88 - $param['category_id'] = $this->getLastCategory($param['category_id']);  
89 - } 138 + $param['category_id'] = $this->getLastCategory($param['category_id']);
90 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ 139 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
91 $param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).','; 140 $param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).',';
92 } 141 }
@@ -113,11 +162,13 @@ class ProductLogic extends BaseLogic @@ -113,11 +162,13 @@ class ProductLogic extends BaseLogic
113 */ 162 */
114 public function getLastCategory($category){ 163 public function getLastCategory($category){
115 $str = ''; 164 $str = '';
116 - $cateModel = new Category();  
117 - foreach ($category as $v){  
118 - $info = $cateModel->read(['pid'=>$v]);  
119 - if($info === false){  
120 - $str .= $v.','; 165 + if(isset($category) && !empty($category)){
  166 + $cateModel = new Category();
  167 + foreach ($category as $v){
  168 + $info = $cateModel->read(['pid'=>$v]);
  169 + if($info === false){
  170 + $str .= $v.',';
  171 + }
121 } 172 }
122 } 173 }
123 return ','.$str; 174 return ','.$str;
@@ -44,7 +44,7 @@ class WebSettingSeoLogic extends BaseLogic @@ -44,7 +44,7 @@ class WebSettingSeoLogic extends BaseLogic
44 * @time :2023/9/11 16:34 44 * @time :2023/9/11 16:34
45 */ 45 */
46 public function seoSave(){ 46 public function seoSave(){
47 -// try { 47 + try {
48 $info = $this->model->read(['project_id'=>$this->user['project_id']]); 48 $info = $this->model->read(['project_id'=>$this->user['project_id']]);
49 if($info === false){ 49 if($info === false){
50 $this->param['project_id'] = $this->user['project_id']; 50 $this->param['project_id'] = $this->user['project_id'];
@@ -52,9 +52,9 @@ class WebSettingSeoLogic extends BaseLogic @@ -52,9 +52,9 @@ class WebSettingSeoLogic extends BaseLogic
52 }else{ 52 }else{
53 $this->model->edit($this->param,['project_id'=>$this->user['project_id']]); 53 $this->model->edit($this->param,['project_id'=>$this->user['project_id']]);
54 } 54 }
55 -// }catch (\Exception $e){  
56 -// $this->fail('error');  
57 -// } 55 + }catch (\Exception $e){
  56 + $this->fail('error');
  57 + }
58 return $this->success(); 58 return $this->success();
59 } 59 }
60 } 60 }
@@ -4,7 +4,9 @@ namespace App\Http\Logic\Bside\Setting; @@ -4,7 +4,9 @@ namespace App\Http\Logic\Bside\Setting;
4 4
5 use App\Helper\Common; 5 use App\Helper\Common;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
  7 +use App\Models\Domain\DomainInfo;
7 use App\Models\File\Image; 8 use App\Models\File\Image;
  9 +use App\Models\Project\Project;
8 use App\Models\WebSetting\WebSettingService; 10 use App\Models\WebSetting\WebSettingService;
9 use Illuminate\Support\Facades\DB; 11 use Illuminate\Support\Facades\DB;
10 12
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Models\Product; 3 namespace App\Models\Product;
4 4
  5 +use App\Helper\Arr;
5 use App\Models\Base; 6 use App\Models\Base;
6 use Illuminate\Database\Eloquent\SoftDeletes; 7 use Illuminate\Database\Eloquent\SoftDeletes;
7 8
@@ -19,4 +20,26 @@ class Keyword extends Base @@ -19,4 +20,26 @@ class Keyword extends Base
19 // public function getRouteAttribute(){ 20 // public function getRouteAttribute(){
20 // return RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $this->id, $this->project_id); 21 // return RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $this->id, $this->project_id);
21 // } 22 // }
  23 +
  24 + /**
  25 + * @remark :图
  26 + * @name :getKeywordTopBannerAttribute
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/7/21 11:11
  30 + */
  31 + public function getKeywordTopBannerAttribute($value){
  32 + return getImageUrl($value);
  33 + }
  34 +
  35 + /**
  36 + * @remark :图
  37 + * @name :getKeywordTopBannerAttribute
  38 + * @author :lyh
  39 + * @method :post
  40 + * @time :2023/7/21 11:11
  41 + */
  42 + public function getKeywordFootBannerAttribute($value){
  43 + return getImageUrl($value);
  44 + }
22 } 45 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :PageSetting.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/10/21 15:24
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :项目页面头部底部设置
  16 + * @name :PageSetting
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2023/10/21 15:24
  20 + */
  21 +class PageSetting extends Base
  22 +{
  23 + protected $table = 'gl_project_page_setting';
  24 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :BTemplateMain.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/10/24 11:19
  8 + */
  9 +
  10 +namespace App\Models\Template;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class BTemplateMain extends Base
  15 +{
  16 + protected $table = 'gl_web_template_main';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
  19 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateTypeMain.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/10/27 17:49
  8 + */
  9 +
  10 +namespace App\Models\Template;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :默认数据main详情表
  16 + * @name :TemplateTypeMain
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2023/10/27 17:49
  20 + */
  21 +class TemplateTypeMain extends Base
  22 +{
  23 + protected $table = 'gl_template_type_main';
  24 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AggregationSetting.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/10/23 10:45
  8 + */
  9 +
  10 +namespace App\Models\WebSetting;
  11 +
  12 +use App\Helper\Arr;
  13 +use App\Models\Base;
  14 +
  15 +/**
  16 + * @remark :产品关键字聚合页设置
  17 + * @name :AggregationSetting
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2023/10/23 10:48
  21 + */
  22 +class AggregationSetting extends Base
  23 +{
  24 + //设置关联表名
  25 + protected $table = 'gl_aggregation_setting';
  26 +
  27 + /**
  28 + * @remark :顶部banner获取器
  29 + * @name :getGalleryAttribute
  30 + * @author :lyh
  31 + * @method :post
  32 + * @time :2023/7/21 11:11
  33 + */
  34 + public function getTopBannerAttribute($value){
  35 + if(!empty($value)){
  36 + $value = Arr::s2a($value);
  37 + foreach ($value as $k => $v){
  38 + $v = getImageUrl($v);
  39 + $value[$k] = $v;
  40 + }
  41 + }
  42 + return $value;
  43 + }
  44 +
  45 + /**
  46 + * @remark :底部banner获取器
  47 + * @name :getGalleryAttribute
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2023/7/21 11:11
  51 + */
  52 + public function getFootBannerAttribute($value){
  53 + if(!empty($value)){
  54 + $value = Arr::s2a($value);
  55 + foreach ($value as $k => $v){
  56 + $v = getImageUrl($v);
  57 + $value[$k] = $v;
  58 + }
  59 + }
  60 + return $value;
  61 + }
  62 +}
@@ -26,7 +26,11 @@ Route::middleware(['bloginauth'])->group(function () { @@ -26,7 +26,11 @@ Route::middleware(['bloginauth'])->group(function () {
26 Route::any('/role_list', [\App\Http\Controllers\Bside\User\UserController::class, 'role_list'])->name('user_role_list'); 26 Route::any('/role_list', [\App\Http\Controllers\Bside\User\UserController::class, 'role_list'])->name('user_role_list');
27 Route::any('/del', [\App\Http\Controllers\Bside\User\UserController::class, 'del'])->name('user_del'); 27 Route::any('/del', [\App\Http\Controllers\Bside\User\UserController::class, 'del'])->name('user_del');
28 }); 28 });
29 - 29 + //项目独立头部和底部设置
  30 + Route::prefix('pageSetting')->group(function () {
  31 + Route::any('/info', [\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'info'])->name('pageSetting_info');
  32 + Route::any('/edit',[\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'edit'])->name('pageSetting_edit');
  33 + });
30 //站内信 34 //站内信
31 Route::prefix('mail')->group(function () { 35 Route::prefix('mail')->group(function () {
32 Route::any('/', [\App\Http\Controllers\Bside\Mail\MailController::class, 'lists'])->name('mail_lists'); 36 Route::any('/', [\App\Http\Controllers\Bside\Mail\MailController::class, 'lists'])->name('mail_lists');
@@ -178,6 +182,12 @@ Route::middleware(['bloginauth'])->group(function () { @@ -178,6 +182,12 @@ Route::middleware(['bloginauth'])->group(function () {
178 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingImageController::class, 'save'])->name('web_image_save'); 182 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingImageController::class, 'save'])->name('web_image_save');
179 }); 183 });
180 184
  185 + //聚合页相关配置
  186 + Route::prefix('aggregation')->group(function () {
  187 + Route::any('/info', [\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'info'])->name('aggregation_info');
  188 + Route::any('/edit',[\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'edit'])->name('aggregation_edit');
  189 + });
  190 +
181 }); 191 });
182 //产品 192 //产品
183 Route::prefix('product')->group(function () { 193 Route::prefix('product')->group(function () {
@@ -185,6 +195,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -185,6 +195,7 @@ Route::middleware(['bloginauth'])->group(function () {
185 Route::get('/', [\App\Http\Controllers\Bside\Product\ProductController::class, 'index'])->name('product'); 195 Route::get('/', [\App\Http\Controllers\Bside\Product\ProductController::class, 'index'])->name('product');
186 Route::get('/info', [\App\Http\Controllers\Bside\Product\ProductController::class, 'info'])->name('product_info'); 196 Route::get('/info', [\App\Http\Controllers\Bside\Product\ProductController::class, 'info'])->name('product_info');
187 Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save'); 197 Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save');
  198 + Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList');
188 Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort'); 199 Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort');
189 Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete'); 200 Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete');
190 Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum'); 201 Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum');
@@ -291,6 +302,8 @@ Route::middleware(['bloginauth'])->group(function () { @@ -291,6 +302,8 @@ Route::middleware(['bloginauth'])->group(function () {
291 Route::any('/getHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getHeadFooter'])->name('template_getHeadFooter'); 302 Route::any('/getHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getHeadFooter'])->name('template_getHeadFooter');
292 Route::any('/setHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'setHeadFooter'])->name('template_setHeadFooter'); 303 Route::any('/setHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'setHeadFooter'])->name('template_setHeadFooter');
293 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate'); 304 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
  305 + Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo');
  306 + Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail');
294 // 模板 307 // 模板
295 Route::prefix('module')->group(function () { 308 Route::prefix('module')->group(function () {
296 //获取所有左侧模版 309 //获取所有左侧模版