|
@@ -12,6 +12,7 @@ namespace App\Console\Commands\LyhTest; |
|
@@ -12,6 +12,7 @@ namespace App\Console\Commands\LyhTest; |
|
12
|
use App\Models\CustomModule\CustomModuleCategory;
|
12
|
use App\Models\CustomModule\CustomModuleCategory;
|
|
13
|
use App\Models\CustomModule\CustomModuleContent;
|
13
|
use App\Models\CustomModule\CustomModuleContent;
|
|
14
|
use App\Models\CustomModule\CustomModuleExtentContent;
|
14
|
use App\Models\CustomModule\CustomModuleExtentContent;
|
|
|
|
15
|
+use App\Models\News\News;
|
|
15
|
use App\Models\RouteMap\RouteMap;
|
16
|
use App\Models\RouteMap\RouteMap;
|
|
16
|
use App\Services\ProjectServer;
|
17
|
use App\Services\ProjectServer;
|
|
17
|
use Illuminate\Console\Command;
|
18
|
use Illuminate\Console\Command;
|
|
@@ -33,7 +34,7 @@ class LyhImportTest extends Command |
|
@@ -33,7 +34,7 @@ class LyhImportTest extends Command |
|
33
|
*/
|
34
|
*/
|
|
34
|
protected $description = '导入数据';
|
35
|
protected $description = '导入数据';
|
|
35
|
|
36
|
|
|
36
|
- public $data = 'GBP201,Rectifier/Bridge Rectifier,GBP,-,100,2,1.10 ,1,60,5,250,-55~+150,-,Active,';
|
37
|
+ public $data = '';
|
|
37
|
|
38
|
|
|
38
|
/**
|
39
|
/**
|
|
39
|
* @remark :统一更新路由
|
40
|
* @remark :统一更新路由
|
|
@@ -43,9 +44,10 @@ class LyhImportTest extends Command |
|
@@ -43,9 +44,10 @@ class LyhImportTest extends Command |
|
43
|
* @time :2023/11/20 15:13
|
44
|
* @time :2023/11/20 15:13
|
|
44
|
*/
|
45
|
*/
|
|
45
|
public function handle(){
|
46
|
public function handle(){
|
|
46
|
- ProjectServer::useProject(2837);
|
47
|
+ ProjectServer::useProject(2385);
|
|
47
|
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
|
48
|
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
|
|
48
|
- $this->importCustomModule($this->data);
|
49
|
+// $this->importCustomModule($this->data);
|
|
|
|
50
|
+ $this->newsImportCustom();
|
|
49
|
DB::disconnect('custom_mysql');
|
51
|
DB::disconnect('custom_mysql');
|
|
50
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
52
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
51
|
}
|
53
|
}
|
|
@@ -106,4 +108,42 @@ class LyhImportTest extends Command |
|
@@ -106,4 +108,42 @@ class LyhImportTest extends Command |
|
106
|
$customExtendContentTModel->insert($saveData);
|
108
|
$customExtendContentTModel->insert($saveData);
|
|
107
|
}
|
109
|
}
|
|
108
|
}
|
110
|
}
|
|
|
|
111
|
+
|
|
|
|
112
|
+ /**
|
|
|
|
113
|
+ * @remark :新闻导入到扩展模块
|
|
|
|
114
|
+ * @name :newsImportCustom
|
|
|
|
115
|
+ * @author :lyh
|
|
|
|
116
|
+ * @method :post
|
|
|
|
117
|
+ * @time :2025/2/28 11:04
|
|
|
|
118
|
+ */
|
|
|
|
119
|
+ public function newsImportCustom($project_id = 2385){
|
|
|
|
120
|
+ $newsModel = new News();
|
|
|
|
121
|
+ $lists = $newsModel->list(['category_id'=>',3,']);
|
|
|
|
122
|
+ foreach ($lists as $k => $v){
|
|
|
|
123
|
+ $param = [
|
|
|
|
124
|
+ 'name'=>$v['name'],
|
|
|
|
125
|
+ 'content'=>$v['text'],
|
|
|
|
126
|
+ 'remark'=>$v['remark'],
|
|
|
|
127
|
+ 'route'=>$v['url'],
|
|
|
|
128
|
+ 'image'=>$v['image'],
|
|
|
|
129
|
+ 'seo_title'=>$v['seo_title'],
|
|
|
|
130
|
+ 'seo_keywords'=>$v['seo_keywords'],
|
|
|
|
131
|
+ 'seo_description'=>$v['seo_keywords'],
|
|
|
|
132
|
+ 'project_id'=>$project_id,
|
|
|
|
133
|
+ 'operator_id'=>$v['operator_id'],
|
|
|
|
134
|
+ 'release_at'=>$v['release_at'],
|
|
|
|
135
|
+ 'module_id'=>3,
|
|
|
|
136
|
+ 'category_id'=>',2,',
|
|
|
|
137
|
+ ];
|
|
|
|
138
|
+ //删除当前新闻的路由
|
|
|
|
139
|
+ RouteMap::delRoute(RouteMap::SOURCE_NEWS,$v['id'],$project_id);
|
|
|
|
140
|
+ //删除当前数据
|
|
|
|
141
|
+ $newsModel->del(['id'=>$v['id']]);
|
|
|
|
142
|
+ $customContentModel = new CustomModuleContent();
|
|
|
|
143
|
+ $id = $customContentModel->addReturnId($param);
|
|
|
|
144
|
+ $route = RouteMap::setRoute($v['route'],RouteMap::SOURCE_MODULE,$id,$project_id);
|
|
|
|
145
|
+ $customContentModel->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
146
|
+ }
|
|
|
|
147
|
+ return true;
|
|
|
|
148
|
+ }
|
|
109
|
} |
149
|
} |