作者 lyh

更新产品扩展字段

@@ -103,25 +103,25 @@ class ProductLogic extends BaseLogic @@ -103,25 +103,25 @@ 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){ 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 + }
108 unset($v['title']); 113 unset($v['title']);
109 - if(!empty($v['values'])){  
110 if($v['type'] == 3 || $v['type'] == 4){ 114 if($v['type'] == 3 || $v['type'] == 4){
111 - if(is_array($v['values'])){  
112 foreach ($v['values'] as $k1=>$v1){ 115 foreach ($v['values'] as $k1=>$v1){
113 $v1 = str_replace_url($v1); 116 $v1 = str_replace_url($v1);
114 $v['values'][$k1] = $v1; 117 $v['values'][$k1] = $v1;
115 } 118 }
116 $v['values'] = json_encode($v['values']); 119 $v['values'] = json_encode($v['values']);
117 } 120 }
118 - }  
119 $v['project_id'] = $this->user['project_id']; 121 $v['project_id'] = $this->user['project_id'];
120 $v['product_id'] = $project_id; 122 $v['product_id'] = $project_id;
121 $extendInfoModel->add($v); 123 $extendInfoModel->add($v);
122 } 124 }
123 - }  
124 - }  
125 return $this->success(); 125 return $this->success();
126 } 126 }
127 127