正在显示
1 个修改的文件
包含
18 行增加
和
12 行删除
| @@ -41,7 +41,7 @@ class ProductLogic extends BaseLogic | @@ -41,7 +41,7 @@ class ProductLogic extends BaseLogic | ||
| 41 | * @time :2023/8/21 18:35 | 41 | * @time :2023/8/21 18:35 |
| 42 | */ | 42 | */ |
| 43 | public function productSave(){ | 43 | public function productSave(){ |
| 44 | -// try { | 44 | + try { |
| 45 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 45 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 46 | $data = $this->editProduct(); | 46 | $data = $this->editProduct(); |
| 47 | }else{ | 47 | }else{ |
| @@ -51,10 +51,10 @@ class ProductLogic extends BaseLogic | @@ -51,10 +51,10 @@ class ProductLogic extends BaseLogic | ||
| 51 | KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联 | 51 | KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联 |
| 52 | $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段 | 52 | $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段 |
| 53 | $this->saveDetail($data['id'],$this->param['detail'] ?? []); | 53 | $this->saveDetail($data['id'],$this->param['detail'] ?? []); |
| 54 | -// }catch (\Exception $e){ | ||
| 55 | -// Log::info('错误信息---'.$e->getMessage()); | ||
| 56 | -// $this->fail('系统错误,请联系管理员'); | ||
| 57 | -// } | 54 | + }catch (\Exception $e){ |
| 55 | + Log::info('错误信息---'.$e->getMessage()); | ||
| 56 | + $this->fail('系统错误,请联系管理员'); | ||
| 57 | + } | ||
| 58 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? ''); | 58 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? ''); |
| 59 | $this->curlDelRoute(['new_route'=>$data['route'] ?? '']); | 59 | $this->curlDelRoute(['new_route'=>$data['route'] ?? '']); |
| 60 | return $this->success(['id'=>$data['id']]); | 60 | return $this->success(['id'=>$data['id']]); |
| @@ -112,7 +112,7 @@ class ProductLogic extends BaseLogic | @@ -112,7 +112,7 @@ class ProductLogic extends BaseLogic | ||
| 112 | */ | 112 | */ |
| 113 | public function saveDetail($product_id,$detail){ | 113 | public function saveDetail($product_id,$detail){ |
| 114 | if(!empty($detail)){ | 114 | if(!empty($detail)){ |
| 115 | -// try { | 115 | + try { |
| 116 | $this->delProductDetail($product_id); | 116 | $this->delProductDetail($product_id); |
| 117 | foreach ($detail as $val){ | 117 | foreach ($detail as $val){ |
| 118 | //查看当前栏目是否存在 | 118 | //查看当前栏目是否存在 |
| @@ -120,14 +120,16 @@ class ProductLogic extends BaseLogic | @@ -120,14 +120,16 @@ class ProductLogic extends BaseLogic | ||
| 120 | continue; | 120 | continue; |
| 121 | } | 121 | } |
| 122 | $columnId = $this->getColumnId($product_id,$val['column_name']); | 122 | $columnId = $this->getColumnId($product_id,$val['column_name']); |
| 123 | - foreach ($val['data'] as $item){ | ||
| 124 | - $save_data = $this->handleDetailParam($columnId['column_id'],$product_id,$item); | ||
| 125 | - $this->model->add($save_data); | 123 | + if(!empty($val['data']) && is_array($val['data'])){ |
| 124 | + foreach ($val['data'] as $item){ | ||
| 125 | + $save_data = $this->handleDetailParam($columnId['column_id'],$product_id,$item); | ||
| 126 | + $this->model->add($save_data); | ||
| 127 | + } | ||
| 126 | } | 128 | } |
| 127 | } | 129 | } |
| 128 | -// }catch (\Exception $e){ | ||
| 129 | -// $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage()); | ||
| 130 | -// } | 130 | + }catch (\Exception $e){ |
| 131 | + $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage()); | ||
| 132 | + } | ||
| 131 | } | 133 | } |
| 132 | return $this->success(['product_id'=>$product_id]); | 134 | return $this->success(['product_id'=>$product_id]); |
| 133 | } | 135 | } |
| @@ -535,6 +537,10 @@ class ProductLogic extends BaseLogic | @@ -535,6 +537,10 @@ class ProductLogic extends BaseLogic | ||
| 535 | return $this->success(['id'=>$save_id]); | 537 | return $this->success(['id'=>$save_id]); |
| 536 | } | 538 | } |
| 537 | 539 | ||
| 540 | + public function copyDetail(){ | ||
| 541 | + | ||
| 542 | + } | ||
| 543 | + | ||
| 538 | /** | 544 | /** |
| 539 | * @remark :复制项目扩展字段 | 545 | * @remark :复制项目扩展字段 |
| 540 | * @name :copyExtendInfo | 546 | * @name :copyExtendInfo |
-
请 注册 或 登录 后发表评论