作者 lyh

gx

... ... @@ -57,9 +57,9 @@ class NewsCategoryLogic extends BaseLogic
*/
public function newsCategorySave(){
//验证名称是否存在
$this->verifyParamName($this->param['name']);
DB::beginTransaction();
try {
// $this->verifyParamName($this->param['name']);
// DB::beginTransaction();
// try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//验证是否可编辑
$this->verifyEditParam($this->param['id'],$this->param['pid']);
... ... @@ -74,11 +74,11 @@ class NewsCategoryLogic extends BaseLogic
}
$route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
$this->model->edit(['alias'=>$route],['id'=>$id]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('error');
// }
//更新通知记录表
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);
return $this->success();
... ... @@ -205,18 +205,6 @@ class NewsCategoryLogic extends BaseLogic
return $this->success();
}
/**
* @name :(参数处理)paramProcessing
* @author :lyh
* @method :post
* @time :2023/6/13 11:30
*/
public function addParamProcessing($param){
$param['project_id'] = $this->user['project_id'];
$param['operator_id'] = $this->user['id'];
$param['create_id'] = $this->user['id'];
return $this->success($param);
}
/**
* @name :(添加分类时处理子集分类)addProcessingSon
... ...
... ... @@ -56,8 +56,8 @@ class NewsLogic extends BaseLogic
*/
public function newsSave(){
//拼接参数
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$this->param = $this->paramProcessing($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
//是否更新路由
... ... @@ -69,11 +69,11 @@ class NewsLogic extends BaseLogic
//更新路由
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->edit(['url'=>$route],['id'=>$id]);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('添加失败');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('添加失败');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS, 'route'=>$route]);
return $this->success();
... ...