|
...
|
...
|
@@ -32,6 +32,7 @@ use App\Models\Template\BTemplate; |
|
|
|
use App\Models\Template\BTemplateCom;
|
|
|
|
use App\Models\Template\BTemplateCommon;
|
|
|
|
use App\Models\Template\Setting;
|
|
|
|
use App\Models\WebSetting\Translate;
|
|
|
|
use App\Models\WebSetting\WebSettingService;
|
|
|
|
use App\Services\AmazonS3Service;
|
|
|
|
use App\Services\ProjectServer;
|
|
...
|
...
|
@@ -56,28 +57,125 @@ class Demo extends Command |
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'demo';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* @remark :根据路由获取source+source_id
|
|
|
|
* @name :getRouteSource
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/17 15:11
|
|
|
|
*/
|
|
|
|
public function getRouteSource($route){
|
|
|
|
$data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0];
|
|
|
|
if(strtolower($route) == 'all'){
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
if($route == '/'){
|
|
|
|
$data['source'] = 1;
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
$route = basename($route);
|
|
|
|
$routeModel = new RouteMap();
|
|
|
|
$routeInfo = $routeModel->read(['route'=>$route]);
|
|
|
|
return $this->resultData($routeInfo,$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :返回数据
|
|
|
|
* @name :resultData
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/20 11:54
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
public function resultData($routeInfo,$data){
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_PAGE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>9,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_BLOG){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_BLOG_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_NEWS){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_NEWS_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_MODULE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_MODULE_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handle(){
|
|
|
|
$projectModel = new Project();
|
|
|
|
$list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
|
|
|
|
$data = [];
|
|
|
|
foreach ($list as $v){
|
|
|
|
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
|
|
|
|
ProjectServer::useProject($v['id']);
|
|
|
|
DB::table('gl_web_template_com')->truncate();
|
|
|
|
$templateComModel = new BTemplateCom();
|
|
|
|
$templateComModel->truncate();
|
|
|
|
$this->saveTemplateCom($v['id']);
|
|
|
|
$translateModel = new Translate();
|
|
|
|
$translateList = $translateModel->list();
|
|
|
|
foreach ($translateList as $value){
|
|
|
|
$data = $this->getRouteSource($value['url']);
|
|
|
|
$rs = $this->model->edit($data,['id'=>$value['id']]);
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
// public function handle()
|
|
|
|
// {
|
|
|
|
// $projectModel = new Project();
|
|
|
|
// $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
|
|
|
|
// $data = [];
|
|
|
|
// foreach ($list as $v){
|
|
|
|
// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
|
|
|
|
// ProjectServer::useProject($v['id']);
|
|
|
|
// DB::table('gl_web_template_com')->truncate();
|
|
|
|
// $templateComModel = new BTemplateCom();
|
|
|
|
// $templateComModel->truncate();
|
|
|
|
// $this->saveTemplateCom($v['id']);
|
|
|
|
// DB::disconnect('custom_mysql');
|
|
|
|
// }
|
|
|
|
// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
// }
|
|
|
|
|
|
|
|
public function saveTemplateCom($project_id){
|
|
|
|
//获取当前项目选择的模版
|
|
|
|
$settingModel = new Setting();
|
...
|
...
|
|