作者 lyh

gx

... ... @@ -203,7 +203,7 @@ class BlogLogic extends BaseLogic
public function getCategory($category){
$str = '';
foreach ($category as $v){
$str .= $v.',';
$str .= $v.',';
}
return !empty(trim($str,',')) ? ','.$str.',' : '';
}
... ...
... ... @@ -59,32 +59,23 @@ class NewsLogic extends BaseLogic
*/
public function newsSave()
{
//拼接参数
// DB::beginTransaction();
// try {
$this->param = $this->paramProcessing($this->param);
if (isset($this->param['id']) && !empty($this->param['id'])) {
$id = $this->param['id'];
$is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
$six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
if($is_upgrade == 0 || $six_read == 1) {
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
}
//是否更新路由
$route = $this->param['url'];
$this->edit($this->param, ['id' => $id]);
} else {
$this->param['sort'] = $this->setNewsSort();
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->edit(['url' => $route], ['id' => $id]);
$this->param = $this->paramProcessing($this->param);
if (isset($this->param['id']) && !empty($this->param['id'])) {
$id = $this->param['id'];
$is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
$six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
if($is_upgrade == 0 || $six_read == 1) {
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
}
// //更新路由
// DB::commit();
// } catch (\Exception $e) {
// DB::rollBack();
// $this->fail('系统错误,请联系管理员');
// }
//是否更新路由
$route = $this->param['url'];
$this->edit($this->param, ['id' => $id]);
} else {
$this->param['sort'] = $this->setNewsSort();
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->edit(['url' => $route], ['id' => $id]);
}
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
$this->curlDelRoute(['new_route'=>$route]);
return $this->success(['id'=>$id]);
... ... @@ -223,10 +214,10 @@ class NewsLogic extends BaseLogic
*/
public function getCategory($category){
$str = '';
if(is_array($category) && $category){
$str = ','.implode(',',$category).',';
foreach ($category as $v){
$str .= $v.',';
}
return $str;
return !empty(trim($str,',')) ? ','.$str.',' : '';
}
/**
... ...