作者 lyh

gx

... ... @@ -55,18 +55,18 @@ class NewsLogic extends BaseLogic
*/
public function news_add(){
//拼接参数
DB::beginTransaction();
try {
// DB::beginTransaction();
// try {
$this->param = $this->paramProcessing($this->param);
$rs = $this->model->insertGetId($this->param);
$route = RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('添加失败');
}
// $route = RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('添加失败');
// }
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS, 'route'=>$route]);
// $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS, 'route'=>$route]);
return $this->success();
}
... ...