|
@@ -59,32 +59,23 @@ class NewsLogic extends BaseLogic |
|
@@ -59,32 +59,23 @@ class NewsLogic extends BaseLogic |
|
59
|
*/
|
59
|
*/
|
|
60
|
public function newsSave()
|
60
|
public function newsSave()
|
|
61
|
{
|
61
|
{
|
|
62
|
- //拼接参数
|
|
|
|
63
|
-// DB::beginTransaction();
|
|
|
|
64
|
-// try {
|
|
|
|
65
|
- $this->param = $this->paramProcessing($this->param);
|
|
|
|
66
|
- if (isset($this->param['id']) && !empty($this->param['id'])) {
|
|
|
|
67
|
- $id = $this->param['id'];
|
|
|
|
68
|
- $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
|
|
|
|
69
|
- $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
|
|
|
|
70
|
- if($is_upgrade == 0 || $six_read == 1) {
|
|
|
|
71
|
- $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
|
|
|
|
72
|
- }
|
|
|
|
73
|
- //是否更新路由
|
|
|
|
74
|
- $route = $this->param['url'];
|
|
|
|
75
|
- $this->edit($this->param, ['id' => $id]);
|
|
|
|
76
|
- } else {
|
|
|
|
77
|
- $this->param['sort'] = $this->setNewsSort();
|
|
|
|
78
|
- $id = $this->model->addReturnId($this->param);
|
|
|
|
79
|
- $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
|
|
|
|
80
|
- $this->edit(['url' => $route], ['id' => $id]);
|
62
|
+ $this->param = $this->paramProcessing($this->param);
|
|
|
|
63
|
+ if (isset($this->param['id']) && !empty($this->param['id'])) {
|
|
|
|
64
|
+ $id = $this->param['id'];
|
|
|
|
65
|
+ $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
|
|
|
|
66
|
+ $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
|
|
|
|
67
|
+ if($is_upgrade == 0 || $six_read == 1) {
|
|
|
|
68
|
+ $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
|
|
81
|
}
|
69
|
}
|
|
82
|
-// //更新路由
|
|
|
|
83
|
-// DB::commit();
|
|
|
|
84
|
-// } catch (\Exception $e) {
|
|
|
|
85
|
-// DB::rollBack();
|
|
|
|
86
|
-// $this->fail('系统错误,请联系管理员');
|
|
|
|
87
|
-// }
|
70
|
+ //是否更新路由
|
|
|
|
71
|
+ $route = $this->param['url'];
|
|
|
|
72
|
+ $this->edit($this->param, ['id' => $id]);
|
|
|
|
73
|
+ } else {
|
|
|
|
74
|
+ $this->param['sort'] = $this->setNewsSort();
|
|
|
|
75
|
+ $id = $this->model->addReturnId($this->param);
|
|
|
|
76
|
+ $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
|
|
|
|
77
|
+ $this->edit(['url' => $route], ['id' => $id]);
|
|
|
|
78
|
+ }
|
|
88
|
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
|
79
|
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
|
|
89
|
$this->curlDelRoute(['new_route'=>$route]);
|
80
|
$this->curlDelRoute(['new_route'=>$route]);
|
|
90
|
return $this->success(['id'=>$id]);
|
81
|
return $this->success(['id'=>$id]);
|
|
@@ -223,10 +214,10 @@ class NewsLogic extends BaseLogic |
|
@@ -223,10 +214,10 @@ class NewsLogic extends BaseLogic |
|
223
|
*/
|
214
|
*/
|
|
224
|
public function getCategory($category){
|
215
|
public function getCategory($category){
|
|
225
|
$str = '';
|
216
|
$str = '';
|
|
226
|
- if(is_array($category) && $category){
|
|
|
|
227
|
- $str = ','.implode(',',$category).',';
|
217
|
+ foreach ($category as $v){
|
|
|
|
218
|
+ $str .= $v.',';
|
|
228
|
}
|
219
|
}
|
|
229
|
- return $str;
|
220
|
+ return !empty(trim($str,',')) ? ','.$str.',' : '';
|
|
230
|
}
|
221
|
}
|
|
231
|
|
222
|
|
|
232
|
/**
|
223
|
/**
|