作者 lyh

gx

@@ -12,6 +12,7 @@ namespace App\Console\Commands; @@ -12,6 +12,7 @@ namespace App\Console\Commands;
12 use App\Models\Blog\Blog; 12 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\News\News; 16 use App\Models\News\News;
16 use App\Models\News\NewsCategory; 17 use App\Models\News\NewsCategory;
17 use App\Models\Product\Category; 18 use App\Models\Product\Category;
@@ -57,31 +58,43 @@ class UpdateMainHtml extends Command @@ -57,31 +58,43 @@ class UpdateMainHtml extends Command
57 */ 58 */
58 public function handle(){ 59 public function handle(){
59 $projectModel = new Project(); 60 $projectModel = new Project();
60 - $list = $projectModel->list(['type'=>['!=',0]]); 61 + $list = $projectModel->list(['id'=>99]);
61 foreach ($list as $v){ 62 foreach ($list as $v){
62 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 63 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
63 ProjectServer::useProject($v['id']); 64 ProjectServer::useProject($v['id']);
64 - $this->initModule($v['id']); 65 + $this->setBlogCustom();
65 DB::disconnect('custom_mysql'); 66 DB::disconnect('custom_mysql');
66 } 67 }
67 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 68 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
68 } 69 }
69 70
70 - public function initModule($project_id){  
71 - $moduleModel = new CustomModule();  
72 - $info = $moduleModel->read(['route'=>'video']);  
73 - if($info === false){  
74 - $info = $moduleModel->read(['name'=>'视频模块']);  
75 - if($info === false){  
76 - $data = [  
77 - 'name'=>'视频模块',  
78 - 'project_id'=>$project_id,  
79 - 'route'=>'video', 71 + /**
  72 + * @remark :所有博客数据添加到自定义模块
  73 + * @name :setBlogCustom
  74 + * @author :lyh
  75 + * @method :post
  76 + * @time :2024/1/5 10:21
  77 + */
  78 + public function setBlogCustom(){
  79 + $data = [];
  80 + $blogCategoryModel = new BlogCategory();
  81 + $list = $blogCategoryModel->list(['status'=>0]);
  82 + foreach ($list as $v){
  83 + echo date('Y-m-d H:i:s') . '博客分类id:'.$v['id'] . PHP_EOL;
  84 + $data[] = [
  85 + 'name'=>$v['name'],
  86 + 'route'=>$v['alias'],
  87 + 'project_id'=>99,
  88 + 'operator_id'=>366,
  89 + 'seo_title'=>$v['seo_title'],
  90 + 'seo_keywords'=>$v['seo_keywords'],
  91 + 'seo_description'=>$v['seo_des'],
  92 + 'created_at'=>$v['created_at'],
  93 + 'updated_at'=>$v['updated_at'],
  94 + 'module_id'=>7
80 ]; 95 ];
81 - $moduleModel->add($data);  
82 - }  
83 } 96 }
84 - return true; 97 + $cate = new CustomModuleCategory();
  98 + $cate->insert($data);
85 } 99 }
86 -  
87 } 100 }