|
...
|
...
|
@@ -56,16 +56,16 @@ class ProductLogic extends BaseLogic |
|
|
|
DB::connection('custom_mysql')->beginTransaction();
|
|
|
|
try {
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$id = $this->param['id'];
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
|
|
|
|
//查看路由是否更新
|
|
|
|
$this->param['route'] = $this->editProductRoute($this->param['route']);
|
|
|
|
$this->editProductRoute($this->param['route']);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->param = $this->addHandleParam($this->param);
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['route'=> $this->param['route']],['id'=>$id]);
|
|
|
|
//产品分类关联
|
|
|
|
CategoryRelated::saveRelated($id, $category_ids);
|
|
|
|
//保存扩展字段
|
|
...
|
...
|
@@ -75,8 +75,6 @@ class ProductLogic extends BaseLogic |
|
|
|
DB::connection('custom_mysql')->rollBack();
|
|
|
|
$this->fail('系统错误请联系管理员');
|
|
|
|
}
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$this->param['route']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -154,10 +152,15 @@ class ProductLogic extends BaseLogic |
|
|
|
}else{
|
|
|
|
$this->param['thumb'] = Arr::a2s([]);
|
|
|
|
}
|
|
|
|
if(isset($this->param['route']) && !empty($this->param['route'])){
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
|
|
|
|
try {
|
|
|
|
if(isset($this->param['route']) && !empty($this->param['route'])){
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->editProductRoute($this->param['route']);
|
|
|
|
}
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('系统错误,请连续管理员');;
|
|
|
|
}
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -288,12 +291,8 @@ class ProductLogic extends BaseLogic |
|
|
|
public function editProductRoute($route){
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
if($info['route'] != $route){
|
|
|
|
//生成一条删除路由记录
|
|
|
|
$data = [
|
|
|
|
'source'=>RouteMap::SOURCE_PRODUCT,
|
|
|
|
'route'=>$route,
|
|
|
|
];
|
|
|
|
$this->setRouteDeleteSave($data);
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$info['route']]);
|
|
|
|
}
|
|
|
|
return $route;
|
|
|
|
}
|
|
...
|
...
|
@@ -340,11 +339,8 @@ class ProductLogic extends BaseLogic |
|
|
|
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
|
|
//生成一条删除路由记录
|
|
|
|
$info = $this->model->read(['id'=>$id],['id','route']);
|
|
|
|
$data = [
|
|
|
|
'source'=>RouteMap::SOURCE_PRODUCT,
|
|
|
|
'route'=>$info['route'],
|
|
|
|
];
|
|
|
|
$this->setRouteDeleteSave($data);
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$info['route']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|