正在显示
1 个修改的文件
包含
12 行增加
和
10 行删除
| @@ -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,31 +80,32 @@ class Demo extends Command | @@ -79,31 +80,32 @@ 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(['id'=>1,'template_id'=>$settingModel['template_id'],'is_custom'=>0]); | 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 | - $typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER]; | 89 | + $typeArr = [1, 2, 3]; |
| 88 | foreach ($typeArr as $type){ | 90 | foreach ($typeArr as $type){ |
| 89 | - if($type == BTemplate::COMMON_HEAD){ | 91 | + if($type == 1){ |
| 90 | $headData = [ | 92 | $headData = [ |
| 91 | 'project_id'=>$v['project_id'], | 93 | 'project_id'=>$v['project_id'], |
| 92 | 'source'=>$v['type'] == 1 ? 99 : $v['type'], | 94 | 'source'=>$v['type'] == 1 ? 99 : $v['type'], |
| 93 | - 'common_type'=>BTemplate::COMMON_HEAD, | 95 | + 'common_type'=>1, |
| 94 | 'template_id'=>$v['template_id'], | 96 | 'template_id'=>$v['template_id'], |
| 95 | 'html'=>$v['head_html'], | 97 | 'html'=>$v['head_html'], |
| 96 | 'html_style'=>$v['head_css'], | 98 | 'html_style'=>$v['head_css'], |
| 97 | 'is_custom'=>$v['is_custom'], | 99 | 'is_custom'=>$v['is_custom'], |
| 98 | - 'is_list'=>$v['list'] | 100 | + 'is_list'=>$v['is_list'] |
| 99 | ]; | 101 | ]; |
| 100 | $templateComModel = new BTemplateCom(); | 102 | $templateComModel = new BTemplateCom(); |
| 101 | $templateComModel->add($headData); | 103 | $templateComModel->add($headData); |
| 102 | - }elseif ($type == BTemplate::COMMON_FOOTER){ | 104 | + }elseif ($type == 2){ |
| 103 | $footerData = [ | 105 | $footerData = [ |
| 104 | 'project_id'=>$v['project_id'], | 106 | 'project_id'=>$v['project_id'], |
| 105 | 'source'=>$v['type'] == 1 ? 99 : $v['type'], | 107 | 'source'=>$v['type'] == 1 ? 99 : $v['type'], |
| 106 | - 'common_type'=>BTemplate::COMMON_FOOTER, | 108 | + 'common_type'=>2, |
| 107 | 'template_id'=>$v['template_id'], | 109 | 'template_id'=>$v['template_id'], |
| 108 | 'html'=>$v['footer_html'], | 110 | 'html'=>$v['footer_html'], |
| 109 | 'html_style'=>$v['footer_css'], | 111 | 'html_style'=>$v['footer_css'], |
| @@ -112,11 +114,11 @@ class Demo extends Command | @@ -112,11 +114,11 @@ class Demo extends Command | ||
| 112 | ]; | 114 | ]; |
| 113 | $templateComModel = new BTemplateCom(); | 115 | $templateComModel = new BTemplateCom(); |
| 114 | $templateComModel->add($footerData); | 116 | $templateComModel->add($footerData); |
| 115 | - }elseif ($type == BTemplate::COMMON_OTHER){ | 117 | + }elseif ($type == 3){ |
| 116 | $otherData = [ | 118 | $otherData = [ |
| 117 | 'project_id'=>$v['project_id'], | 119 | 'project_id'=>$v['project_id'], |
| 118 | 'source'=>$v['type'] == 1 ? 99 : $v['type'], | 120 | 'source'=>$v['type'] == 1 ? 99 : $v['type'], |
| 119 | - 'common_type'=>BTemplate::COMMON_OTHER, | 121 | + 'common_type'=>3, |
| 120 | 'template_id'=>$v['template_id'], | 122 | 'template_id'=>$v['template_id'], |
| 121 | 'html'=>$v['other'], | 123 | 'html'=>$v['other'], |
| 122 | 'html_style'=>null, | 124 | 'html_style'=>null, |
-
请 注册 或 登录 后发表评论