作者 lyh

gx

@@ -69,15 +69,17 @@ class OnlineCheckLogic extends BaseLogic @@ -69,15 +69,17 @@ class OnlineCheckLogic extends BaseLogic
69 */ 69 */
70 public function saveOnlineCheck(){ 70 public function saveOnlineCheck(){
71 $info = $this->model->read(['project_id'=>$this->param['id']]); 71 $info = $this->model->read(['project_id'=>$this->param['id']]);
  72 + $projectModel = new Project();
72 if($info !== false){ 73 if($info !== false){
  74 + $projectInfo = $projectModel->read(['id'=>$this->param['id']],['id','status']);
  75 + if($projectInfo['status'] != $projectModel::STATUS_ONE){
  76 + $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$projectInfo['id']]);
  77 + }
73 $this->fail('已提交,请勿重复提交'); 78 $this->fail('已提交,请勿重复提交');
74 }else{ 79 }else{
75 if(($this->param['optimist_mid'] == 0) || ($this->param['qa_mid'] == 0)){ 80 if(($this->param['optimist_mid'] == 0) || ($this->param['qa_mid'] == 0)){
76 $this->fail('请先选择优化师和品控,在提交审核'); 81 $this->fail('请先选择优化师和品控,在提交审核');
77 } 82 }
78 - $projectModel = new Project();  
79 - //提交审核修改状态为审核中  
80 - $projectModel->edit(['status'=>1],['id'=>$this->param['id']]);  
81 //组装数据 83 //组装数据
82 $data = [ 84 $data = [
83 'project_id' => $this->param['id'], 85 'project_id' => $this->param['id'],
@@ -86,9 +88,11 @@ class OnlineCheckLogic extends BaseLogic @@ -86,9 +88,11 @@ class OnlineCheckLogic extends BaseLogic
86 'qa_mid' => $this->param['qa_mid'], 88 'qa_mid' => $this->param['qa_mid'],
87 'created_at'=>date('Y-m-d H:i:s') 89 'created_at'=>date('Y-m-d H:i:s')
88 ]; 90 ];
89 - $rs = $this->model->add($data);  
90 - if($rs === false){  
91 - $this->fail('error'); 91 + try {
  92 + $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]);
  93 + $this->model->add($data);
  94 + }catch (\Exception $e){
  95 + $this->fail('提交失败,请联系开发人员');
92 } 96 }
93 } 97 }
94 return $this->success(); 98 return $this->success();
@@ -55,8 +55,7 @@ class BTemplateLogLogic extends BaseLogic @@ -55,8 +55,7 @@ class BTemplateLogLogic extends BaseLogic
55 } 55 }
56 try { 56 try {
57 $data = $this->setParam($info); 57 $data = $this->setParam($info);
58 - $BTemplateModel = new BTemplate();  
59 - $BTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); 58 + $bTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);
60 $commonData = $this->setCommonParam($info); 59 $commonData = $this->setCommonParam($info);
61 $commonTemplateModel = new BTemplateCommon(); 60 $commonTemplateModel = new BTemplateCommon();
62 $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]); 61 $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]);
@@ -80,6 +80,17 @@ class BTemplateLogic extends BaseLogic @@ -80,6 +80,17 @@ class BTemplateLogic extends BaseLogic
80 } 80 }
81 81
82 /** 82 /**
  83 + * @remark :查看首页是否可视化
  84 + * @name :getTemplateHtml
  85 + * @author :lyh
  86 + * @method :post
  87 + * @time :2023/12/13 9:50
  88 + */
  89 + public function watchHomeISVisualization(){
  90 +
  91 + }
  92 +
  93 + /**
83 * @remark :根据参数获取数据详情 94 * @remark :根据参数获取数据详情
84 * @name :webTemplateInfo 95 * @name :webTemplateInfo
85 * @author :lyh 96 * @author :lyh
@@ -76,13 +76,13 @@ class VisualizationLogic extends BaseLogic @@ -76,13 +76,13 @@ class VisualizationLogic extends BaseLogic
76 */ 76 */
77 public function getSource($type){ 77 public function getSource($type){
78 $source_id = 0; 78 $source_id = 0;
79 - if ($type == 2){$source = 2;$source_id = 1;  
80 - }elseif ($type == 3){$source = 2;  
81 - }elseif ($type == 4){$source = 3;$source_id = 1;  
82 - }elseif ($type == 5){$source = 3;  
83 - }elseif ($type == 6){$source = 4;$source_id = 1;  
84 - }elseif ($type == 7){$source = 4;  
85 - }else{$source = 1;} 79 + if ($type == BTemplate::TYPE_TWO){$source = BTemplate::SOURCE_PRODUCT;$source_id = 1;
  80 + }elseif ($type == BTemplate::TYPE_THREE){$source = BTemplate::SOURCE_PRODUCT;
  81 + }elseif ($type == BTemplate::TYPE_FOUR){$source = BTemplate::SOURCE_BLOG;$source_id = 1;
  82 + }elseif ($type == BTemplate::TYPE_FIVE){$source = BTemplate::SOURCE_BLOG;
  83 + }elseif ($type == BTemplate::TYPE_SIX){$source = BTemplate::SOURCE_NEWS;$source_id = 1;
  84 + }elseif ($type == BTemplate::TYPE_SEVEN){$source = BTemplate::SOURCE_NEWS;
  85 + }else{$source = BTemplate::SOURCE_HOME;}
86 return ['source'=>$source,'source_id'=>$source_id]; 86 return ['source'=>$source,'source_id'=>$source_id];
87 } 87 }
88 88
@@ -271,15 +271,15 @@ class VisualizationLogic extends BaseLogic @@ -271,15 +271,15 @@ class VisualizationLogic extends BaseLogic
271 * @time :2023/11/16 11:20 271 * @time :2023/11/16 11:20
272 */ 272 */
273 public function getType($source,$source_id){ 273 public function getType($source,$source_id){
274 - $type = 1;  
275 - if($source == 2){  
276 - if($source_id == 0){$type = 3;}else{$type = 2;} 274 + $type = BTemplate::TYPE_ONE;
  275 + if($source == BTemplate::SOURCE_PRODUCT){
  276 + if($source_id == 0){$type = BTemplate::TYPE_THREE;}else{$type = BTemplate::TYPE_TWO;}
277 } 277 }
278 - if($source == 3){  
279 - if($source_id == 0){$type = 5;}else{$type = 4;} 278 + if($source == BTemplate::SOURCE_BLOG){
  279 + if($source_id == 0){$type = BTemplate::TYPE_FIVE;}else{$type = BTemplate::TYPE_FOUR;}
280 } 280 }
281 - if($source == 4){  
282 - if($source_id == 0){$type = 7;}else{$type = 6;} 281 + if($source == BTemplate::SOURCE_NEWS){
  282 + if($source_id == 0){$type = BTemplate::TYPE_SEVEN;}else{$type = BTemplate::TYPE_SIX;}
283 } 283 }
284 return $type; 284 return $type;
285 } 285 }
@@ -412,7 +412,9 @@ class VisualizationLogic extends BaseLogic @@ -412,7 +412,9 @@ class VisualizationLogic extends BaseLogic
412 $this->param['main_html'] = characterTruncation($param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'); 412 $this->param['main_html'] = characterTruncation($param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
413 $this->param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 413 $this->param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
414 //保存头部 414 //保存头部
415 - $this->saveCommonTemplate($param['html'],$param['source'],$param['source_id'],$param['template_id']); 415 + if($param['is_custom'] == BTemplate::SOURCE_NO_CUSTOM){//非扩展模块才可以保存头底
  416 + $this->saveCommonTemplate($param['html'],$param['source'],$param['source_id'],$param['template_id']);
  417 + }
416 if($templateInfo === false){ 418 if($templateInfo === false){
417 $param['project_id'] = $this->user['project_id']; 419 $param['project_id'] = $this->user['project_id'];
418 $bTemplateModel->add($param); 420 $bTemplateModel->add($param);
@@ -38,17 +38,9 @@ class Manage extends Base @@ -38,17 +38,9 @@ class Manage extends Base
38 */ 38 */
39 public function getName($id){ 39 public function getName($id){
40 $name = ''; 40 $name = '';
41 - if(!empty($id)){  
42 - $info = Common::get_user_cache('manager',$id,'A');  
43 - if(empty($info)){  
44 - $info = $this->read(['id'=>$id],['id','name']);  
45 - if($info !== false){  
46 - $name = $info['name'];  
47 - Common::set_user_cache($info,'manager',$id,'A');  
48 - }  
49 - }else{  
50 - $name = $info['name'];  
51 - } 41 + $info = $this->read(['id'=>$id],['id','name']);
  42 + if($info !== false){
  43 + $name = $info['name'];
52 } 44 }
53 return $name; 45 return $name;
54 } 46 }
@@ -19,6 +19,8 @@ class BTemplate extends Base @@ -19,6 +19,8 @@ class BTemplate extends Base
19 const SOURCE_KEYWORD = 5;//聚合页 19 const SOURCE_KEYWORD = 5;//聚合页
20 20
21 const SOURCE_CUSTOM = 1;//自定义模块 21 const SOURCE_CUSTOM = 1;//自定义模块
  22 +
  23 + const SOURCE_NO_CUSTOM = 0;//默认模块
22 const STATUS = 0; 24 const STATUS = 0;
23 25
24 const TYPE_ONE = 1;//首页类型 26 const TYPE_ONE = 1;//首页类型