|
1
|
-<?php
|
|
|
|
2
|
-/**
|
|
|
|
3
|
- * @remark :
|
|
|
|
4
|
- * @name :ImportCustomModule.php
|
|
|
|
5
|
- * @author :lyh
|
|
|
|
6
|
- * @method :post
|
|
|
|
7
|
- * @time :2024/12/9 11:35
|
|
|
|
8
|
- */
|
|
|
|
9
|
-
|
|
|
|
10
|
-namespace App\Console\Commands\CustomModule;
|
|
|
|
11
|
-
|
|
|
|
12
|
-use App\Models\CustomModule\CustomModuleCategory;
|
|
|
|
13
|
-use App\Models\CustomModule\CustomModuleContent;
|
|
|
|
14
|
-use App\Models\CustomModule\CustomModuleExtentContent;
|
|
|
|
15
|
-use App\Models\RouteMap\RouteMap;
|
|
|
|
16
|
-use App\Services\ProjectServer;
|
|
|
|
17
|
-use Illuminate\Console\Command;
|
|
|
|
18
|
-use Illuminate\Support\Facades\DB;
|
|
|
|
19
|
-
|
|
|
|
20
|
-class ImportCustomModule extends Command
|
|
|
|
21
|
-{
|
|
|
|
22
|
- /**
|
|
|
|
23
|
- * The name and signature of the console command.
|
|
|
|
24
|
- *
|
|
|
|
25
|
- * @var string
|
|
|
|
26
|
- */
|
|
|
|
27
|
- protected $signature = 'import_custom_module';
|
|
|
|
28
|
-
|
|
|
|
29
|
- /**
|
|
|
|
30
|
- * The console command description.
|
|
|
|
31
|
- *
|
|
|
|
32
|
- * @var string
|
|
|
|
33
|
- */
|
|
|
|
34
|
- protected $description = '特殊项目导入扩展模块及扩展数据';
|
|
|
|
35
|
-
|
|
|
|
36
|
- /**
|
|
|
|
37
|
- * @remark :导入
|
|
|
|
38
|
- * @name :handle
|
|
|
|
39
|
- * @author :lyh
|
|
|
|
40
|
- * @method :post
|
|
|
|
41
|
- * @time :2024/12/9 11:36
|
|
|
|
42
|
- */
|
|
|
|
43
|
- public function handle(){
|
|
|
|
44
|
- echo date('Y-m-d H:i:s') . 'project_id:' . PHP_EOL;
|
|
|
|
45
|
- ProjectServer::useProject(2837);
|
|
|
|
46
|
- $this->import_module_content();
|
|
|
|
47
|
- DB::disconnect('custom_mysql');
|
|
|
|
48
|
- }
|
|
|
|
49
|
-
|
|
|
|
50
|
- /**
|
|
|
|
51
|
- * @remark :导入扩展模块 (保留)
|
|
|
|
52
|
- * @name :ceshis
|
|
|
|
53
|
- * @author :lyh
|
|
|
|
54
|
- * @method :post
|
|
|
|
55
|
- * @time :2024/12/6 17:02
|
|
|
|
56
|
- */
|
|
|
|
57
|
- public function import_module_content(){
|
|
|
|
58
|
- $data = 'MBR10100CT,Rectifier/Schottky Barrier Rectifier,TO-220AB,100,5*2,common cathode,100,0.85,10,2500,175,-,Active,https://v6-file.globalso.com/upload/p/2837/files/MBR10100CT.pdf
|
|
|
|
59
|
-MBR2060BCT,Rectifier/Schottky Barrier Rectifier,ITO-220AB,60,10*2,common cathode,150,0.75,50,5000,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/MBR2060BCT.pdf
|
|
|
|
60
|
-MBR20150DCT,Rectifier/Schottky Barrier Rectifier,TO-263(D2PAK),150,10*2,common cathode,150,0.88,5,1500,175,-,Active,https://v6-file.globalso.com/upload/p/2837/files/MBR20150DCT.pdf
|
|
|
|
61
|
-MUR2060CT,Rectifier/High Efficient Rectifier,TO-220AB,600,10*2,common cathode,150,1.7,1,500,150,50,Active,https://v6-file.globalso.com/upload/p/2837/files/MUR2060CT.pdf
|
|
|
|
62
|
-MUR2040FCT,Rectifier/High Efficient Rectifier,ITO-220AB,400,10*2,common cathode,150,1.3,1,500,150,50,Active,https://v6-file.globalso.com/upload/p/2837/files/MUR2040FCT.pdf
|
|
|
|
63
|
-DSEK20S04B,Rectifier/Ultra fast soft Recovery Rectifier,TO-252(DPAK),400,10*2,common cathode,125,1.25,2,500,175,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSEK20S04B.pdf
|
|
|
|
64
|
-DSEK30S06D,Rectifier/Ultra fast soft Recovery Rectifier,TO-263(D2PAK),600,15*2,common cathode,150,1.7,2,500,175,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSEK30S06D.pdf
|
|
|
|
65
|
-DSEK60H06P,Rectifier/Ultra fast soft Recovery Rectifier,TO-247AD,600,30*2,common cathode,300,1.7,5,500,175,60,Active,https://v6-file.globalso.com/upload/p/2837/files/DSEK60H06P.pdf
|
|
|
|
66
|
-GBU410,Rectifier/Bridge Rectifier,GBU,1000,4,-,125,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU410.pdf
|
|
|
|
67
|
-GBU1510,Rectifier/Bridge Rectifier,GBU,1000,15,-,250,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU1510.pdf
|
|
|
|
68
|
-GBJ2510,Rectifier/Bridge Rectifier,GBJ,1000,25,-,300,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBJ2510.pdf
|
|
|
|
69
|
-GBU1504H,Rectifier/High Efficient Bridge Rectifier,GBU,400,15,-,150,1.3,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU1504H.pdf
|
|
|
|
70
|
-GBU1506H,Rectifier/High Efficient Bridge Rectifier,GBU,400,15,-,150,1.7,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU1506H.pdf
|
|
|
|
71
|
-GBJ2504H,Rectifier/High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.3,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBJ2504H.pdf
|
|
|
|
72
|
-GBJ2506H,Rectifier/High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.7,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBJ2506H.pdf
|
|
|
|
73
|
-1N4007,Rectifier/Standard Recovery Rectifier,DO-41,1000,1,-,50,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/1N4007.pdf
|
|
|
|
74
|
-1N5399,Rectifier/Standard Recovery Rectifier,DO-15,1000,1.5,-,75,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/1N5399.pdf
|
|
|
|
75
|
-1N5408,Rectifier/Standard Recovery Rectifier,DO-27,1000,3,-,100,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/1N5408.pdf
|
|
|
|
76
|
-RS1M,Rectifier/Fast Recovery Rectifier,SMA,1000,1,-,50,1.3,1,500,150,500,Active,https://v6-file.globalso.com/upload/p/2837/files/RS1M.pdf
|
|
|
|
77
|
-RS2M,Rectifier/Fast Recovery Rectifier,SMB,1000,2,-,75,1.3,1,500,150,500,Active,https://v6-file.globalso.com/upload/p/2837/files/RS2M.pdf
|
|
|
|
78
|
-RS3M,Rectifier/Fast Recovery Rectifier,SMC,1000,3,-,100,1.3,1,500,150,500,Active,https://v6-file.globalso.com/upload/p/2837/files/RS3M.pdf
|
|
|
|
79
|
-SF28,Rectifier/Super fast Recovery Rectifier,DO-15,600,2,-,60,1.7,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/SF28.pdf
|
|
|
|
80
|
-SF56G,Rectifier/Super fast Recovery Rectifier,DO-27,400,5,-,125,1.3,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/SF56G.pdf
|
|
|
|
81
|
-DSE1006,Rectifier/Super fast Recovery Rectifier,TO-220AC,600,10,Single Positive,150,1.7,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSE1006.pdf
|
|
|
|
82
|
-DSE1504F,Rectifier/Super fast Recovery Rectifier,ITO-220AC,400,15,Single Positive,150,1.4,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSE1504F.pdf';
|
|
|
|
83
|
- $array = explode("\n", $data);
|
|
|
|
84
|
- foreach ($array as $values){
|
|
|
|
85
|
- $array1 = explode(',',$values);
|
|
|
|
86
|
- $contentData = [
|
|
|
|
87
|
- 'name'=>$array1[0],
|
|
|
|
88
|
- 'route'=>'',
|
|
|
|
89
|
- 'project_id'=>2837,
|
|
|
|
90
|
- 'operator_id'=>6393,
|
|
|
|
91
|
- 'module_id'=>2,
|
|
|
|
92
|
- ];
|
|
|
|
93
|
- $customModuleCategoryModel = new CustomModuleCategory();
|
|
|
|
94
|
- if(!empty($array1[1])){
|
|
|
|
95
|
- $cate_ids = '';
|
|
|
|
96
|
- $cate_arr = explode('/',$array1[1]);
|
|
|
|
97
|
- foreach ($cate_arr as $cateV){
|
|
|
|
98
|
- $catInfo = $customModuleCategoryModel->read(['name'=>$cateV]);
|
|
|
|
99
|
- if($catInfo !== false){
|
|
|
|
100
|
- $cate_ids = $cate_ids.','.$catInfo['id'];
|
|
|
|
101
|
- }
|
|
|
|
102
|
- }
|
|
|
|
103
|
- $contentData['category_id'] = empty($cate_ids) ? '' : $cate_ids.',';
|
|
|
|
104
|
- }else{
|
|
|
|
105
|
- $catInfo = $customModuleCategoryModel->read(['name'=>$array1[1]]);
|
|
|
|
106
|
- if($catInfo !== false){
|
|
|
|
107
|
- $contentData['category_id'] = ','.$catInfo['id'].',';
|
|
|
|
108
|
- }
|
|
|
|
109
|
- }
|
|
|
|
110
|
- $customModuleContentModel = new CustomModuleContent();
|
|
|
|
111
|
- $contentId = $customModuleContentModel->addReturnId($contentData);
|
|
|
|
112
|
- $route = RouteMap::setRoute($array1[0],RouteMap::SOURCE_MODULE,$contentId,2837);
|
|
|
|
113
|
- $customModuleContentModel->edit(['route'=>$route],['id'=>$contentId]);
|
|
|
|
114
|
- $pd_extended_field_arr = [
|
|
|
|
115
|
- [
|
|
|
|
116
|
- 'key'=>'pd_extended_field_1',
|
|
|
|
117
|
- 'type'=>1,
|
|
|
|
118
|
- 'project_id'=>2837,
|
|
|
|
119
|
- 'values'=>$array1[2],
|
|
|
|
120
|
- 'content_id'=>$contentId,
|
|
|
|
121
|
- 'module_id'=>2,
|
|
|
|
122
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
123
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
124
|
- ],
|
|
|
|
125
|
- [
|
|
|
|
126
|
- 'key'=>'pd_extended_field_2',
|
|
|
|
127
|
- 'type'=>1,
|
|
|
|
128
|
- 'project_id'=>2837,
|
|
|
|
129
|
- 'values'=>$array1[3],
|
|
|
|
130
|
- 'module_id'=>2,
|
|
|
|
131
|
- 'content_id'=>$contentId,
|
|
|
|
132
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
133
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
134
|
- ],
|
|
|
|
135
|
- [
|
|
|
|
136
|
- 'key'=>'pd_extended_field_3',
|
|
|
|
137
|
- 'type'=>1,
|
|
|
|
138
|
- 'project_id'=>2837,
|
|
|
|
139
|
- 'values'=>$array1[4],
|
|
|
|
140
|
- 'module_id'=>2,
|
|
|
|
141
|
- 'content_id'=>$contentId,
|
|
|
|
142
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
143
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
144
|
- ],
|
|
|
|
145
|
- [
|
|
|
|
146
|
- 'key'=>'pd_extended_field_4',
|
|
|
|
147
|
- 'type'=>1,
|
|
|
|
148
|
- 'project_id'=>2837,
|
|
|
|
149
|
- 'values'=>$array1[5],
|
|
|
|
150
|
- 'module_id'=>2,
|
|
|
|
151
|
- 'content_id'=>$contentId,
|
|
|
|
152
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
153
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
154
|
- ],
|
|
|
|
155
|
- [
|
|
|
|
156
|
- 'key'=>'pd_extended_field_5',
|
|
|
|
157
|
- 'type'=>1,
|
|
|
|
158
|
- 'project_id'=>2837,
|
|
|
|
159
|
- 'values'=>$array1[6],
|
|
|
|
160
|
- 'module_id'=>2,
|
|
|
|
161
|
- 'content_id'=>$contentId,
|
|
|
|
162
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
163
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
164
|
- ],
|
|
|
|
165
|
- [
|
|
|
|
166
|
- 'key'=>'pd_extended_field_6',
|
|
|
|
167
|
- 'type'=>1,
|
|
|
|
168
|
- 'project_id'=>2837,
|
|
|
|
169
|
- 'values'=>$array1[7],
|
|
|
|
170
|
- 'module_id'=>2,
|
|
|
|
171
|
- 'content_id'=>$contentId,
|
|
|
|
172
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
173
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
174
|
- ],
|
|
|
|
175
|
- [
|
|
|
|
176
|
- 'key'=>'pd_extended_field_7',
|
|
|
|
177
|
- 'type'=>1,
|
|
|
|
178
|
- 'project_id'=>2837,
|
|
|
|
179
|
- 'values'=>$array1[8],
|
|
|
|
180
|
- 'module_id'=>2,
|
|
|
|
181
|
- 'content_id'=>$contentId,
|
|
|
|
182
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
183
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
184
|
- ],
|
|
|
|
185
|
- [
|
|
|
|
186
|
- 'key'=>'pd_extended_field_8',
|
|
|
|
187
|
- 'type'=>1,
|
|
|
|
188
|
- 'project_id'=>2837,
|
|
|
|
189
|
- 'values'=>$array1[9],
|
|
|
|
190
|
- 'module_id'=>2,
|
|
|
|
191
|
- 'content_id'=>$contentId,
|
|
|
|
192
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
193
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
194
|
- ],
|
|
|
|
195
|
- [
|
|
|
|
196
|
- 'key'=>'pd_extended_field_9',
|
|
|
|
197
|
- 'type'=>1,
|
|
|
|
198
|
- 'project_id'=>2837,
|
|
|
|
199
|
- 'values'=>$array1[10],
|
|
|
|
200
|
- 'module_id'=>2,
|
|
|
|
201
|
- 'content_id'=>$contentId,
|
|
|
|
202
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
203
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
204
|
- ],
|
|
|
|
205
|
- [
|
|
|
|
206
|
- 'key'=>'pd_extended_field_10',
|
|
|
|
207
|
- 'type'=>1,
|
|
|
|
208
|
- 'project_id'=>2837,
|
|
|
|
209
|
- 'values'=>$array1[11],
|
|
|
|
210
|
- 'module_id'=>2,
|
|
|
|
211
|
- 'content_id'=>$contentId,
|
|
|
|
212
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
213
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
214
|
- ],
|
|
|
|
215
|
- [
|
|
|
|
216
|
- 'key'=>'pd_extended_field_11',
|
|
|
|
217
|
- 'type'=>1,
|
|
|
|
218
|
- 'project_id'=>2837,
|
|
|
|
219
|
- 'values'=>$array1[12],
|
|
|
|
220
|
- 'module_id'=>2,
|
|
|
|
221
|
- 'content_id'=>$contentId,
|
|
|
|
222
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
223
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
224
|
- ],
|
|
|
|
225
|
- [
|
|
|
|
226
|
- 'key'=>'pd_extended_field_12',
|
|
|
|
227
|
- 'type'=>4,
|
|
|
|
228
|
- 'project_id'=>2837,
|
|
|
|
229
|
- 'values'=>json_encode([['url'=>$array1[13]]]),
|
|
|
|
230
|
- 'module_id'=>2,
|
|
|
|
231
|
- 'content_id'=>$contentId,
|
|
|
|
232
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
233
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
234
|
- ],
|
|
|
|
235
|
- ];
|
|
|
|
236
|
- $extendContentModel = new CustomModuleExtentContent();
|
|
|
|
237
|
- $extendContentModel->insert($pd_extended_field_arr);
|
|
|
|
238
|
- }
|
|
|
|
239
|
- }
|
|
|
|
240
|
-
|
|
|
|
241
|
-} |
|
|