|
@@ -30,28 +30,21 @@ class BlogLogic extends BaseLogic |
|
@@ -30,28 +30,21 @@ class BlogLogic extends BaseLogic |
|
30
|
*/
|
30
|
*/
|
|
31
|
public function blogSave(){
|
31
|
public function blogSave(){
|
|
32
|
//拼接参数
|
32
|
//拼接参数
|
|
33
|
- DB::beginTransaction();
|
|
|
|
34
|
- try {
|
|
|
|
35
|
- $this->param = $this->paramProcessing($this->param);
|
|
|
|
36
|
- if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
37
|
- $id = $this->param['id'];
|
|
|
|
38
|
- $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
|
|
|
|
39
|
- $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
|
|
|
|
40
|
- if($is_upgrade == 0 || $six_read == 1){
|
|
|
|
41
|
- $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
|
|
|
|
42
|
- }
|
|
|
|
43
|
- $route = $this->param['url'];
|
|
|
|
44
|
- $this->edit($this->param,['id'=>$id]);
|
|
|
|
45
|
- }else{
|
|
|
|
46
|
- $this->param['sort'] = $this->setNewsSort();
|
|
|
|
47
|
- $id = $this->model->addReturnId($this->param);
|
|
|
|
48
|
- $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
|
|
|
|
49
|
- $this->edit(['url'=>$route],['id'=>$id]);
|
33
|
+ $this->param = $this->paramProcessing($this->param);
|
|
|
|
34
|
+ if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
35
|
+ $id = $this->param['id'];
|
|
|
|
36
|
+ $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
|
|
|
|
37
|
+ $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
|
|
|
|
38
|
+ if($is_upgrade == 0 || $six_read == 1){
|
|
|
|
39
|
+ $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
|
|
50
|
}
|
40
|
}
|
|
51
|
- DB::commit();
|
|
|
|
52
|
- }catch (\Exception $e){
|
|
|
|
53
|
- DB::rollBack();
|
|
|
|
54
|
- $this->fail('系统错误,请联系管理员');
|
41
|
+ $route = $this->param['url'];
|
|
|
|
42
|
+ $this->edit($this->param,['id'=>$id]);
|
|
|
|
43
|
+ }else{
|
|
|
|
44
|
+ $this->param['sort'] = $this->setNewsSort();
|
|
|
|
45
|
+ $id = $this->model->addReturnId($this->param);
|
|
|
|
46
|
+ $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
|
|
|
|
47
|
+ $this->edit(['url'=>$route],['id'=>$id]);
|
|
55
|
}
|
48
|
}
|
|
56
|
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
|
49
|
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
|
|
57
|
$this->curlDelRoute(['new_route'=>$route]);
|
50
|
$this->curlDelRoute(['new_route'=>$route]);
|