作者 lyh

gx

... ... @@ -52,26 +52,137 @@ class Demo extends Command
protected $description = 'demo';
public function handle(){
ProjectServer::useProject(1462);
$customContentModel = new CustomModuleContent();
$contentLists = $customContentModel->list(['module_id'=>8]);
foreach ($contentLists as $v){
if(!empty($v['category_id']) && is_array($v['category_id'])){
$v['category_id'] = ','.implode(',',$v['category_id']).',';
$str = '[
{
"name": "产品列表",
"source": 2,
"is_list": 1,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "产品详情",
"source": 2,
"is_list": 0,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "博客列表",
"source": 3,
"is_list": 1,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "博客详情",
"source": 3,
"is_list": 0,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "新闻列表",
"source": 4,
"is_list": 1,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "新闻详情",
"source": 4,
"is_list": 0,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "首页",
"source": 1,
"is_list": 0,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "单页面",
"source": 6,
"is_list": 0,
"is_custom": 0,
"header_status": 0,
"footer_status": 0
},
{
"name": "测试定制2列表",
"source": 12,
"is_list": 1,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
},
{
"name": "测试定制2详情",
"source": 12,
"is_list": 0,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
},
{
"name": "测试定制1列表",
"source": 11,
"is_list": 1,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
},
{
"name": "测试定制1详情",
"source": 11,
"is_list": 0,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
},
{
"name": "test列表",
"source": 10,
"is_list": 1,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
},
{
"name": "test详情",
"source": 10,
"is_list": 0,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
},
{
"name": "测试模块列表",
"source": 9,
"is_list": 1,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
},
{
"name": "测试模块详情",
"source": 9,
"is_list": 0,
"is_custom": 1,
"header_status": 0,
"footer_status": 0
}
if(!empty($v['video'])){
$v['video'] = Arr::a2s($v['video']);
}
unset($v['id'],$v['created_at'],$v['updated_at']);
$v['url'] = $v['route'];
$blogModel = new Blog();
$id = $blogModel->addReturnId($v);
if($id){
$route = RouteMap::setRoute($v['route'],RouteMap::SOURCE_BLOG,$id,1462);
$blogModel->edit(['url'=>$route],['id'=>$id]);
}
}
DB::disconnect('custom_mysql');
]';
return json_encode($str);
}
public function synchronizationFile($path_name){
... ...