作者 lyh

gx

... ... @@ -19,6 +19,7 @@ use App\Models\CustomModule\CustomModuleContent;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\Servers;
use App\Models\Devops\ServersIp;
use App\Models\ExtentModule\ExtensionModuleValue;
use App\Models\File\File;
use App\Models\File\File as FileModel;
use App\Models\File\Image;
... ... @@ -62,17 +63,172 @@ class Demo extends Command
protected $description = 'demo';
public function handle(){
$keywordVideoModel = new KeywordVideoTask();
$list = $keywordVideoModel->list();
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL;
ProjectServer::useProject($v['project_id']);
$this->getProduct();
echo date('Y-m-d H:i:s') . 'project_id:' . PHP_EOL;
ProjectServer::useProject(2837);
$this->ceshi();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
public function ceshi(){
$data = 'MBR10100CT,Schottky Barrier Rectifier,TO-220AB,100,5*2,common cathode,100,0.85,10,2500,175,-,Active
MBR2060BCT,Schottky Barrier Rectifier,ITO-220AB,60,10*2,common cathode,150,0.75,50,5000,150,-,Active
MBR20150DCT,Schottky Barrier Rectifier,TO-263(D2PAK),150,10*2,common cathode,150,0.88,5,1500,175,-,Active
MUR2060CT,High Efficient Rectifier,TO-220AB,600,10*2,common cathode,150,1.7,1,500,150,50,Active
MUR2040FCT,High Efficient Rectifier,ITO-220AB,400,10*2,common cathode,150,1.3,1,500,150,50,Active
DSEK20S04B,Ultra fast soft Recovery Rectifier,TO-252(DPAK),400,10*2,common cathode,125,1.25,2,500,175,35,Active
DSEK30S06D,Ultra fast soft Recovery Rectifier,TO-263(D2PAK),600,15*2,common cathode,150,1.7,2,500,175,35,Active
DSEK60H06P,Ultra fast soft Recovery Rectifier,TO-247AD,600,30*2,common cathode,300,1.7,5,500,175,60,Active
GBU410,Bridge Rectifier,GBU,1000,4,-,125,1,1,500,150,-,Active
GBU1510,Bridge Rectifier,GBU,1000,15,-,250,1,1,500,150,-,Active
GBJ2510,Bridge Rectifier,GBJ,1000,25,-,300,1,1,500,150,-,Active
GBU1504H,High Efficient Bridge Rectifier,GBU,400,15,-,150,1.3,1,500,150,-,Active
GBU1506H,High Efficient Bridge Rectifier,GBU,400,15,-,150,1.7,1,500,150,-,Active
GBJ2504H,High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.3,1,500,150,-,Active
GBJ2506H,High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.7,1,500,150,-,Active
1N4007,Standard Recovery Rectifier,DO-41,1000,1,-,50,1,1,500,150,-,Active
1N5399,Standard Recovery Rectifier,DO-15,1000,1.5,-,75,1,1,500,150,-,Active
1N5408,Standard Recovery Rectifier,DO-27,1000,3,-,100,1,1,500,150,-,Active
RS1M,Fast Recovery Rectifier,SMA,1000,1,-,50,1.3,1,500,150,500,Active
RS2M,Fast Recovery Rectifier,SMB,1000,2,-,75,1.3,1,500,150,500,Active
RS3M,Fast Recovery Rectifier,SMC,1000,3,-,100,1.3,1,500,150,500,Active
SF28,Super fast Recovery Rectifier,DO-15,600,2,-,60,1.7,1,500,150,35,Active
SF56G,Super fast Recovery Rectifier,DO-27,400,5,-,125,1.3,1,500,150,35,Active
DSE1006,Super fast Recovery Rectifier,TO-220AC,600,10,Single Positive,150,1.7,1,500,150,35,Active
DSE1504F,Super fast Recovery Rectifier,ITO-220AC,400,15,Single Positive,150,1.4,1,500,150,35,Active';
$array = explode("\n", $data);
foreach ($array as $values){
$array1 = explode(',',$values);
$contentData = [
'name'=>$array1[0],
'route'=>'',
'project_id'=>2837,
'operator_id'=>6393,
'module_id'=>2,
];
$customModuleContentModel = new CustomModuleContent();
$contentId = $customModuleContentModel->addReturnId($contentData);
$route = RouteMap::setRoute($data['route'],RouteMap::SOURCE_MODULE,$contentId,2837);
$customModuleContentModel->edit(['route'=>$route],['id'=>$contentId]);
$pd_extended_field_arr = [
[
'key'=>'pd_extended_field_1',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[2],
'content_id'=>$contentId,
'module_id'=>2,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_2',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[3],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_3',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[4],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_4',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[5],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_5',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[6],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_6',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[7],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_7',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[8],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_8',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[9],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_9',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[10],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_10',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[11],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_11',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[12],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
];
$extendContentModel = new ExtensionModuleValue();
$extendContentModel->insert($pd_extended_field_arr);
}
}
/**
* @remark :更新产品
* @name :getProduct
... ...
... ... @@ -32,162 +32,7 @@ class TestController extends BaseController
* @time :2024/11/11 14:51
*/
public function ceshi(){
$data = 'MBR10100CT,Schottky Barrier Rectifier,TO-220AB,100,5*2,common cathode,100,0.85,10,2500,175,-,Active
MBR2060BCT,Schottky Barrier Rectifier,ITO-220AB,60,10*2,common cathode,150,0.75,50,5000,150,-,Active
MBR20150DCT,Schottky Barrier Rectifier,TO-263(D2PAK),150,10*2,common cathode,150,0.88,5,1500,175,-,Active
MUR2060CT,High Efficient Rectifier,TO-220AB,600,10*2,common cathode,150,1.7,1,500,150,50,Active
MUR2040FCT,High Efficient Rectifier,ITO-220AB,400,10*2,common cathode,150,1.3,1,500,150,50,Active
DSEK20S04B,Ultra fast soft Recovery Rectifier,TO-252(DPAK),400,10*2,common cathode,125,1.25,2,500,175,35,Active
DSEK30S06D,Ultra fast soft Recovery Rectifier,TO-263(D2PAK),600,15*2,common cathode,150,1.7,2,500,175,35,Active
DSEK60H06P,Ultra fast soft Recovery Rectifier,TO-247AD,600,30*2,common cathode,300,1.7,5,500,175,60,Active
GBU410,Bridge Rectifier,GBU,1000,4,-,125,1,1,500,150,-,Active
GBU1510,Bridge Rectifier,GBU,1000,15,-,250,1,1,500,150,-,Active
GBJ2510,Bridge Rectifier,GBJ,1000,25,-,300,1,1,500,150,-,Active
GBU1504H,High Efficient Bridge Rectifier,GBU,400,15,-,150,1.3,1,500,150,-,Active
GBU1506H,High Efficient Bridge Rectifier,GBU,400,15,-,150,1.7,1,500,150,-,Active
GBJ2504H,High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.3,1,500,150,-,Active
GBJ2506H,High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.7,1,500,150,-,Active
1N4007,Standard Recovery Rectifier,DO-41,1000,1,-,50,1,1,500,150,-,Active
1N5399,Standard Recovery Rectifier,DO-15,1000,1.5,-,75,1,1,500,150,-,Active
1N5408,Standard Recovery Rectifier,DO-27,1000,3,-,100,1,1,500,150,-,Active
RS1M,Fast Recovery Rectifier,SMA,1000,1,-,50,1.3,1,500,150,500,Active
RS2M,Fast Recovery Rectifier,SMB,1000,2,-,75,1.3,1,500,150,500,Active
RS3M,Fast Recovery Rectifier,SMC,1000,3,-,100,1.3,1,500,150,500,Active
SF28,Super fast Recovery Rectifier,DO-15,600,2,-,60,1.7,1,500,150,35,Active
SF56G,Super fast Recovery Rectifier,DO-27,400,5,-,125,1.3,1,500,150,35,Active
DSE1006,Super fast Recovery Rectifier,TO-220AC,600,10,Single Positive,150,1.7,1,500,150,35,Active
DSE1504F,Super fast Recovery Rectifier,ITO-220AC,400,15,Single Positive,150,1.4,1,500,150,35,Active';
$array = explode("\n", $data);
foreach ($array as $values){
$array1 = explode(',',$values);
$contentData = [
'name'=>$array1[0],
'route'=>'',
'project_id'=>2837,
'operator_id'=>6393,
'module_id'=>2,
];
$customModuleContentModel = new CustomModuleContent();
$contentId = $customModuleContentModel->addReturnId($contentData);
$route = RouteMap::setRoute($data['route'],RouteMap::SOURCE_MODULE,$contentId,2837);
$customModuleContentModel->edit(['route'=>$route],['id'=>$contentId]);
$pd_extended_field_arr = [
[
'key'=>'pd_extended_field_1',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[2],
'content_id'=>$contentId,
'module_id'=>2,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_2',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[3],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_3',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[4],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_4',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[5],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_5',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[6],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_6',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[7],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_7',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[8],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_8',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[9],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_9',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[10],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_10',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[11],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_11',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[12],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
];
$extendContentModel = new ExtensionModuleValue();
$extendContentModel->insert($pd_extended_field_arr);
}
$this->response('success',Code::SUCCESS,$data);
$this->response('success',Code::SUCCESS,[]);
}
}
... ...