|
...
|
...
|
@@ -69,7 +69,8 @@ class Demo extends Command |
|
|
|
foreach ($list as $v){
|
|
|
|
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
|
|
|
|
ProjectServer::useProject($v['id']);
|
|
|
|
$this->saveTemplateCom();
|
|
|
|
DB::table('gl_web_template_com')->truncate();
|
|
|
|
$this->saveTemplateCom($v['id']);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
...
|
...
|
@@ -79,24 +80,58 @@ class Demo extends Command |
|
|
|
//获取当前项目选择的模版
|
|
|
|
$settingModel = new Setting();
|
|
|
|
$settingInfo = $settingModel->read(['project_id'=>$project_id]);
|
|
|
|
echo date('Y-m-d H:i:s') . '设置的模版:'.json_encode($settingInfo) . PHP_EOL;
|
|
|
|
if($settingInfo !== false){
|
|
|
|
$templateCommonModel = new BTemplateCommon();
|
|
|
|
$commonList = $templateCommonModel->list(['template_id'=>$settingModel['template_id']]);
|
|
|
|
$commonList = $templateCommonModel->list(['template_id'=>['in',[$settingInfo['template_id'],0]]]);
|
|
|
|
if(!empty($commonList)){
|
|
|
|
foreach ($commonList as $v){
|
|
|
|
if($v['type'] == 1){//首页头部底部
|
|
|
|
//保存一次公共头+底
|
|
|
|
|
|
|
|
}
|
|
|
|
//保存一次公共头部+底部+other信息
|
|
|
|
$bComTemplateModel = new BTemplateCom();
|
|
|
|
$param = ['template_id'=>$settingModel['template_id'],'common_type'=>BTemplate::COMMON_HEAD,'source'=>BTemplate::SOURCE_COM];
|
|
|
|
if($headInfo === false){
|
|
|
|
$headData = ['html'=>$settingModel['template_id']['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id];
|
|
|
|
$bComTemplateModel->add(array_merge($condition,$headData));
|
|
|
|
$typeArr = [1, 2, 3];
|
|
|
|
foreach ($typeArr as $type){
|
|
|
|
if($type == 1){
|
|
|
|
$headData = [
|
|
|
|
'project_id'=>$v['project_id'],
|
|
|
|
'source'=>$v['type'] == 1 ? 99 : $v['type'],
|
|
|
|
'common_type'=>1,
|
|
|
|
'template_id'=>$v['template_id'],
|
|
|
|
'html'=>$v['head_html'],
|
|
|
|
'html_style'=>$v['head_css'],
|
|
|
|
'is_custom'=>$v['is_custom'],
|
|
|
|
'is_list'=>$v['is_list']
|
|
|
|
];
|
|
|
|
$templateComModel = new BTemplateCom();
|
|
|
|
$templateComModel->add($headData);
|
|
|
|
}elseif ($type == 2){
|
|
|
|
$footerData = [
|
|
|
|
'project_id'=>$v['project_id'],
|
|
|
|
'source'=>$v['type'] == 1 ? 99 : $v['type'],
|
|
|
|
'common_type'=>2,
|
|
|
|
'template_id'=>$v['template_id'],
|
|
|
|
'html'=>$v['footer_html'],
|
|
|
|
'html_style'=>$v['footer_css'],
|
|
|
|
'is_custom'=>$v['is_custom'],
|
|
|
|
'is_list'=>$v['is_list']
|
|
|
|
];
|
|
|
|
$templateComModel = new BTemplateCom();
|
|
|
|
$templateComModel->add($footerData);
|
|
|
|
}elseif ($type == 3){
|
|
|
|
$otherData = [
|
|
|
|
'project_id'=>$v['project_id'],
|
|
|
|
'source'=>$v['type'] == 1 ? 99 : $v['type'],
|
|
|
|
'common_type'=>3,
|
|
|
|
'template_id'=>$v['template_id'],
|
|
|
|
'html'=>$v['other'],
|
|
|
|
'html_style'=>null,
|
|
|
|
'is_custom'=>$v['is_custom'],
|
|
|
|
'is_list'=>$v['is_list']
|
|
|
|
];
|
|
|
|
$templateComModel = new BTemplateCom();
|
|
|
|
$templateComModel->add($otherData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|