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