|
...
|
...
|
@@ -56,8 +56,8 @@ class NewsLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function newsSave(){
|
|
|
|
//拼接参数
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
// DB::beginTransaction();
|
|
|
|
// try {
|
|
|
|
$this->param = $this->paramProcessing($this->param);
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
//是否更新路由
|
|
...
|
...
|
@@ -69,11 +69,11 @@ class NewsLogic extends BaseLogic |
|
|
|
//更新路由
|
|
|
|
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
|
|
|
|
$this->edit(['url'=>$route],['id'=>$id]);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('添加失败');
|
|
|
|
}
|
|
|
|
// DB::commit();
|
|
|
|
// }catch (\Exception $e){
|
|
|
|
// DB::rollBack();
|
|
|
|
// $this->fail('添加失败');
|
|
|
|
// }
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS, 'route'=>$route]);
|
|
|
|
return $this->success();
|
|
...
|
...
|
@@ -177,12 +177,16 @@ class NewsLogic extends BaseLogic |
|
|
|
public function paramProcessing($param){
|
|
|
|
if(isset($this->param['id'])){
|
|
|
|
$param['operator_id'] = $this->user['id'];
|
|
|
|
$param['category_id'] = ','.trim($param['category_id'],',').',';
|
|
|
|
if(isset($param['category_id']) && !empty($param['category_id'])){
|
|
|
|
$param['category_id'] = ','.trim($param['category_id'],',').',';
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$param['create_id'] = $this->user['id'];
|
|
|
|
$param['operator_id'] = $this->user['id'];
|
|
|
|
$param['project_id'] = $this->user['project_id'];
|
|
|
|
$param['category_id'] = ','.$param['category_id'].',';
|
|
|
|
if(isset($param['category_id']) && !empty($param['category_id'])){
|
|
|
|
$param['category_id'] = ','.$param['category_id'].',';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($param);
|
|
|
|
}
|
...
|
...
|
|