|
...
|
...
|
@@ -41,7 +41,7 @@ class ProductLogic extends BaseLogic |
|
|
|
* @time :2023/8/21 18:35
|
|
|
|
*/
|
|
|
|
public function productSave(){
|
|
|
|
// try {
|
|
|
|
try {
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$data = $this->editProduct();
|
|
|
|
}else{
|
|
...
|
...
|
@@ -50,11 +50,11 @@ class ProductLogic extends BaseLogic |
|
|
|
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('系统错误,请联系管理员');
|
|
|
|
// }
|
|
|
|
$this->saveDetail($data['id'],$this->param['detail'] ?? []);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
Log::info('错误信息---'.$e->getMessage());
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
|
|
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? '');
|
|
|
|
$this->curlDelRoute(['new_route'=>$data['route'] ?? '']);
|
|
|
|
return $this->success(['id'=>$data['id']]);
|
|
...
|
...
|
@@ -75,14 +75,9 @@ class ProductLogic extends BaseLogic |
|
|
|
if($this->user['project_id'] != 2059){//2059项目不处理排序
|
|
|
|
$param['sort'] = $this->setProductSort();
|
|
|
|
}
|
|
|
|
// try {
|
|
|
|
$id = $this->model->addReturnId($param);
|
|
|
|
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
//保存新描述
|
|
|
|
// }catch (\Exception $e){
|
|
|
|
// $this->fail('操作失败,请联系管理员:'.$e->getMessage());
|
|
|
|
// }
|
|
|
|
$id = $this->model->addReturnId($param);
|
|
|
|
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
return $this->success(['id'=>$id,'route'=>$route]);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -99,17 +94,12 @@ class ProductLogic extends BaseLogic |
|
|
|
$route = $param['route'];
|
|
|
|
$is_upgrade = $param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
|
|
|
|
$six_read = $param['six_read'] ?? 0;//是否按6.0显示
|
|
|
|
try {
|
|
|
|
if($six_read == 0 && $is_upgrade == 1){
|
|
|
|
unset($param['route']);
|
|
|
|
}else{
|
|
|
|
$param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
|
|
|
|
}
|
|
|
|
$this->model->edit($param,['id'=>$this->param['id']]);
|
|
|
|
//保存新描述
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('操作失败,请联系管理员:'.$e->getMessage());
|
|
|
|
if($six_read == 0 && $is_upgrade == 1){
|
|
|
|
unset($param['route']);
|
|
|
|
}else{
|
|
|
|
$param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
|
|
|
|
}
|
|
|
|
$this->model->edit($param,['id'=>$this->param['id']]);
|
|
|
|
return $this->success(['id'=>$this->param['id'],'route'=>$route]);
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|