|
@@ -55,16 +55,16 @@ class BlogLogic extends BaseLogic |
|
@@ -55,16 +55,16 @@ class BlogLogic extends BaseLogic |
|
55
|
*/
|
55
|
*/
|
|
56
|
public function blogAdd(){
|
56
|
public function blogAdd(){
|
|
57
|
//拼接参数
|
57
|
//拼接参数
|
|
58
|
-// DB::beginTransaction();
|
|
|
|
59
|
-// try {
|
58
|
+ DB::beginTransaction();
|
|
|
|
59
|
+ try {
|
|
60
|
$this->param = $this->paramProcessing($this->param);
|
60
|
$this->param = $this->paramProcessing($this->param);
|
|
61
|
$rs = $this->model->insertGetId($this->param);
|
61
|
$rs = $this->model->insertGetId($this->param);
|
|
62
|
$route = $this->param['url'] = RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_BLOG, $rs, $this->user['project_id']);
|
62
|
$route = $this->param['url'] = RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_BLOG, $rs, $this->user['project_id']);
|
|
63
|
-// DB::commit();
|
|
|
|
64
|
-// }catch (\Exception $e){
|
|
|
|
65
|
-// DB::rollBack();
|
|
|
|
66
|
-// $this->fail('error');
|
|
|
|
67
|
-// }
|
63
|
+ DB::commit();
|
|
|
|
64
|
+ }catch (\Exception $e){
|
|
|
|
65
|
+ DB::rollBack();
|
|
|
|
66
|
+ $this->fail('error');
|
|
|
|
67
|
+ }
|
|
68
|
//通知更新
|
68
|
//通知更新
|
|
69
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);
|
69
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);
|
|
70
|
return $this->success();
|
70
|
return $this->success();
|