Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate
正在显示
1 个修改的文件
包含
47 行增加
和
12 行删除
| @@ -69,7 +69,8 @@ class Demo extends Command | @@ -69,7 +69,8 @@ class Demo extends Command | ||
| 69 | foreach ($list as $v){ | 69 | foreach ($list as $v){ |
| 70 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 70 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 71 | ProjectServer::useProject($v['id']); | 71 | ProjectServer::useProject($v['id']); |
| 72 | - $this->saveTemplateCom(); | 72 | + DB::table('gl_web_template_com')->truncate(); |
| 73 | + $this->saveTemplateCom($v['id']); | ||
| 73 | DB::disconnect('custom_mysql'); | 74 | DB::disconnect('custom_mysql'); |
| 74 | } | 75 | } |
| 75 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 76 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -79,24 +80,58 @@ class Demo extends Command | @@ -79,24 +80,58 @@ class Demo extends Command | ||
| 79 | //获取当前项目选择的模版 | 80 | //获取当前项目选择的模版 |
| 80 | $settingModel = new Setting(); | 81 | $settingModel = new Setting(); |
| 81 | $settingInfo = $settingModel->read(['project_id'=>$project_id]); | 82 | $settingInfo = $settingModel->read(['project_id'=>$project_id]); |
| 83 | + echo date('Y-m-d H:i:s') . '设置的模版:'.json_encode($settingInfo) . PHP_EOL; | ||
| 82 | if($settingInfo !== false){ | 84 | if($settingInfo !== false){ |
| 83 | $templateCommonModel = new BTemplateCommon(); | 85 | $templateCommonModel = new BTemplateCommon(); |
| 84 | - $commonList = $templateCommonModel->list(['template_id'=>$settingModel['template_id']]); | 86 | + $commonList = $templateCommonModel->list(['template_id'=>['in',[$settingInfo['template_id'],0]]]); |
| 85 | if(!empty($commonList)){ | 87 | if(!empty($commonList)){ |
| 86 | foreach ($commonList as $v){ | 88 | foreach ($commonList as $v){ |
| 87 | - if($v['type'] == 1){//首页头部底部 | ||
| 88 | - //保存一次公共头+底 | ||
| 89 | - | ||
| 90 | - } | ||
| 91 | - //保存一次公共头部+底部+other信息 | ||
| 92 | - $bComTemplateModel = new BTemplateCom(); | ||
| 93 | - $param = ['template_id'=>$settingModel['template_id'],'common_type'=>BTemplate::COMMON_HEAD,'source'=>BTemplate::SOURCE_COM]; | ||
| 94 | - if($headInfo === false){ | ||
| 95 | - $headData = ['html'=>$settingModel['template_id']['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id]; | ||
| 96 | - $bComTemplateModel->add(array_merge($condition,$headData)); | 89 | + $typeArr = [1, 2, 3]; |
| 90 | + foreach ($typeArr as $type){ | ||
| 91 | + if($type == 1){ | ||
| 92 | + $headData = [ | ||
| 93 | + 'project_id'=>$v['project_id'], | ||
| 94 | + 'source'=>$v['type'] == 1 ? 99 : $v['type'], | ||
| 95 | + 'common_type'=>1, | ||
| 96 | + 'template_id'=>$v['template_id'], | ||
| 97 | + 'html'=>$v['head_html'], | ||
| 98 | + 'html_style'=>$v['head_css'], | ||
| 99 | + 'is_custom'=>$v['is_custom'], | ||
| 100 | + 'is_list'=>$v['is_list'] | ||
| 101 | + ]; | ||
| 102 | + $templateComModel = new BTemplateCom(); | ||
| 103 | + $templateComModel->add($headData); | ||
| 104 | + }elseif ($type == 2){ | ||
| 105 | + $footerData = [ | ||
| 106 | + 'project_id'=>$v['project_id'], | ||
| 107 | + 'source'=>$v['type'] == 1 ? 99 : $v['type'], | ||
| 108 | + 'common_type'=>2, | ||
| 109 | + 'template_id'=>$v['template_id'], | ||
| 110 | + 'html'=>$v['footer_html'], | ||
| 111 | + 'html_style'=>$v['footer_css'], | ||
| 112 | + 'is_custom'=>$v['is_custom'], | ||
| 113 | + 'is_list'=>$v['is_list'] | ||
| 114 | + ]; | ||
| 115 | + $templateComModel = new BTemplateCom(); | ||
| 116 | + $templateComModel->add($footerData); | ||
| 117 | + }elseif ($type == 3){ | ||
| 118 | + $otherData = [ | ||
| 119 | + 'project_id'=>$v['project_id'], | ||
| 120 | + 'source'=>$v['type'] == 1 ? 99 : $v['type'], | ||
| 121 | + 'common_type'=>3, | ||
| 122 | + 'template_id'=>$v['template_id'], | ||
| 123 | + 'html'=>$v['other'], | ||
| 124 | + 'html_style'=>null, | ||
| 125 | + 'is_custom'=>$v['is_custom'], | ||
| 126 | + 'is_list'=>$v['is_list'] | ||
| 127 | + ]; | ||
| 128 | + $templateComModel = new BTemplateCom(); | ||
| 129 | + $templateComModel->add($otherData); | ||
| 130 | + } | ||
| 97 | } | 131 | } |
| 98 | } | 132 | } |
| 99 | } | 133 | } |
| 100 | } | 134 | } |
| 135 | + return true; | ||
| 101 | } | 136 | } |
| 102 | } | 137 | } |
-
请 注册 或 登录 后发表评论