|
...
|
...
|
@@ -12,6 +12,7 @@ namespace App\Console\Commands\LyhTest; |
|
|
|
use App\Models\CustomModule\CustomModuleCategory;
|
|
|
|
use App\Models\CustomModule\CustomModuleContent;
|
|
|
|
use App\Models\CustomModule\CustomModuleExtentContent;
|
|
|
|
use App\Models\News\News;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
...
|
...
|
@@ -33,7 +34,7 @@ class LyhImportTest extends Command |
|
|
|
*/
|
|
|
|
protected $description = '导入数据';
|
|
|
|
|
|
|
|
public $data = 'GBP201,Rectifier/Bridge Rectifier,GBP,-,100,2,1.10 ,1,60,5,250,-55~+150,-,Active,';
|
|
|
|
public $data = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :统一更新路由
|
|
...
|
...
|
@@ -43,9 +44,10 @@ class LyhImportTest extends Command |
|
|
|
* @time :2023/11/20 15:13
|
|
|
|
*/
|
|
|
|
public function handle(){
|
|
|
|
ProjectServer::useProject(2837);
|
|
|
|
ProjectServer::useProject(2385);
|
|
|
|
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
|
|
|
|
$this->importCustomModule($this->data);
|
|
|
|
// $this->importCustomModule($this->data);
|
|
|
|
$this->newsImportCustom();
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
}
|
|
...
|
...
|
@@ -106,4 +108,42 @@ class LyhImportTest extends Command |
|
|
|
$customExtendContentTModel->insert($saveData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :新闻导入到扩展模块
|
|
|
|
* @name :newsImportCustom
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/2/28 11:04
|
|
|
|
*/
|
|
|
|
public function newsImportCustom($project_id = 2385){
|
|
|
|
$newsModel = new News();
|
|
|
|
$lists = $newsModel->list(['category_id'=>',3,']);
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
$param = [
|
|
|
|
'name'=>$v['name'],
|
|
|
|
'content'=>$v['text'],
|
|
|
|
'remark'=>$v['remark'],
|
|
|
|
'route'=>$v['url'],
|
|
|
|
'image'=>$v['image'],
|
|
|
|
'seo_title'=>$v['seo_title'],
|
|
|
|
'seo_keywords'=>$v['seo_keywords'],
|
|
|
|
'seo_description'=>$v['seo_keywords'],
|
|
|
|
'project_id'=>$project_id,
|
|
|
|
'operator_id'=>$v['operator_id'],
|
|
|
|
'release_at'=>$v['release_at'],
|
|
|
|
'module_id'=>3,
|
|
|
|
'category_id'=>',2,',
|
|
|
|
];
|
|
|
|
//删除当前新闻的路由
|
|
|
|
RouteMap::delRoute(RouteMap::SOURCE_NEWS,$v['id'],$project_id);
|
|
|
|
//删除当前数据
|
|
|
|
$newsModel->del(['id'=>$v['id']]);
|
|
|
|
$customContentModel = new CustomModuleContent();
|
|
|
|
$id = $customContentModel->addReturnId($param);
|
|
|
|
$route = RouteMap::setRoute($v['route'],RouteMap::SOURCE_MODULE,$id,$project_id);
|
|
|
|
$customContentModel->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|