作者 lyh

gx

... ... @@ -60,8 +60,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'])){
//验证是否可编辑
$this->verifyEditParam($this->param['id'],$this->param['pid']);
... ... @@ -77,11 +77,11 @@ class NewsCategoryLogic extends BaseLogic
}
$route = RouteMap::setRoute(isset($this->param['alias']) ? $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'=>$route]);
return $this->success();
... ...
... ... @@ -25,6 +25,7 @@ class NewsRequest extends FormRequest
{
return [
'name'=>'required|max:100',
'url'=>'required',
];
}
... ... @@ -33,6 +34,7 @@ class NewsRequest extends FormRequest
return [
'name.required'=>'请填写名称',
'name.max'=>'名称最大100字',
'url.required'=>'新闻链接不能为空'
];
}
}
... ...