作者 刘锟

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

  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\Services\ProjectServer;
  22 +use Illuminate\Console\Command;
  23 +use Illuminate\Support\Facades\DB;
  24 +
  25 +/**
  26 + * @remark :更新所有项目的路由
  27 + * @name :UpdateRoute
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2023/11/20 15:08
  31 + */
  32 +class UpdateRoute extends Command
  33 +{
  34 + /**
  35 + * The name and signature of the console command.
  36 + *
  37 + * @var string
  38 + */
  39 + protected $signature = 'update_route';
  40 +
  41 + /**
  42 + * The console command description.
  43 + *
  44 + * @var string
  45 + */
  46 + protected $description = '更新路由';
  47 +
  48 + /**
  49 + * @remark :统一更新路由
  50 + * @name :handle
  51 + * @author :lyh
  52 + * @method :post
  53 + * @time :2023/11/20 15:13
  54 + */
  55 + public function handle(){
  56 + $projectModel = new Project();
  57 + $lists = $projectModel->list(['is_upgrade'=>0,'type'=>['!=',0]]);
  58 + foreach ($lists as $k => $v){
  59 + echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL;
  60 + ProjectServer::useProject($v['id']);
  61 + $this->setProductRoute($v['id']);
  62 + $this->setProductKeywordRoute($v['id']);
  63 + $this->setBlogRoute($v['id']);
  64 + $this->setNewsRoute($v['id']);
  65 + $this->setBlogCateRoute($v['id']);
  66 + $this->setNewsCateRoute($v['id']);
  67 + DB::disconnect('custom_mysql');
  68 + }
  69 + echo date('Y-m-d H:i:s') . ' end: 项目id为' . $v['id'] . PHP_EOL;
  70 + }
  71 +
  72 + /**
  73 + * @remark :设置路由
  74 + * @name :setRoute
  75 + * @author :lyh
  76 + * @method :post
  77 + * @time :2023/11/20 15:30
  78 + */
  79 + public function setProductRoute($project_id){
  80 + $productModel = new Product();
  81 + $productList = $productModel->list(['status'=>['!=',2]],'id',['id','route']);
  82 + foreach ($productList as $v){
  83 + $route = preg_replace('/-product.*/', '', $v['route']);
  84 + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $project_id);
  85 + $route = $route.'-product';
  86 + $productModel->edit(['route'=>$route],['id'=>$v['id']]);
  87 + RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $project_id);
  88 + }
  89 + return true;
  90 + }
  91 +
  92 + /**
  93 + * @remark :设置路由
  94 + * @name :setRoute
  95 + * @author :lyh
  96 + * @method :post
  97 + * @time :2023/11/20 15:30
  98 + */
  99 + public function setNewsRoute($project_id){
  100 + $newsModel = new News();
  101 + $newsList = $newsModel->list(['status'=>['!=',2]],'id',['id','url']);
  102 + foreach ($newsList as $v){
  103 + RouteMap::setRoute($v['url'], RouteMap::SOURCE_NEWS, $v['id'], $project_id);
  104 + }
  105 + return true;
  106 + }
  107 +
  108 + /**
  109 + * @remark :设置路由
  110 + * @name :setRoute
  111 + * @author :lyh
  112 + * @method :post
  113 + * @time :2023/11/20 15:30
  114 + */
  115 + public function setNewsCateRoute($project_id){
  116 + $newsCateModel = new NewsCategory();
  117 + $newsList = $newsCateModel->list([],'id',['id','alias']);
  118 + foreach ($newsList as $v){
  119 + RouteMap::setRoute($v['alias'], RouteMap::SOURCE_NEWS_CATE, $v['id'], $project_id);
  120 + }
  121 + return true;
  122 + }
  123 +
  124 + /**
  125 + * @remark :设置路由
  126 + * @name :setRoute
  127 + * @author :lyh
  128 + * @method :post
  129 + * @time :2023/11/20 15:30
  130 + */
  131 + public function setBlogRoute($project_id){
  132 + $blogModel = new Blog();
  133 + $blogList = $blogModel->list(['status'=>['!=',2]],'id',['id','url']);
  134 + foreach ($blogList as $v){
  135 + RouteMap::setRoute($v['url'], RouteMap::SOURCE_BLOG, $v['id'], $project_id);
  136 + }
  137 + return true;
  138 + }
  139 +
  140 + /**
  141 + * @remark :设置路由
  142 + * @name :setRoute
  143 + * @author :lyh
  144 + * @method :post
  145 + * @time :2023/11/20 15:30
  146 + */
  147 + public function setBlogCateRoute($project_id){
  148 + $blogCateModel = new BlogCategory();
  149 + $blogList = $blogCateModel->list([],'id',['id','alias']);
  150 + foreach ($blogList as $v){
  151 + RouteMap::setRoute($v['alias'], RouteMap::SOURCE_BLOG_CATE, $v['id'], $project_id);
  152 + }
  153 + return true;
  154 + }
  155 +
  156 + /**
  157 + * @remark :设置路由
  158 + * @name :setRoute
  159 + * @author :lyh
  160 + * @method :post
  161 + * @time :2023/11/20 15:30
  162 + */
  163 + public function setProductKeywordRoute($project_id){
  164 + $keywordModel = new Keyword();
  165 + $keywordList = $keywordModel->list([],'id',['id','route']);
  166 + foreach ($keywordList as $v){
  167 + if(!ends_with($v['route'],'-tag')){
  168 + $route = $v['route'].'-tag';
  169 + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
  170 + RouteMap::setRoute($route, RouteMap::SOURCE_BLOG_CATE, $v['id'], $project_id);
  171 + }
  172 + }
  173 + return true;
  174 + }
  175 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands;
  4 +
  5 +use App\Helper\Arr;
  6 +use App\Helper\Common;
  7 +use App\Helper\Gpt;
  8 +use App\Helper\Translate;
  9 +use App\Models\Ai\AiCommand;
  10 +use App\Models\Mail\Mail;
  11 +use App\Models\Project\DeployOptimize;
  12 +use App\Models\Project\Project;
  13 +use App\Models\Project\ProjectUpdateTdk;
  14 +use App\Models\User\User;
  15 +use App\Services\ProjectServer;
  16 +use Illuminate\Console\Command;
  17 +use Illuminate\Support\Facades\Cache;
  18 +use Illuminate\Support\Facades\DB;
  19 +use Illuminate\Support\Facades\Redis;
  20 +
  21 +/**
  22 + * 初始化项目
  23 + * Class InitProject
  24 + * @package App\Console\Commands
  25 + * @author zbj
  26 + * @date 2023/10/8
  27 + */
  28 +class UpdateSeoTdkCrontab extends Command
  29 +{
  30 + /**
  31 + * The name and signature of the console command.
  32 + *
  33 + * @var string
  34 + */
  35 + protected $signature = 'update_seo_tdk_crontab';
  36 +
  37 + /**
  38 + * The console command description.
  39 + *
  40 + * @var string
  41 + */
  42 + protected $description = '一键生成tdk';
  43 +
  44 + /**
  45 + * @return bool
  46 + */
  47 + public function handle()
  48 + {
  49 + $project_ids = Project::where('type', Project::TYPE_TWO)->pluck('id')->toArray();
  50 + foreach ($project_ids as $project_id){
  51 + ProjectUpdateTdk::add_task($project_id);
  52 + }
  53 + }
  54 +
  55 +}
@@ -37,6 +37,7 @@ class Kernel extends ConsoleKernel @@ -37,6 +37,7 @@ class Kernel extends ConsoleKernel
37 $schedule->command('domain_info')->dailyAt('01:00')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 37 $schedule->command('domain_info')->dailyAt('01:00')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次
38 $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 38 $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息
39 $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新 39 $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新
  40 + $schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK
40 } 41 }
41 42
42 /** 43 /**
@@ -6,6 +6,7 @@ use App\Enums\Common\Code; @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
6 use App\Enums\Common\Common; 6 use App\Enums\Common\Common;
7 use App\Http\Controllers\Aside\BaseController; 7 use App\Http\Controllers\Aside\BaseController;
8 use App\Http\Logic\Aside\Manage\MenuLogic; 8 use App\Http\Logic\Aside\Manage\MenuLogic;
  9 +use App\Models\Inquiry\InquiryData;
9 use App\Models\Manage\Manage; 10 use App\Models\Manage\Manage;
10 use Illuminate\Support\Facades\Cache; 11 use Illuminate\Support\Facades\Cache;
11 use Illuminate\Support\Facades\Hash; 12 use Illuminate\Support\Facades\Hash;
@@ -71,4 +72,34 @@ class IndexController extends BaseController @@ -71,4 +72,34 @@ class IndexController extends BaseController
71 $this->response('success'); 72 $this->response('success');
72 } 73 }
73 74
  75 + /**
  76 + * @remark :同步询盘记录
  77 + * @name :sync_inquiry
  78 + * @author :lyh
  79 + * @method :post
  80 + * @time :2023/11/16 9:51
  81 + */
  82 + public function sync_inquiry(){
  83 + $this->request->validate([
  84 + 'data' => 'required|array',
  85 + 'identifying'=>'required',
  86 + 'code'=>'required'
  87 + ], [
  88 + 'data.required' => '自定义询盘数据不为空',
  89 + 'data.array' => '必须为数组',
  90 + 'identifying.required' => '唯一标识不为空',
  91 + 'code'=>'加密串不能为空'
  92 + ]);
  93 + $code = base64_encode(md5($this->param['identifying']));
  94 + if($code != $this->param['code']){
  95 + $this->response('签名错误',Code::SYSTEM_ERROR);
  96 + }
  97 + $inquiryModel = new InquiryData();
  98 + $rs = $inquiryModel->add($this->param);
  99 + if($rs === false){
  100 + $this->response('error',Code::SYSTEM_ERROR);
  101 + }
  102 + $this->response('success');
  103 + }
  104 +
74 } 105 }
@@ -103,6 +103,7 @@ class OptimizeController extends BaseController @@ -103,6 +103,7 @@ class OptimizeController extends BaseController
103 'gl_project.finish_remain_day AS finish_remain_day', 103 'gl_project.finish_remain_day AS finish_remain_day',
104 'gl_project.is_remain_today AS is_remain_today', 104 'gl_project.is_remain_today AS is_remain_today',
105 'gl_project.remain_day AS remain_day', 105 'gl_project.remain_day AS remain_day',
  106 + 'gl_project.robots AS robots',
106 'gl_project_online_check.id AS online_check_id', 107 'gl_project_online_check.id AS online_check_id',
107 'gl_project_online_check.question AS question', 108 'gl_project_online_check.question AS question',
108 'gl_project_online_check.go_question AS go_question', 109 'gl_project_online_check.go_question AS go_question',
@@ -224,4 +225,27 @@ class OptimizeController extends BaseController @@ -224,4 +225,27 @@ class OptimizeController extends BaseController
224 } 225 }
225 $this->response('success'); 226 $this->response('success');
226 } 227 }
  228 +
  229 + /**
  230 + * @remark :设置开关
  231 + * @name :setRobots
  232 + * @author :lyh
  233 + * @method :post
  234 + * @time :2023/11/20 9:42
  235 + */
  236 + public function setRobots(){
  237 + $this->request->validate([
  238 + 'robots'=>'required',
  239 + 'project_id'=>'required',
  240 + ],[
  241 + 'robots.required' => 'robots不能为空',
  242 + 'project_id.required' => 'project_id不能为空',
  243 + ]);
  244 + $projectModel = new Project();
  245 + $rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]);
  246 + if($rs === false){
  247 + $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR);
  248 + }
  249 + $this->response('success');
  250 + }
227 } 251 }
@@ -14,6 +14,8 @@ use App\Http\Requests\Aside\Project\ProcessRecordsRequest; @@ -14,6 +14,8 @@ use App\Http\Requests\Aside\Project\ProcessRecordsRequest;
14 use App\Http\Requests\Aside\Project\ProjectRequest; 14 use App\Http\Requests\Aside\Project\ProjectRequest;
15 use App\Models\ASide\APublicModel; 15 use App\Models\ASide\APublicModel;
16 use App\Models\Channel\Channel; 16 use App\Models\Channel\Channel;
  17 +use App\Models\Channel\User;
  18 +use App\Models\Channel\Zone;
17 use App\Models\Com\City; 19 use App\Models\Com\City;
18 use App\Models\Devops\ServerConfig; 20 use App\Models\Devops\ServerConfig;
19 use App\Models\Domain\DomainInfo; 21 use App\Models\Domain\DomainInfo;
@@ -800,10 +802,42 @@ class ProjectController extends BaseController @@ -800,10 +802,42 @@ class ProjectController extends BaseController
800 ],[ 802 ],[
801 'project_id.required' => 'project_id不能为空', 803 'project_id.required' => 'project_id不能为空',
802 ]); 804 ]);
803 -  
804 $token = $logic->getSiteToken($this->map); 805 $token = $logic->getSiteToken($this->map);
805 -  
806 $this->response('success',Code::SUCCESS,['site_token' => $token]); 806 $this->response('success',Code::SUCCESS,['site_token' => $token]);
  807 + }
807 808
  809 + /**
  810 + * @remark :单独保存其他项目配置
  811 + * @name :saveOtherProject
  812 + * @author :lyh
  813 + * @method :post
  814 + * @time :2023/11/17 15:23
  815 + */
  816 + public function saveOtherProject(ProjectLogic $logic){
  817 + $logic->saveOtherProject();
  818 + $this->response('success');
  819 + }
  820 +
  821 + /**
  822 + * @remark :获取渠道信息
  823 + * @name :getChannel
  824 + * @author :lyh
  825 + * @method :post
  826 + * @time :2023/11/17 16:08
  827 + */
  828 + public function getChannel(){
  829 + $zoneModel = new Zone();
  830 + $zone_list = $zoneModel->list();
  831 + $channelModel = new Channel();
  832 + $channelUserModel = new User();
  833 + foreach ($zone_list as $k => $v){
  834 + $channel_list = $channelModel->list(['zone_id'=>$v['id']]);
  835 + foreach ($channel_list as $k1 => $v1){
  836 + $user_list = $channelUserModel->list(['channel_id'=>$v1['id']]);
  837 + $channel_list[$k1]['sub'] = $user_list;
  838 + }
  839 + $zone_list[$k]['sub'] = $channel_list;
  840 + }
  841 + $this->response('success',Code::SUCCESS,$zone_list);
808 } 842 }
809 } 843 }
@@ -16,7 +16,6 @@ use App\Helper\Common; @@ -16,7 +16,6 @@ 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\Channel\Channel;  
20 use App\Models\Domain\DomainInfo; 19 use App\Models\Domain\DomainInfo;
21 use App\Models\Project\Project; 20 use App\Models\Project\Project;
22 use App\Models\Service\Service; 21 use App\Models\Service\Service;
@@ -25,9 +24,7 @@ use App\Models\User\DeptUser; @@ -25,9 +24,7 @@ use App\Models\User\DeptUser;
25 use App\Models\User\ProjectRole; 24 use App\Models\User\ProjectRole;
26 use App\Models\User\User; 25 use App\Models\User\User;
27 use App\Utils\EncryptUtils; 26 use App\Utils\EncryptUtils;
28 -use App\Utils\LogUtils;  
29 use Illuminate\Support\Facades\Cache; 27 use Illuminate\Support\Facades\Cache;
30 -use Illuminate\Support\Facades\Http;  
31 use Mrgoon\AliSms\AliSms; 28 use Mrgoon\AliSms\AliSms;
32 29
33 class LoginController extends BaseController 30 class LoginController extends BaseController
@@ -302,4 +299,5 @@ class LoginController extends BaseController @@ -302,4 +299,5 @@ class LoginController extends BaseController
302 } 299 }
303 return $data; 300 return $data;
304 } 301 }
  302 +
305 } 303 }
@@ -50,23 +50,6 @@ class BTemplateController extends BaseController @@ -50,23 +50,6 @@ class BTemplateController extends BaseController
50 } 50 }
51 51
52 /** 52 /**
53 - * @remark :设置默认模板  
54 - * @name :setModuleTemplate  
55 - * @author :lyh  
56 - * @method :post  
57 - * @time :2023/6/29 9:39  
58 - */  
59 - public function setPublicTemplate(BTemplateLogic $BTemplateLogic){  
60 - $this->request->validate([  
61 - 'template_id'=>['required'],  
62 - ],[  
63 - 'template_id.required' => '模版ID不能为空',  
64 - ]);  
65 - $BTemplateLogic->setTemplate();  
66 - $this->response('success');  
67 - }  
68 -  
69 - /**  
70 * @remark :保存编辑后的模板 53 * @remark :保存编辑后的模板
71 * @name :save 54 * @name :save
72 * @author :lyh 55 * @author :lyh
@@ -30,9 +30,8 @@ class VisualizationController extends BaseController @@ -30,9 +30,8 @@ class VisualizationController extends BaseController
30 * @method :post 30 * @method :post
31 * @time :2023/11/15 10:26 31 * @time :2023/11/15 10:26
32 */ 32 */
33 - public function info(Visualization $visualization){  
34 - //查看当前模板是否在可视化中保存  
35 - $info = $visualization->read(['source'=>$this->map['source']],['html','source','id','project_id']); 33 + public function info(VisualizationLogic $logic){
  34 + $info = $logic->getVisualizationInfo();
36 if($info === false){ 35 if($info === false){
37 $info = []; 36 $info = [];
38 } 37 }
@@ -47,13 +46,6 @@ class VisualizationController extends BaseController @@ -47,13 +46,6 @@ class VisualizationController extends BaseController
47 * @time :2023/11/15 10:08 46 * @time :2023/11/15 10:08
48 */ 47 */
49 public function save(VisualizationLogic $logic){ 48 public function save(VisualizationLogic $logic){
50 - $this->request->validate([  
51 - 'source'=>'required',  
52 - 'html'=>'required',  
53 - ],[  
54 - 'source.required' => '类型不能为空',  
55 - 'html.required' => 'html不能为空',  
56 - ]);  
57 $logic->saveVisualization(); 49 $logic->saveVisualization();
58 $this->response('success'); 50 $this->response('success');
59 } 51 }
@@ -74,7 +66,7 @@ class VisualizationController extends BaseController @@ -74,7 +66,7 @@ class VisualizationController extends BaseController
74 'source_id.required' => 'source_id不能为空', 66 'source_id.required' => 'source_id不能为空',
75 ]); 67 ]);
76 $data = $logic->getHtml(); 68 $data = $logic->getHtml();
77 - $this->response('success',Code::SUCCESS,['html'=>$data]); 69 + $this->response('success',Code::SUCCESS,$data);
78 } 70 }
79 71
80 /** 72 /**
@@ -84,6 +84,9 @@ class ProjectLogic extends BaseLogic @@ -84,6 +84,9 @@ class ProjectLogic extends BaseLogic
84 if(isset($info['is_customized']) && $info['is_customized'] == 1){ 84 if(isset($info['is_customized']) && $info['is_customized'] == 1){
85 $info['is_visualization'] = json_decode($info['is_visualization']); 85 $info['is_visualization'] = json_decode($info['is_visualization']);
86 } 86 }
  87 + if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){
  88 + $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
  89 + }
87 return $this->success($info); 90 return $this->success($info);
88 } 91 }
89 92
@@ -692,4 +695,19 @@ class ProjectLogic extends BaseLogic @@ -692,4 +695,19 @@ class ProjectLogic extends BaseLogic
692 return $project->site_token; 695 return $project->site_token;
693 } 696 }
694 697
  698 + /**
  699 + * @remark :保存其他配置
  700 + * @name :saveOtherProject
  701 + * @author :lyh
  702 + * @method :post
  703 + * @time :2023/11/17 15:26
  704 + */
  705 + public function saveOtherProject(){
  706 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  707 + if($rs === false){
  708 + $this->fail('系统错误,请联系管理员');
  709 + }
  710 + return $this->success($this->param);
  711 + }
  712 +
695 } 713 }
@@ -4,8 +4,11 @@ namespace App\Http\Logic\Aside\Template; @@ -4,8 +4,11 @@ namespace App\Http\Logic\Aside\Template;
4 4
5 use App\Http\Logic\Aside\BaseLogic; 5 use App\Http\Logic\Aside\BaseLogic;
6 use App\Models\Service\Service as ServiceSettingModel; 6 use App\Models\Service\Service as ServiceSettingModel;
  7 +use App\Models\Template\BTemplate;
  8 +use App\Models\Template\BTemplateCommon;
7 use App\Models\Template\Template; 9 use App\Models\Template\Template;
8 use App\Models\Template\Setting; 10 use App\Models\Template\Setting;
  11 +use App\Services\ProjectServer;
9 use Illuminate\Support\Facades\DB; 12 use Illuminate\Support\Facades\DB;
10 13
11 class ATemplateLogic extends BaseLogic 14 class ATemplateLogic extends BaseLogic
@@ -180,6 +183,8 @@ class ATemplateLogic extends BaseLogic @@ -180,6 +183,8 @@ class ATemplateLogic extends BaseLogic
180 }else{ 183 }else{
181 $rs = $bSettingModel->edit(['template_id'=>$this->param['template_id']],['id'=>$info['id']]); 184 $rs = $bSettingModel->edit(['template_id'=>$this->param['template_id']],['id'=>$info['id']]);
182 } 185 }
  186 + $this->saveTemplate($this->param['project_id'],$this->param['template_id']);
  187 + //保存一条装修数据
183 if($rs === false){ 188 if($rs === false){
184 $this->fail('error'); 189 $this->fail('error');
185 } 190 }
@@ -187,6 +192,41 @@ class ATemplateLogic extends BaseLogic @@ -187,6 +192,41 @@ class ATemplateLogic extends BaseLogic
187 } 192 }
188 193
189 /** 194 /**
  195 + * @remark :设置模版保存装修首页记录
  196 + * @name :saveTemplate
  197 + * @author :lyh
  198 + * @method :post
  199 + * @time :2023/11/17 11:04
  200 + */
  201 + public function saveTemplate($project_id,$template_id){
  202 + $templateInfo = $this->model->read(['id'=>$template_id]);
  203 + ProjectServer::useProject($project_id);
  204 + $bTemplateModel = new BTemplate();
  205 + $info = $bTemplateModel->read(['source'=>1,'template_id'=>$template_id]);
  206 + if($info === false){
  207 + $data = [
  208 + 'source'=>1, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'],
  209 + 'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id,
  210 + ];
  211 + $bTemplateModel->add($data);
  212 + }
  213 + //保存一次公共头部信息
  214 + $bCommonTemplateModel = new BTemplateCommon();
  215 + $commonInfo = $bCommonTemplateModel->read(['template_id'=>$template_id,'type'=>1]);
  216 + if($commonInfo === false){
  217 + $commonData = [
  218 + 'type'=>1, 'template_id'=>$template_id, 'head_html'=>$templateInfo['head_html'],
  219 + 'head_css'=>$templateInfo['head_css'], 'footer_html'=>$templateInfo['footer_html'],
  220 + 'footer_css'=>$templateInfo['footer_css'],'project_id'=>$project_id,
  221 + 'other'=>str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"))
  222 + ];
  223 + $bCommonTemplateModel->add($commonData);
  224 + }
  225 + DB::disconnect('custom_mysql');
  226 + return $this->success();
  227 + }
  228 +
  229 + /**
190 * @remark :获取选择的模版 230 * @remark :获取选择的模版
191 * @name :getSettingInfo 231 * @name :getSettingInfo
192 * @author :lyh 232 * @author :lyh
@@ -47,8 +47,8 @@ class BTemplateLogic extends BaseLogic @@ -47,8 +47,8 @@ class BTemplateLogic extends BaseLogic
47 */ 47 */
48 public function publicTemplateLists($map,$page,$row,$order = 'created_at',$filed = ['id','name','image','url','created_at','status','deleted_status']){ 48 public function publicTemplateLists($map,$page,$row,$order = 'created_at',$filed = ['id','name','image','url','created_at','status','deleted_status']){
49 $templateModel = new Template(); 49 $templateModel = new Template();
50 - $map['deleted_status'] = 0;  
51 - $map['status'] = 0; 50 + $map['deleted_status'] = BTemplate::STATUS;
  51 + $map['status'] = BTemplate::STATUS;
52 $lists = $templateModel->lists($map,$page,$row,$order,$filed); 52 $lists = $templateModel->lists($map,$page,$row,$order,$filed);
53 return $this->success($lists); 53 return $this->success($lists);
54 } 54 }
@@ -222,32 +222,6 @@ class BTemplateLogic extends BaseLogic @@ -222,32 +222,6 @@ class BTemplateLogic extends BaseLogic
222 return $commonInfo; 222 return $commonInfo;
223 } 223 }
224 224
225 -  
226 - /**  
227 - * @remark :设置模板  
228 - * @name :setTemplate  
229 - * @author :lyh  
230 - * @method :post  
231 - * @time :2023/6/29 9:47  
232 - */  
233 - public function setTemplate(){  
234 - $bSettingModel = new Setting();  
235 - $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);  
236 - if($info === false){  
237 - $param = [  
238 - 'project_id'=>$this->user['project_id'],  
239 - 'template_id'=>$this->param['template_id'],  
240 - ];  
241 - $rs = $bSettingModel->add($param);  
242 - }else{  
243 - $rs = $bSettingModel->edit(['template_id'=>$this->param['template_id']],['project_id'=>$this->user['project_id']]);  
244 - }  
245 - if($rs === false){  
246 - $this->fail('error');  
247 - }  
248 - return $this->success();  
249 - }  
250 -  
251 /** 225 /**
252 * @remark :保存修改后的模版 226 * @remark :保存修改后的模版
253 * @name :templateSave 227 * @name :templateSave
@@ -47,8 +47,10 @@ class CustomTemplateLogic extends BaseLogic @@ -47,8 +47,10 @@ class CustomTemplateLogic extends BaseLogic
47 if($info === false){ 47 if($info === false){
48 $this->fail('当前数据不存在'); 48 $this->fail('当前数据不存在');
49 } 49 }
  50 + if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
50 $html = $this->getBodyHeaderFooter($info['html'],$info['html_style']); 51 $html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
51 $info['html'] = $this->getHeadFooter($html); 52 $info['html'] = $this->getHeadFooter($html);
  53 + }
52 return $this->success($info); 54 return $this->success($info);
53 } 55 }
54 56
@@ -90,15 +92,16 @@ class CustomTemplateLogic extends BaseLogic @@ -90,15 +92,16 @@ class CustomTemplateLogic extends BaseLogic
90 */ 92 */
91 public function saveHtml(){ 93 public function saveHtml(){
92 $html = $this->param['html']; 94 $html = $this->param['html'];
  95 + $info = $this->model->read(['id'=>$this->param['id']],['id','is_visualization','url']);
  96 + if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){//非定制项目+可视化页面
93 $this->saveCommonTemplate($html); 97 $this->saveCommonTemplate($html);
94 $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); 98 $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
95 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 99 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
  100 + }
96 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 101 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
97 if($rs === false){ 102 if($rs === false){
98 $this->fail('系统错误,请联系管理'); 103 $this->fail('系统错误,请联系管理');
99 } 104 }
100 - //TODO::通知网站更新  
101 - $info = $this->model->read(['id'=>$this->param['id']],['id','url']);  
102 $data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']]; 105 $data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];
103 $this->updateNotify($data); 106 $this->updateNotify($data);
104 return $this->success(); 107 return $this->success();
@@ -10,8 +10,14 @@ @@ -10,8 +10,14 @@
10 namespace App\Http\Logic\Bside\BTemplate; 10 namespace App\Http\Logic\Bside\BTemplate;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Project\PageSetting;
  14 +use App\Models\Service\Service as ServiceSettingModel;
13 use App\Models\Template\BTemplate; 15 use App\Models\Template\BTemplate;
14 use App\Models\Template\BTemplateCommon; 16 use App\Models\Template\BTemplateCommon;
  17 +use App\Models\Template\BTemplateMain;
  18 +use App\Models\Template\Setting;
  19 +use App\Models\Template\Template;
  20 +use App\Models\Template\TemplateTypeMain;
15 use App\Models\Visualization\Visualization; 21 use App\Models\Visualization\Visualization;
16 22
17 class VisualizationLogic extends BaseLogic 23 class VisualizationLogic extends BaseLogic
@@ -19,11 +25,56 @@ class VisualizationLogic extends BaseLogic @@ -19,11 +25,56 @@ class VisualizationLogic extends BaseLogic
19 public function __construct() 25 public function __construct()
20 { 26 {
21 parent::__construct(); 27 parent::__construct();
22 - $this->model = new Visualization(); 28 + $this->model = new BTemplateMain();
23 $this->param = $this->requestAll; 29 $this->param = $this->requestAll;
24 } 30 }
25 31
26 /** 32 /**
  33 + * @remark :获取代码块
  34 + * @name :getVisualizationInfo
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2023/11/17 14:44
  38 + */
  39 + public function getVisualizationInfo(){
  40 + $data = $this->getSource($this->param['type']);
  41 + $source = $data['source'];
  42 + $source_id = $data['source_id'];
  43 + $type = $this->getType($source,$source_id);
  44 + $typeArray = [1,3,5,7];//单页数据
  45 + if(in_array($type,$typeArray)){
  46 + $bTemplateModel = new BTemplate();
  47 + $info = $bTemplateModel->read(['source'=>$source,'source_id'=>$source_id,'template_id'=>0]);
  48 + if($info === false){
  49 + $html = '';
  50 + }else{
  51 + $html = $info['html'];
  52 + }
  53 + }else{//模块数据
  54 + $bTemplateMainModel = new BTemplateMain();
  55 + $info = $bTemplateMainModel->read(['type'=>$type]);
  56 + if($info === false){
  57 + $html = '';
  58 + }else{
  59 + $html = $info['main_html'];
  60 + }
  61 + }
  62 + return $this->success(['html'=>$html]);
  63 + }
  64 +
  65 + public function getSource($type){
  66 + $source_id = 0;
  67 + if ($type == 2){$source = 2;$source_id = 1;
  68 + }elseif ($type == 3){$source = 2;
  69 + }elseif ($type == 4){$source = 3;$source_id = 1;
  70 + }elseif ($type == 5){$source = 3;
  71 + }elseif ($type == 6){$source = 4;$source_id = 1;
  72 + }elseif ($type == 7){$source = 4;
  73 + }else{$source = 1;}
  74 + return ['source'=>$source,'source_id'=>$source_id];
  75 + }
  76 +
  77 + /**
27 * @remark :保存定制html 78 * @remark :保存定制html
28 * @name :saveHtml 79 * @name :saveHtml
29 * @author :lyh 80 * @author :lyh
@@ -32,11 +83,38 @@ class VisualizationLogic extends BaseLogic @@ -32,11 +83,38 @@ class VisualizationLogic extends BaseLogic
32 */ 83 */
33 public function saveVisualization(){ 84 public function saveVisualization(){
34 try { 85 try {
35 - if(isset($this->param['id']) && !empty($this->param['id'])){  
36 - $this->model->edit($this->param,['id'=>$this->param['id']]); 86 + $sourceData = $this->getSource($this->param['type']);
  87 + $source = $sourceData['source'];
  88 + $source_id = $sourceData['source_id'];
  89 + $type = $this->param['type'];
  90 + $typeArray = [1,3,5,7];//单页数据
  91 + if(in_array($type,$typeArray)){
  92 + $bTemplateModel = new BTemplate();
  93 + $templateInfo = $bTemplateModel->read(['source'=>$source,'source'=>$source_id,'template_id'=>0]);
  94 + if($templateInfo === false){
  95 + $data = [
  96 + 'html'=>$this->param['html'],
  97 + 'project_id'=>$this->user['project_id'],
  98 + 'source'=>$source,
  99 + 'source_id'=>$source_id,
  100 + ];
  101 + $bTemplateModel->add($data);
37 }else{ 102 }else{
38 - $this->param['project_id'] = $this->user['project_id'];  
39 - $this->model->add($this->param); 103 + $bTemplateModel->edit(['html'=>$this->param['html']],['id'=>$templateInfo['id']]);
  104 + }
  105 + }else{//模块数据
  106 + $bTemplateMainModel = new BTemplateMain();
  107 + $mainInfo = $bTemplateMainModel->read(['type'=>$type]);
  108 + if($mainInfo === false){
  109 + $mainData = [
  110 + 'project_id'=>$this->user['project_id'],
  111 + 'type'=>$type,
  112 + 'main_html'=>$this->param['html']
  113 + ];
  114 + $bTemplateMainModel->add($mainData);
  115 + }else{
  116 + $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]);
  117 + }
40 } 118 }
41 }catch (\Exception $e){ 119 }catch (\Exception $e){
42 $this->fail('系统错误,请联系管理员'); 120 $this->fail('系统错误,请联系管理员');
@@ -45,37 +123,145 @@ class VisualizationLogic extends BaseLogic @@ -45,37 +123,145 @@ class VisualizationLogic extends BaseLogic
45 } 123 }
46 124
47 /** 125 /**
48 - * @remark :可视化装修获取html 126 + * @remark :定制页面支持可视化装修获取html
49 * @name :getHtml 127 * @name :getHtml
50 * @author :lyh 128 * @author :lyh
51 * @method :post 129 * @method :post
52 * @time :2023/11/15 11:30 130 * @time :2023/11/15 11:30
53 */ 131 */
54 public function getHtml(){ 132 public function getHtml(){
  133 + $type = $this->getType($this->param['source'],$this->param['source_id']);//获取类型
  134 + $page_array = (array)$this->user['is_visualization']->page_array;//获取定制界面
  135 + //查看当前类型是否是定制界面
  136 + if(in_array($type,$page_array)){//是定制界面
  137 + if(in_array($type,[1,3,5,7])){//单页
  138 + $templateInfo = $this->getWebTemplate($this->param['source'],$this->param['source_id']);//查看当前定制单页是否有代码块
  139 + if($templateInfo === false){
  140 + $this->fail('请先上传定制代码块');
  141 + }
  142 + return ['html'=>$templateInfo['html']];
  143 + }else{//模块页
  144 + $templateInfo = $this->getWebTemplate($this->param['source'],$this->param['source_id']);//查看当前页面是否可视化
  145 + if($templateInfo === false){//获取代码块
  146 + $bTemplateMainModel = new BTemplateMain();
  147 + $mainInfo = $bTemplateMainModel->read(['type'=>$type]);
  148 + if($mainInfo === false){
  149 + $this->fail('请先上传定制代码块');
  150 + }
  151 + return ['html'=>$mainInfo['main_html']];
  152 + }
  153 + return ['html'=>$templateInfo['html']];
  154 + }
  155 + }else{//非定制界面
  156 + $bSettingModel = new Setting();
  157 + $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  158 + if($settingInfo === false){
  159 + $this->fail('请先选择模版');
  160 + }
  161 + $templateInfo = $this->getWebTemplate($this->param['source'],$this->param['source_id'],$settingInfo['template_id']);//查看当前页面是否可视化
  162 + if($templateInfo === false){
  163 + //根据类型在获取中间部分
  164 + $mainData = $this->getCommonMain($this->param['source'],$this->param['source_id']);
  165 + }else{
  166 + $mainData = [
  167 + 'main_html'=>$templateInfo['main_html'],
  168 + 'main_css'=>$templateInfo['main_css']
  169 + ];
  170 + }
  171 + //获取公共头部底部
  172 + $commonInfo = $this->getCommonPage($this->param['source'],$this->param['source_id'],$settingInfo['template_id']);
  173 + //拼接数据
  174 + $html = $commonInfo['head_css'].$mainData['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
  175 + $commonInfo['head_html'].$mainData['main_html'].$commonInfo['footer_html'];
  176 + $html = $this->getHeadFooter($html);
  177 + return ['html'=>$html,'template_id'=>$settingInfo['template_id']];
  178 + }
  179 + }
  180 +
  181 + /**
  182 + * @remark :拼接获取公共头部底部
  183 + * @name :getHeadFooter
  184 + * @author :lyh
  185 + * @method :post
  186 + * @time :2023/7/21 17:22
  187 + */
  188 + public function getHeadFooter($html){
  189 + //获取公共主题头部底部
  190 + $serviceSettingModel = new ServiceSettingModel();
  191 + $list = $serviceSettingModel->list(['type'=>2],'created_at');
  192 + //拼接html
  193 + foreach ($list as $v){
  194 + if($v['key'] == 'head'){
  195 + $html = $v['values'].$html;
  196 + }
  197 + if($v['key'] == 'footer'){
  198 + $html = $html.$v['values'];
  199 + }
  200 + }
  201 + return $html;
  202 + }
  203 +
  204 + /**
  205 + * @remark :获取可视化装修记录
  206 + * @name :getWebTemplate
  207 + * @author :lyh
  208 + * @method :post
  209 + * @time :2023/11/16 11:21
  210 + */
  211 + public function getWebTemplate($source,$source_id,$template_id = 0){
55 //查询可视化是否第一次保存 212 //查询可视化是否第一次保存
56 $bTemplateModel = new BTemplate(); 213 $bTemplateModel = new BTemplate();
57 - $TemplateInfo = $bTemplateModel->read([  
58 - 'source'=>$this->param['source'], 214 + $param = [
  215 + 'source'=>$source,
59 'project_id'=>$this->user['project_id'], 216 'project_id'=>$this->user['project_id'],
60 - 'source_id'=>$this->param['source_id'],  
61 - ]);  
62 - if($this->param['source'] == 2){  
63 - if($this->param['source_id'] == 0){$source = 3;}else{$source = 2;} 217 + 'source_id'=>$source_id,
  218 + 'template_id'=>$template_id
  219 + ];
  220 + return $bTemplateModel->read($param);
  221 + }
  222 +
  223 + /**
  224 + * @remark :获取类型
  225 + * @name :getType
  226 + * @author :lyh
  227 + * @method :post
  228 + * @time :2023/11/16 11:20
  229 + */
  230 + public function getType($source,$source_id){
  231 + $type = 1;
  232 + if($source == 2){
  233 + if($source_id == 0){$type = 3;}else{$type = 2;}
64 } 234 }
65 - if($this->param['source'] == 3){  
66 - if($this->param['source_id'] == 0){$source = 5;}else{$source = 4;} 235 + if($source == 3){
  236 + if($source_id == 0){$type = 5;}else{$type = 4;}
67 } 237 }
68 - if($this->param['source'] == 4){  
69 - if($this->param['source_id'] == 0){$source = 7;}else{$source = 6;} 238 + if($source == 4){
  239 + if($source_id == 0){$type = 7;}else{$type = 6;}
70 } 240 }
71 - if($TemplateInfo === false){  
72 - $info = $this->model->read(['source'=>$source],['html','source','id','project_id']);  
73 - if($info === false){  
74 - $this->fail('请先上传定制代码块'); 241 + return $type;
75 } 242 }
76 - return $info['html']; 243 +
  244 + /**
  245 + * @remark :获取设置的类型
  246 + * @name :getType
  247 + * @author :lyh
  248 + * @method :post
  249 + * @time :2023/10/21 17:29
  250 + */
  251 + public function getSaveType($source,$source_id){
  252 + $type = 1;//首页公共头部底部
  253 + //查看页面是否设置自定义头部底部
  254 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  255 + $pageSettingModel = new PageSetting();
  256 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  257 + if ($pageInfo !== false) {
  258 + if ($source == 2) {if ($source_id != 0) {if ($pageInfo['product_details'] != 0) {$type = 2;}} else {if ($pageInfo['product_list'] != 0) {$type = 3;}}}
  259 + if ($source == 3) {if ($source_id != 0) {if ($pageInfo['blog_details'] != 0) {$type = 4;}} else {if ($pageInfo['blog_list'] != 0) {$type = 5;}}}
  260 + if ($source == 4) {if ($source_id != 0) {if ($pageInfo['news_details'] != 0) {$type = 6;}} else {if ($pageInfo['news_list'] != 0) {$type = 7;}}}
  261 + if ($source == 5) {if ($pageInfo['polymerization'] != 0) {$type = 8;}}
77 } 262 }
78 - return $TemplateInfo['html']; 263 + }
  264 + return $type;
79 } 265 }
80 266
81 /** 267 /**
@@ -86,26 +272,154 @@ class VisualizationLogic extends BaseLogic @@ -86,26 +272,154 @@ class VisualizationLogic extends BaseLogic
86 * @time :2023/11/15 11:47 272 * @time :2023/11/15 11:47
87 */ 273 */
88 public function saveHtml(){ 274 public function saveHtml(){
  275 + $page_array = (array)$this->user['is_visualization']->page_array;
  276 + $type = $this->getType($this->param['source'],$this->param['source_id']);
  277 + try {
  278 + if(in_array($type,$page_array)){//定制页面
89 $bTemplateModel = new BTemplate(); 279 $bTemplateModel = new BTemplate();
90 $templateInfo = $bTemplateModel->read([ 280 $templateInfo = $bTemplateModel->read([
91 'source'=>$this->param['source'], 281 'source'=>$this->param['source'],
92 'project_id'=>$this->user['project_id'], 282 'project_id'=>$this->user['project_id'],
93 'source_id'=>$this->param['source_id'], 283 'source_id'=>$this->param['source_id'],
94 ]); 284 ]);
95 - try {  
96 if($templateInfo === false){ 285 if($templateInfo === false){
97 $this->param['project_id'] = $this->user['project_id']; 286 $this->param['project_id'] = $this->user['project_id'];
98 $bTemplateModel->add($this->param); 287 $bTemplateModel->add($this->param);
99 }else{ 288 }else{
100 $bTemplateModel->edit(['html'=>$this->param['html']],['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]); 289 $bTemplateModel->edit(['html'=>$this->param['html']],['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]);
101 } 290 }
  291 + }else{
  292 + $bTemplateModel = new BTemplate();
  293 + $templateInfo = $bTemplateModel->read([
  294 + 'source'=>$this->param['source'],
  295 + 'project_id'=>$this->user['project_id'],
  296 + 'source_id'=>$this->param['source_id'],
  297 + 'template_id'=>$this->param['template_id'],
  298 + ]);
  299 + $this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
  300 + $this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
  301 + //保存头部
  302 + $this->saveCommonTemplate($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
  303 + if($templateInfo === false){
  304 + $this->param['project_id'] = $this->user['project_id'];
  305 + $bTemplateModel->add($this->param);
  306 + }else{
  307 + $bTemplateModel->edit($this->param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]);
  308 + }
  309 + }
102 }catch (\Exception $e){ 310 }catch (\Exception $e){
103 - $this->fail('系统错误请联系管理员'); 311 + $this->fail('系统错误请联系管理员');
104 } 312 }
105 return $this->success(); 313 return $this->success();
106 314
107 } 315 }
108 316
  317 + /**
  318 + * @remark :保存头部公共数据
  319 + * @name :saveCommonTemplate
  320 + * @author :lyh
  321 + * @method :post
  322 + * @time :2023/10/13 14:27
  323 + */
  324 + public function saveCommonTemplate($html,$source,$source_id,$template_id){
  325 + $type = $this->getSaveType($source,$source_id);
  326 + $templateCommonModel = new BTemplateCommon();
  327 + $info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
  328 + $data = [
  329 + 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),
  330 + 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),
  331 + 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
  332 + 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
  333 + ];
  334 + $other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s"));
  335 + if($info === false){
  336 + $data['template_id'] = $template_id;
  337 + $data['project_id'] = $this->user['project_id'];
  338 + $data['type'] = $type;
  339 + $templateCommonModel->add($data);
  340 + }else{
  341 + $templateCommonModel->edit($data,['id'=>$info['id']]);
  342 + }
  343 + //更新所有界面的other
  344 + $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id']]);
  345 + return $this->success();
  346 + }
  347 +
  348 + /**
  349 + * @remark :获取中间公共部分
  350 + * @name :getCommonMain
  351 + * @author :lyh
  352 + * @method :post
  353 + * @time :2023/10/24 15:58
  354 + */
  355 + public function getCommonMain($source,$source_id){
  356 + $data = [];
  357 + if ($source == 2) {if ($source_id != 0) {$type = 2;} else {$type = 3;}}
  358 + if ($source == 3) {if ($source_id != 0) {$type = 4;} else {$type = 5;}}
  359 + if ($source == 4) {if ($source_id != 0) {$type = 6;} else {$type = 7;}}
  360 + if ($source == 5) {$type = 8;}
  361 + //查询有没有公共详情模板
  362 + $mainInfo = $this->model->read(['type'=>$type]);
  363 + if($mainInfo === false){
  364 + $data['main_html'] = $this->getModule($type);
  365 + $data['main_css'] = "<style id='globalsojs-styles'></style>";
  366 + }else{
  367 + $data['main_html'] = $mainInfo['main_html'];
  368 + $data['main_css'] = $mainInfo['main_css'];
  369 + }
  370 + return $data;
  371 + }
109 372
  373 + /**
  374 + * @remark :默认产品模块
  375 + * @name :getProductModule
  376 + * @author :lyh
  377 + * @method :post
  378 + * @time :2023/7/27 15:08
  379 + */
  380 + public function getModule($type){
  381 + //获取公共主题头部底部
  382 + $mainModel = new TemplateTypeMain();
  383 + $info = $mainModel->read(['type'=>$type]);
  384 + return $info['main_html'];
  385 + }
110 386
  387 + /**
  388 + * @remark :根据类型获取公共头和底
  389 + * @name :getCommonPage
  390 + * @author :lyh
  391 + * @method :post
  392 + * @time :2023/10/21 16:55
  393 + */
  394 + public function getCommonPage($source,$source_id,$template_id){
  395 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  396 + //查看页面是否设置自定义头部底部
  397 + $pageSettingModel = new PageSetting();
  398 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  399 + if ($pageInfo != false) {
  400 + $commonTemplateModel = new BTemplateCommon();
  401 + $data = [
  402 + 'template_id' => $template_id,
  403 + 'project_id' => $this->user['project_id']
  404 + ];
  405 + if ($source == 2) {//产品页
  406 + if($source_id != 0){$data['type'] = 2;if ($pageInfo['product_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  407 + else {$data['type'] = 3;if ($pageInfo['product_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}
  408 + if ($source == 3) {//博客页
  409 + if ($source_id != 0) {$data['type'] = 4;if ($pageInfo['blog_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  410 + else {$data['type'] = 5;if ($pageInfo['blog_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}
  411 + if ($source == 4) {//新闻页
  412 + if ($source_id != 0) {$data['type'] = 6;if ($pageInfo['news_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  413 + else {$data['type'] = 7;if ($pageInfo['news_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}
  414 + if ($source == 5) {//聚合页
  415 + $data['type'] = 8;if ($pageInfo['polymerization'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
  416 + }
  417 + }
  418 + //获取首页公共的头部和底部
  419 + if(!isset($commonInfo) || $commonInfo === false){
  420 + $commonTemplateModel = new BTemplateCommon();
  421 + $commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
  422 + }
  423 + return $commonInfo;
  424 + }
111 } 425 }
@@ -60,8 +60,9 @@ class ExtendLogic extends BaseLogic @@ -60,8 +60,9 @@ class ExtendLogic extends BaseLogic
60 $info = $this->model->read(['key'=>$key.$i]); 60 $info = $this->model->read(['key'=>$key.$i]);
61 if($info !== false){ 61 if($info !== false){
62 return $this->getKey($key,$i+1); 62 return $this->getKey($key,$i+1);
  63 + }else{
  64 + return $key.$i;
63 } 65 }
64 - return $key;  
65 } 66 }
66 67
67 /** 68 /**
@@ -113,7 +113,7 @@ class ProductLogic extends BaseLogic @@ -113,7 +113,7 @@ class ProductLogic extends BaseLogic
113 unset($v['title']); 113 unset($v['title']);
114 if($v['type'] == 3 || $v['type'] == 4){ 114 if($v['type'] == 3 || $v['type'] == 4){
115 foreach ($v['values'] as $k1=>$v1){ 115 foreach ($v['values'] as $k1=>$v1){
116 - $v1 = str_replace_url($v1); 116 + $v1['url'] = str_replace_url($v1['url']);
117 $v['values'][$k1] = $v1; 117 $v['values'][$k1] = $v1;
118 } 118 }
119 $v['values'] = json_encode($v['values']); 119 $v['values'] = json_encode($v['values']);
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Models\Channel; 3 namespace App\Models\Channel;
4 4
  5 +use App\Models\Base;
5 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
6 use phpDocumentor\Reflection\Types\Self_; 7 use phpDocumentor\Reflection\Types\Self_;
7 8
@@ -11,7 +12,7 @@ use phpDocumentor\Reflection\Types\Self_; @@ -11,7 +12,7 @@ use phpDocumentor\Reflection\Types\Self_;
11 * @author zbj 12 * @author zbj
12 * @date 2023/6/27 13 * @date 2023/6/27
13 */ 14 */
14 -class Channel extends Model 15 +class Channel extends Base
15 { 16 {
16 //设置关联表名 17 //设置关联表名
17 protected $table = 'gl_channel'; 18 protected $table = 'gl_channel';
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Models\Channel; 3 namespace App\Models\Channel;
4 4
  5 +use App\Models\Base;
5 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
6 7
7 /** 8 /**
@@ -10,7 +11,7 @@ use Illuminate\Database\Eloquent\Model; @@ -10,7 +11,7 @@ use Illuminate\Database\Eloquent\Model;
10 * @author zbj 11 * @author zbj
11 * @date 2023/6/27 12 * @date 2023/6/27
12 */ 13 */
13 -class Zone extends Model 14 +class Zone extends Base
14 { 15 {
15 //设置关联表名 16 //设置关联表名
16 protected $table = 'gl_channel_zone'; 17 protected $table = 'gl_channel_zone';
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :InquiryData.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/16 9:54
  8 + */
  9 +
  10 +namespace App\Models\Inquiry;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class InquiryData extends Base
  15 +{
  16 + protected $table = 'gl_inquiry_data';
  17 +}
@@ -109,6 +109,14 @@ class RouteMap extends Base @@ -109,6 +109,14 @@ class RouteMap extends Base
109 if(!$route_map){ 109 if(!$route_map){
110 $route_map = new self(); 110 $route_map = new self();
111 $route_map->source = $source; 111 $route_map->source = $source;
  112 + if ($source == self::SOURCE_PRODUCT_KEYWORD){
  113 + $route = $route.'-tag';
  114 + }elseif ($source == self::SOURCE_PRODUCT){
  115 + $route = $route.'-product';
  116 + }
  117 + $route_map->source_id = $source_id;
  118 + $route_map->project_id = $project_id;
  119 + }
112 if($source == self::SOURCE_NEWS){ 120 if($source == self::SOURCE_NEWS){
113 $route_map->path = self::SOURCE_NEWS; 121 $route_map->path = self::SOURCE_NEWS;
114 }elseif($source == self::SOURCE_NEWS_CATE){ 122 }elseif($source == self::SOURCE_NEWS_CATE){
@@ -117,13 +125,6 @@ class RouteMap extends Base @@ -117,13 +125,6 @@ class RouteMap extends Base
117 $route_map->path = self::SOURCE_BLOG; 125 $route_map->path = self::SOURCE_BLOG;
118 }elseif ($source == self::SOURCE_BLOG_CATE){ 126 }elseif ($source == self::SOURCE_BLOG_CATE){
119 $route_map->path = self::PATH_BLOG_CATE; 127 $route_map->path = self::PATH_BLOG_CATE;
120 - }elseif ($source == self::SOURCE_PRODUCT_KEYWORD){  
121 - $route = $route.'-tag';  
122 - }elseif ($source == self::SOURCE_PRODUCT){  
123 - $route = $route.'-product';  
124 - }  
125 - $route_map->source_id = $source_id;  
126 - $route_map->project_id = $project_id;  
127 } 128 }
128 $route_map->route = $route; 129 $route_map->route = $route;
129 $route_map->save(); 130 $route_map->save();
@@ -13,7 +13,12 @@ use App\Models\Base; @@ -13,7 +13,12 @@ use App\Models\Base;
13 class BTemplate extends Base 13 class BTemplate extends Base
14 { 14 {
15 const SOURCE_HOME = 1;//首页 15 const SOURCE_HOME = 1;//首页
16 - const SOURCE_PRODUCT = 2;//产品页 16 + const SOURCE_PRODUCT = 2;//产品
  17 + const SOURCE_BLOG = 3;//博客
  18 + const SOURCE_NEWS = 4;//新闻详情页
  19 +
  20 +
  21 + const STATUS = 0;
17 22
18 protected $table = 'gl_web_template'; 23 protected $table = 'gl_web_template';
19 //连接数据库 24 //连接数据库
@@ -171,6 +171,8 @@ Route::middleware(['aloginauth'])->group(function () { @@ -171,6 +171,8 @@ Route::middleware(['aloginauth'])->group(function () {
171 Route::any('/tdkList', [Aside\Project\ProjectController::class, 'tdkList'])->name('admin.project_tdkList'); 171 Route::any('/tdkList', [Aside\Project\ProjectController::class, 'tdkList'])->name('admin.project_tdkList');
172 Route::any('/copyProject', [Aside\Project\ProjectController::class, 'copyProject'])->name('admin.project_copyProject'); 172 Route::any('/copyProject', [Aside\Project\ProjectController::class, 'copyProject'])->name('admin.project_copyProject');
173 Route::any('/site_token', [Aside\Project\ProjectController::class, 'site_token'])->name('admin.project_site_token'); 173 Route::any('/site_token', [Aside\Project\ProjectController::class, 'site_token'])->name('admin.project_site_token');
  174 + Route::any('/saveOtherProject', [Aside\Project\ProjectController::class, 'saveOtherProject'])->name('admin.project_saveOtherProject');//其他项目设置
  175 + Route::any('/getChannel', [Aside\Project\ProjectController::class, 'getChannel'])->name('admin.project_getChannel');//其他项目设置
174 //获取关键词前缀和后缀 176 //获取关键词前缀和后缀
175 Route::prefix('keyword')->group(function () { 177 Route::prefix('keyword')->group(function () {
176 Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); 178 Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix');
@@ -248,6 +250,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -248,6 +250,7 @@ Route::middleware(['aloginauth'])->group(function () {
248 Route::any('/', [Aside\Optimize\OptimizeController::class, 'lists'])->name('admin.optimize_lists');//优化中台 250 Route::any('/', [Aside\Optimize\OptimizeController::class, 'lists'])->name('admin.optimize_lists');//优化中台
249 Route::any('/getAiPrefix', [Aside\Optimize\OptimizeController::class, 'getAiPrefix'])->name('admin.optimize_getAiPrefix');//获取Ai前后缀 251 Route::any('/getAiPrefix', [Aside\Optimize\OptimizeController::class, 'getAiPrefix'])->name('admin.optimize_getAiPrefix');//获取Ai前后缀
250 Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀 252 Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀
  253 + Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关
251 }); 254 });
252 255
253 //优化中台 256 //优化中台
@@ -342,6 +345,8 @@ Route::group([], function () { @@ -342,6 +345,8 @@ Route::group([], function () {
342 Route::any('get_template_detail', [Aside\Template\ATemplateController::class, 'getTemplateDetail'])->name('admin.get_template_detail'); 345 Route::any('get_template_detail', [Aside\Template\ATemplateController::class, 'getTemplateDetail'])->name('admin.get_template_detail');
343 346
344 Route::any('/collect', [Aside\Collect\CollectController::class, 'index'])->name('admin.collect'); 347 Route::any('/collect', [Aside\Collect\CollectController::class, 'index'])->name('admin.collect');
  348 + //同步询盘
  349 + Route::any('/sync_inquiry', [Aside\Com\IndexController::class, 'sync_inquiry'])->name('admin.sync_inquiry');
345 }); 350 });
346 351
347 352
@@ -301,8 +301,6 @@ Route::middleware(['bloginauth'])->group(function () { @@ -301,8 +301,6 @@ Route::middleware(['bloginauth'])->group(function () {
301 Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists'); 301 Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists');
302 //获取选中的主题模版 302 //获取选中的主题模版
303 Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate'); 303 Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate');
304 - //设置默认主题模版  
305 - Route::any('/setPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'setPublicTemplate'])->name('template_setPublicTemplate');  
306 //保存修改后的模版 304 //保存修改后的模版
307 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'save'])->name('template_save'); 305 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'save'])->name('template_save');
308 //可视化保存获取数据类型 306 //可视化保存获取数据类型