|
...
|
...
|
@@ -41,20 +41,15 @@ class ProductLogic extends BaseLogic |
|
|
|
* @time :2023/8/21 18:35
|
|
|
|
*/
|
|
|
|
public function productSave(){
|
|
|
|
try {
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$data = $this->editProduct();
|
|
|
|
}else{
|
|
|
|
$data = $this->addProduct();
|
|
|
|
}
|
|
|
|
CategoryRelated::saveRelated($data['id'], $this->param['category_id'] ?? []);//分类关联
|
|
|
|
KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联
|
|
|
|
$this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段
|
|
|
|
$this->saveDetail($data['id'],$this->param['detail'] ?? []);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
Log::info('错误信息---'.$e->getMessage());
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$data = $this->editProduct();
|
|
|
|
}else{
|
|
|
|
$data = $this->addProduct();
|
|
|
|
}
|
|
|
|
CategoryRelated::saveRelated($data['id'], $this->param['category_id'] ?? []);//分类关联
|
|
|
|
KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联
|
|
|
|
$this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段
|
|
|
|
$this->saveDetail($data['id'],$this->param['detail'] ?? []);
|
|
|
|
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? '');
|
|
|
|
$this->curlDelRoute(['new_route'=>$data['route'] ?? '']);
|
|
|
|
return $this->success(['id'=>$data['id']]);
|
...
|
...
|
|