|
@@ -41,20 +41,15 @@ class ProductLogic extends BaseLogic |
|
@@ -41,20 +41,15 @@ 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 {
|
|
|
|
45
|
- if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
46
|
- $data = $this->editProduct();
|
|
|
|
47
|
- }else{
|
|
|
|
48
|
- $data = $this->addProduct();
|
|
|
|
49
|
- }
|
|
|
|
50
|
- CategoryRelated::saveRelated($data['id'], $this->param['category_id'] ?? []);//分类关联
|
|
|
|
51
|
- KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联
|
|
|
|
52
|
- $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段
|
|
|
|
53
|
- $this->saveDetail($data['id'],$this->param['detail'] ?? []);
|
|
|
|
54
|
- }catch (\Exception $e){
|
|
|
|
55
|
- Log::info('错误信息---'.$e->getMessage());
|
|
|
|
56
|
- $this->fail('系统错误,请联系管理员');
|
44
|
+ if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
45
|
+ $data = $this->editProduct();
|
|
|
|
46
|
+ }else{
|
|
|
|
47
|
+ $data = $this->addProduct();
|
|
57
|
}
|
48
|
}
|
|
|
|
49
|
+ CategoryRelated::saveRelated($data['id'], $this->param['category_id'] ?? []);//分类关联
|
|
|
|
50
|
+ KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联
|
|
|
|
51
|
+ $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段
|
|
|
|
52
|
+ $this->saveDetail($data['id'],$this->param['detail'] ?? []);
|
|
58
|
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? '');
|
53
|
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? '');
|
|
59
|
$this->curlDelRoute(['new_route'=>$data['route'] ?? '']);
|
54
|
$this->curlDelRoute(['new_route'=>$data['route'] ?? '']);
|
|
60
|
return $this->success(['id'=>$data['id']]);
|
55
|
return $this->success(['id'=>$data['id']]);
|