作者 lyh

更新产品扩展字段

@@ -103,24 +103,24 @@ class ProductLogic extends BaseLogic @@ -103,24 +103,24 @@ class ProductLogic extends BaseLogic
103 //先删除以前的数据 103 //先删除以前的数据
104 $extendInfoModel = new ExtendInfo(); 104 $extendInfoModel = new ExtendInfo();
105 $extendInfoModel->del(['project_id'=>$project_id]); 105 $extendInfoModel->del(['project_id'=>$project_id]);
106 - if(!empty($extend)){  
107 - foreach ($extend as $v){  
108 - unset($v['title']);  
109 - if(!empty($v['values'])){  
110 - if($v['type'] == 3 || $v['type'] == 4){  
111 - if(is_array($v['values'])){  
112 - foreach ($v['values'] as $k1=>$v1){  
113 - $v1 = str_replace_url($v1);  
114 - $v['values'][$k1] = $v1;  
115 - }  
116 - $v['values'] = json_encode($v['values']);  
117 - }  
118 - }  
119 - $v['project_id'] = $this->user['project_id'];  
120 - $v['product_id'] = $project_id;  
121 - $extendInfoModel->add($v); 106 + if(empty($extend)) {
  107 + return $this->success();
  108 + }
  109 + foreach ($extend as $k => $v){
  110 + if(empty($v['values'])){
  111 + unset($extend[$k]);
  112 + }
  113 + unset($v['title']);
  114 + if($v['type'] == 3 || $v['type'] == 4){
  115 + foreach ($v['values'] as $k1=>$v1){
  116 + $v1 = str_replace_url($v1);
  117 + $v['values'][$k1] = $v1;
122 } 118 }
  119 + $v['values'] = json_encode($v['values']);
123 } 120 }
  121 + $v['project_id'] = $this->user['project_id'];
  122 + $v['product_id'] = $project_id;
  123 + $extendInfoModel->add($v);
124 } 124 }
125 return $this->success(); 125 return $this->success();
126 } 126 }