作者 刘锟

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

@@ -48,11 +48,11 @@ class ProjectFilePDF extends Command @@ -48,11 +48,11 @@ class ProjectFilePDF extends Command
48 48
49 public function handle() 49 public function handle()
50 { 50 {
  51 +
51 // 开始时间 52 // 开始时间
52 $startTime = microtime(true); 53 $startTime = microtime(true);
53 - $html = $this->html([]);  
54 - $filename = hash('md5', $this->time . '-' . random_int(100000, 999999));  
55 - $this->savePDF($html, $filename); 54 +
  55 + $gg = $this->main();
56 56
57 // 结束时间 57 // 结束时间
58 $endTime = microtime(true); 58 $endTime = microtime(true);
@@ -62,7 +62,9 @@ class ProjectFilePDF extends Command @@ -62,7 +62,9 @@ class ProjectFilePDF extends Command
62 62
63 // 输出执行时间 63 // 输出执行时间
64 var_dump("程序执行时间: " . $executionTime . " 秒"); 64 var_dump("程序执行时间: " . $executionTime . " 秒");
65 -// return $this->main(); 65 +
  66 + return $gg;
  67 +
66 } 68 }
67 69
68 /** 70 /**
@@ -18,6 +18,7 @@ use App\Models\Product\Keyword; @@ -18,6 +18,7 @@ use App\Models\Product\Keyword;
18 use App\Models\Product\Product; 18 use App\Models\Product\Product;
19 use App\Models\Project\Project; 19 use App\Models\Project\Project;
20 use App\Models\RouteMap\RouteMap; 20 use App\Models\RouteMap\RouteMap;
  21 +use App\Models\Template\BTemplate;
21 use App\Models\Template\BTemplateMain; 22 use App\Models\Template\BTemplateMain;
22 use App\Services\ProjectServer; 23 use App\Services\ProjectServer;
23 use Illuminate\Console\Command; 24 use Illuminate\Console\Command;
@@ -59,7 +60,7 @@ class UpdateMainHtml extends Command @@ -59,7 +60,7 @@ class UpdateMainHtml extends Command
59 foreach ($list as $v){ 60 foreach ($list as $v){
60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
61 ProjectServer::useProject($v['id']); 62 ProjectServer::useProject($v['id']);
62 - $this->editMainHtml(); 63 + $this->editMainHtml($v['id']);
63 DB::disconnect('custom_mysql'); 64 DB::disconnect('custom_mysql');
64 } 65 }
65 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 66 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -72,10 +73,32 @@ class UpdateMainHtml extends Command @@ -72,10 +73,32 @@ class UpdateMainHtml extends Command
72 * @method :post 73 * @method :post
73 * @time :2023/12/27 18:03 74 * @time :2023/12/27 18:03
74 */ 75 */
75 - public function editMainHtml(){ 76 + public function editMainHtml($project_id){
  77 + $templateModel = new BTemplate();
  78 + $info = $templateModel->read(['source'=>4,'source_id'=>0]);
  79 + if($info !== false){
76 $mainModel = new BTemplateMain(); 80 $mainModel = new BTemplateMain();
77 -// $mainModel->edit(['type'=>3],['type'=>4]);  
78 - $mainModel->edit(['type'=>4],['type'=>6]); 81 + $mainInfo = $mainModel->read(['type'=>4,'is_list'=>1]);
  82 + if($mainInfo === false){
  83 + $data = [
  84 + 'type'=>4,
  85 + 'is_list'=>1,
  86 + 'main_html'=>$info['main_html'],
  87 + 'main_css'=>$info['main_css'],
  88 + 'section_list_id'=>$info['section_list_id'],
  89 + 'project_id'=>$project_id
  90 + ];
  91 + $mainModel->add($data);
  92 + }else{
  93 + $data = [
  94 + 'main_html'=>$info['main_html'],
  95 + 'main_css'=>$info['main_css'],
  96 + 'section_list_id'=>$info['section_list_id'],
  97 + 'project_id'=>$project_id,
  98 + ];
  99 + $mainModel->edit($data,['id'=>$mainInfo['id']]);
  100 + }
  101 + }
79 return true; 102 return true;
80 } 103 }
81 } 104 }
@@ -10,6 +10,8 @@ use App\Models\Blog\Blog as BlogModel; @@ -10,6 +10,8 @@ use App\Models\Blog\Blog as BlogModel;
10 use App\Models\Blog\BlogCategory; 10 use App\Models\Blog\BlogCategory;
11 use App\Models\Blog\BlogCategory as BlogCategoryModel; 11 use App\Models\Blog\BlogCategory as BlogCategoryModel;
12 use App\Models\RouteMap\RouteMap; 12 use App\Models\RouteMap\RouteMap;
  13 +use App\Models\Template\BTemplate;
  14 +use App\Models\Template\Setting;
13 use App\Models\User\User; 15 use App\Models\User\User;
14 16
15 class BlogController extends BaseController 17 class BlogController extends BaseController
@@ -32,12 +34,16 @@ class BlogController extends BaseController @@ -32,12 +34,16 @@ class BlogController extends BaseController
32 $lists = $lists->toArray(); 34 $lists = $lists->toArray();
33 // //获取当前项目的所有分类 35 // //获取当前项目的所有分类
34 $data = $this->getCategoryList(); 36 $data = $this->getCategoryList();
  37 + //获取当前用户选择的模版
  38 + $templateSettingModel = new Setting();
  39 + $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
35 $user = new User(); 40 $user = new User();
36 foreach ($lists['list'] as $k => $v){ 41 foreach ($lists['list'] as $k => $v){
37 $v['category_name'] = $this->categoryName($v['category_id'],$data); 42 $v['category_name'] = $this->categoryName($v['category_id'],$data);
38 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']); 43 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']);
39 $v['image_link'] = getImageUrl($v['image']); 44 $v['image_link'] = getImageUrl($v['image']);
40 $v['operator_name'] = $user->getName($v['operator_id']); 45 $v['operator_name'] = $user->getName($v['operator_id']);
  46 + $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
41 $lists['list'][$k] = $v; 47 $lists['list'][$k] = $v;
42 } 48 }
43 } 49 }
@@ -45,6 +51,31 @@ class BlogController extends BaseController @@ -45,6 +51,31 @@ class BlogController extends BaseController
45 } 51 }
46 52
47 /** 53 /**
  54 + * @remark :查看产品是否已装修
  55 + * @name :getProductIsRenovation
  56 + * @author :lyh
  57 + * @method :post
  58 + * @time :2023/9/13 14:02
  59 + */
  60 + public function getProductIsRenovation($info,$id){
  61 + if($info !== false){
  62 + $webTemplateModel = new BTemplate();
  63 + $param = [
  64 + 'source'=>BTemplate::SOURCE_BLOG,
  65 + 'project_id'=>$this->user['project_id'],
  66 + 'source_id'=>$id,
  67 + 'template_id'=>$info['template_id'],
  68 + 'is_list'=>0
  69 + ];
  70 + $templateInfo = $webTemplateModel->read($param);
  71 + if($templateInfo !== false){
  72 + return 1;
  73 + }
  74 + }
  75 + return 0;
  76 + }
  77 +
  78 + /**
48 * @remark :处理列表返回参数 79 * @remark :处理列表返回参数
49 * @name :handleReturnParam 80 * @name :handleReturnParam
50 * @author :lyh 81 * @author :lyh
@@ -65,7 +65,8 @@ class NewsController extends BaseController @@ -65,7 +65,8 @@ class NewsController extends BaseController
65 'source'=>4, 65 'source'=>4,
66 'project_id'=>$this->user['project_id'], 66 'project_id'=>$this->user['project_id'],
67 'source_id'=>$id, 67 'source_id'=>$id,
68 - 'template_id'=>$info['template_id'] 68 + 'template_id'=>$info['template_id'],
  69 + 'is_list'=>0
69 ]; 70 ];
70 $templateInfo = $webTemplateModel->read($param); 71 $templateInfo = $webTemplateModel->read($param);
71 if($templateInfo !== false){ 72 if($templateInfo !== false){
@@ -132,7 +132,8 @@ class ProductController extends BaseController @@ -132,7 +132,8 @@ class ProductController extends BaseController
132 'source'=>2, 132 'source'=>2,
133 'project_id'=>$this->user['project_id'], 133 'project_id'=>$this->user['project_id'],
134 'source_id'=>$id, 134 'source_id'=>$id,
135 - 'template_id'=>$info['template_id'] 135 + 'template_id'=>$info['template_id'],
  136 + 'is_list'=>0
136 ]; 137 ];
137 $templateInfo = $webTemplateModel->read($param); 138 $templateInfo = $webTemplateModel->read($param);
138 if($templateInfo !== false){ 139 if($templateInfo !== false){
@@ -248,164 +248,23 @@ class BTemplateLogic extends BaseLogic @@ -248,164 +248,23 @@ class BTemplateLogic extends BaseLogic
248 * @time :2023/10/21 16:55 248 * @time :2023/10/21 16:55
249 */ 249 */
250 public function getCommonHtml($source,$is_list,$template_id){ 250 public function getCommonHtml($source,$is_list,$template_id){
251 - $is_head = $this->user['configuration']['is_head'] ?? 0; 251 + $type = $this->getType($source,$is_list,$template_id);
252 $data = [ 252 $data = [
253 'template_id' => $template_id, 253 'template_id' => $template_id,
254 - 'project_id' => $this->user['project_id'] 254 + 'project_id' => $this->user['project_id'],
  255 + 'type'=>$type
255 ]; 256 ];
256 - if($template_id == 0){  
257 - $is_head = BTemplate::IS_HEADER;  
258 - }  
259 - if($is_head != BTemplate::IS_NO_HEADER) {  
260 - //查看页面是否设置自定义头部底部  
261 - $pageSettingModel = new PageSetting();  
262 - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);  
263 - if($pageInfo !== false){  
264 - $commonInfo = [];  
265 - if ($source == BTemplate::SOURCE_BLOG) {//产品页  
266 - $commonInfo = $this->getProductCommonHtml($data,$is_list,$pageInfo);  
267 - }  
268 - if ($source == BTemplate::SOURCE_BLOG) {//博客页  
269 - $commonInfo = $this->getBlogCommonHtml($data,$is_list,$pageInfo);  
270 - }  
271 - if ($source == BTemplate::SOURCE_NEWS) {//新闻页  
272 - $commonInfo = $this->getNewsCommonHtml($data,$is_list,$pageInfo);  
273 - }  
274 - if ($source == BTemplate::SOURCE_KEYWORD) {//聚合页  
275 - $commonInfo = $this->getKeywordCommonHtml($data,$pageInfo);  
276 - }  
277 - if(!empty($commonInfo)){  
278 - return $this->success($commonInfo);  
279 - }  
280 - }  
281 - }  
282 - //获取首页公共的头部和底部  
283 - $commonInfo = $this->getHomeCommonHtml($data);  
284 - return $commonInfo;  
285 - }  
286 -  
287 - /**  
288 - * @remark :获取首页头部底部  
289 - * @name :getHomeCommonHtml  
290 - * @author :lyh  
291 - * @method :post  
292 - * @time :2023/12/27 16:11  
293 - */  
294 - public function getHomeCommonHtml($data){  
295 - $data['type'] = BTemplate::SOURCE_HOME;  
296 - $commonTemplateModel = new BTemplateCommon();  
297 - return $commonTemplateModel->read($data);  
298 - }  
299 -  
300 - /**  
301 - * @remark :聚合页  
302 - * @name :getKeywordCommonHtml  
303 - * @author :lyh  
304 - * @method :post  
305 - * @time :2023/12/27 16:09  
306 - */  
307 - public function getKeywordCommonHtml($data,$pageInfo){  
308 - $commonInfo = [];  
309 - $commonTemplateModel = new BTemplateCommon();  
310 - $data['type'] = BTemplate::TYPE_EIGHT;  
311 - if ($pageInfo['polymerization'] != 0) {  
312 - $commonInfo = $commonTemplateModel->read($data);  
313 - if($commonInfo === false){  
314 - $commonInfo = [];  
315 - }  
316 - }  
317 - return $this->success($commonInfo);  
318 - }  
319 -  
320 - /**  
321 - * @remark :产品头部底部  
322 - * @name :getProductCommonHtml  
323 - * @author :lyh  
324 - * @method :post  
325 - * @time :2023/12/27 16:01  
326 - */  
327 - public function getProductCommonHtml($data,$is_list,$pageInfo){  
328 - $commonInfo = [];  
329 $commonTemplateModel = new BTemplateCommon(); 257 $commonTemplateModel = new BTemplateCommon();
330 - if($is_list == BTemplate::IS_LIST){  
331 - $data['type'] = BTemplate::TYPE_THREE;  
332 - if ($pageInfo['product_list'] != 0) {  
333 $commonInfo = $commonTemplateModel->read($data); 258 $commonInfo = $commonTemplateModel->read($data);
334 if($commonInfo === false){ 259 if($commonInfo === false){
335 - $commonInfo = [];  
336 - }  
337 - }  
338 - } else {  
339 - $data['type'] = BTemplate::TYPE_TWO;  
340 - if ($pageInfo['product_details'] != 0) { 260 + $data['type'] = BTemplate::SOURCE_HOME;
341 $commonInfo = $commonTemplateModel->read($data); 261 $commonInfo = $commonTemplateModel->read($data);
342 - if($commonInfo === false){  
343 - $commonInfo = [];  
344 - }  
345 - }  
346 } 262 }
347 return $this->success($commonInfo); 263 return $this->success($commonInfo);
348 } 264 }
349 265
350 - /**  
351 - * @remark :博客头部  
352 - * @name :getBlogCommonHtml  
353 - * @author :lyh  
354 - * @method :post  
355 - * @time :2023/12/27 16:05  
356 - */  
357 - public function getBlogCommonHtml($data,$is_list,$pageInfo){  
358 - $commonInfo = [];  
359 - $commonTemplateModel = new BTemplateCommon();  
360 - if ($is_list == BTemplate::IS_LIST) {  
361 - $data['type'] = BTemplate::TYPE_SEVEN;  
362 - if ($pageInfo['blog_list'] != 0) {  
363 - $commonInfo = $commonTemplateModel->read($data);  
364 - if($commonInfo === false){  
365 - $commonInfo = [];  
366 - }  
367 - }  
368 - } else {  
369 - $data['type'] = BTemplate::TYPE_SIX;  
370 - if ($pageInfo['blog_details'] != 0) {  
371 - $commonInfo = $commonTemplateModel->read($data);  
372 - if($commonInfo === false){  
373 - $commonInfo = [];  
374 - }  
375 - }  
376 - }  
377 - return $this->success($commonInfo);  
378 - }  
379 266
380 - /**  
381 - * @remark :新闻头部  
382 - * @name :getNewsCommonHtml  
383 - * @author :lyh  
384 - * @method :post  
385 - * @time :2023/12/27 16:07  
386 - */  
387 - public function getNewsCommonHtml($data,$is_list,$pageInfo){  
388 - $commonInfo = [];  
389 - $commonTemplateModel = new BTemplateCommon();  
390 - if ($is_list == BTemplate::IS_LIST) {  
391 - $data['type'] = BTemplate::TYPE_SEVEN;  
392 - if ($pageInfo['news_list'] != 0) {  
393 - $commonInfo = $commonTemplateModel->read($data);  
394 - if($commonInfo === false){  
395 - $commonInfo = [];  
396 - }  
397 - }  
398 - } else {  
399 - $data['type'] = BTemplate::TYPE_SIX;  
400 - if ($pageInfo['news_details'] != 0) {  
401 - $commonInfo = $commonTemplateModel->read($data);  
402 - if($commonInfo === false){  
403 - $commonInfo = [];  
404 - }  
405 - }  
406 - }  
407 - return $this->success($commonInfo);  
408 - } 267 +
409 268
410 /** 269 /**
411 * @remark :保存修改后的模版 270 * @remark :保存修改后的模版
@@ -436,7 +295,7 @@ class BTemplateLogic extends BaseLogic @@ -436,7 +295,7 @@ class BTemplateLogic extends BaseLogic
436 $this->model->add($data); 295 $this->model->add($data);
437 }else{//执行编辑 296 }else{//执行编辑
438 $condition = [ 297 $condition = [
439 - 'source'=>$this->param['source'], 'source_id'=>$this->param['source'], 298 + 'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],
440 'is_custom'=>$this->param['is_custom'], 'template_id'=>$this->param['template_id'], 299 'is_custom'=>$this->param['is_custom'], 'template_id'=>$this->param['template_id'],
441 'is_list'=>$this->param['is_list'] 300 'is_list'=>$this->param['is_list']
442 ]; 301 ];