作者 lyh

gx

@@ -199,30 +199,30 @@ class ProductLogic extends BaseLogic @@ -199,30 +199,30 @@ class ProductLogic extends BaseLogic
199 * @time :2023/10/26 9:49 199 * @time :2023/10/26 9:49
200 */ 200 */
201 public function editList(){ 201 public function editList(){
202 -// $category_ids = $this->param['category_id'];  
203 -// $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); 202 + $category_ids = $this->param['category_id'];
  203 + $this->param['category_id'] = $this->handleListCategory($this->param['category_id']);
204 // $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); 204 // $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
205 -// if(isset($this->param['gallery']) && !empty($this->param['gallery'])){  
206 -// foreach ($this->param['gallery'] as $k => $v){  
207 -// $v['url'] = str_replace_url($v['url']);  
208 -// $this->param['gallery'][$k] = $v;  
209 -// }  
210 -// $this->param['thumb'] = Arr::a2s($this->param['gallery'][0] ?? []);  
211 -// $this->param['gallery'] = Arr::a2s($this->param['gallery'] ?? []);  
212 -// }else{  
213 -// unset($this->param['thumb']);  
214 -// }  
215 -// try {  
216 -// if(isset($this->param['route']) && !empty($this->param['route'])){  
217 -// $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);  
218 -// $this->editProductRoute($this->param['id'],$this->param['route']);  
219 -// }  
220 -// $this->model->edit($this->param,['id'=>$this->param['id']]);  
221 -// //产品分类关联  
222 -// CategoryRelated::saveRelated($this->param['id'], $category_ids);  
223 -// }catch (\Exception $e){  
224 -// $this->fail('系统错误,请连续管理员');  
225 -// } 205 + if(isset($this->param['gallery']) && !empty($this->param['gallery'])){
  206 + foreach ($this->param['gallery'] as $k => $v){
  207 + $v['url'] = str_replace_url($v['url']);
  208 + $this->param['gallery'][$k] = $v;
  209 + }
  210 + $this->param['thumb'] = Arr::a2s($this->param['gallery'][0] ?? []);
  211 + $this->param['gallery'] = Arr::a2s($this->param['gallery'] ?? []);
  212 + }else{
  213 + unset($this->param['thumb']);
  214 + }
  215 + try {
  216 + if(isset($this->param['route']) && !empty($this->param['route'])){
  217 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
  218 + $this->editProductRoute($this->param['id'],$this->param['route']);
  219 + }
  220 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  221 + //产品分类关联
  222 + CategoryRelated::saveRelated($this->param['id'], $category_ids);
  223 + }catch (\Exception $e){
  224 + $this->fail('系统错误,请连续管理员');
  225 + }
226 return $this->success(); 226 return $this->success();
227 } 227 }
228 228