作者 lyh

gx

@@ -13,6 +13,7 @@ use App\Models\Blog\Blog; @@ -13,6 +13,7 @@ use App\Models\Blog\Blog;
13 use App\Models\Blog\BlogCategory; 13 use App\Models\Blog\BlogCategory;
14 use App\Models\CustomModule\CustomModule; 14 use App\Models\CustomModule\CustomModule;
15 use App\Models\CustomModule\CustomModuleCategory; 15 use App\Models\CustomModule\CustomModuleCategory;
  16 +use App\Models\CustomModule\CustomModuleContent;
16 use App\Models\News\News; 17 use App\Models\News\News;
17 use App\Models\News\NewsCategory; 18 use App\Models\News\NewsCategory;
18 use App\Models\Product\Category; 19 use App\Models\Product\Category;
@@ -62,7 +63,7 @@ class UpdateMainHtml extends Command @@ -62,7 +63,7 @@ class UpdateMainHtml extends Command
62 foreach ($list as $v){ 63 foreach ($list as $v){
63 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 64 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
64 ProjectServer::useProject($v['id']); 65 ProjectServer::useProject($v['id']);
65 - $this->setBlogCustom(); 66 + $this->setBlogCustomContent();
66 DB::disconnect('custom_mysql'); 67 DB::disconnect('custom_mysql');
67 } 68 }
68 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 69 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -97,4 +98,38 @@ class UpdateMainHtml extends Command @@ -97,4 +98,38 @@ class UpdateMainHtml extends Command
97 $cate = new CustomModuleCategory(); 98 $cate = new CustomModuleCategory();
98 $cate->insert($data); 99 $cate->insert($data);
99 } 100 }
  101 +
  102 + /**
  103 + * @remark :所有博客数据添加到自定义模块
  104 + * @name :setBlogCustom
  105 + * @author :lyh
  106 + * @method :post
  107 + * @time :2024/1/5 10:21
  108 + */
  109 + public function setBlogCustomContent(){
  110 + $data = [];
  111 + $blogModel = new Blog();
  112 + $list = $blogModel->list(['status'=>1]);
  113 + foreach ($list as $v){
  114 + echo date('Y-m-d H:i:s') . '博客分类id:'.$v['id'] . PHP_EOL;
  115 + $data[] = [
  116 + 'name'=>$v['name'],
  117 + 'content'=>$v['text'],
  118 + 'remark'=>$v['remark'],
  119 + 'route'=>$v['url'],
  120 + 'image'=>$v['image'],
  121 + 'project_id'=>99,
  122 + 'operator_id'=>366,
  123 + 'seo_title'=>$v['seo_title'],
  124 + 'seo_keywords'=>$v['seo_keywords'],
  125 + 'seo_description'=>$v['seo_des'],
  126 + 'created_at'=>$v['created_at'],
  127 + 'updated_at'=>$v['updated_at'],
  128 + 'module_id'=>7,
  129 + 'category_id'=>$v['category_id']
  130 + ];
  131 + }
  132 + $content = new CustomModuleContent();
  133 + $content->insert($data);
  134 + }
100 } 135 }