作者 lyh

gx

... ... @@ -45,8 +45,8 @@ class NewsCategoryLogic extends BaseLogic
public function newsCategorySave(){
//验证名称是否存在
$this->verifyParamName($this->param['name']);
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
... ... @@ -62,11 +62,11 @@ class NewsCategoryLogic extends BaseLogic
$route = RouteMap::setRoute($this->param['alias'], 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('系统错误,请联系管理员');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
$this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
$this->curlDelRoute(['new_route'=>$route]);
return $this->success(['id'=>$id]);
... ...
... ... @@ -25,7 +25,6 @@ class NewsCategoryRequest extends FormRequest
{
return [
'name'=>'required|max:100',
'alias'=>'required'
];
}
... ... @@ -34,7 +33,6 @@ class NewsCategoryRequest extends FormRequest
return [
'name.required'=>'请填写名称',
'name.max'=>'名称最大100字',
'alias.required'=>'请填写路由',
];
}
}
... ...