|
...
|
...
|
@@ -28,7 +28,8 @@ class NewsCategoryLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function get_category_name($v){
|
|
|
|
//获取用户已读还是未读
|
|
|
|
$category_info = $this->model->list(['id'=>['in',explode(',',trim($v['category_id'],','))]],'id',['name']);
|
|
|
|
$category_info = $this->model->list([
|
|
|
|
'id'=>['in',explode(',',trim($v['category_id'],','))]],'id',['name']);
|
|
|
|
$str = '';
|
|
|
|
foreach ($category_info as $v1){
|
|
|
|
$str .= $v1['name'].',';
|
|
...
|
...
|
@@ -64,14 +65,16 @@ class NewsCategoryLogic extends BaseLogic |
|
|
|
$cate_id = $this->model->insertGetId($this->param);
|
|
|
|
//当父级分类拥有产品时,处理产品
|
|
|
|
$this->addProcessingSon($cate_id);
|
|
|
|
RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $cate_id, $this->user['project_id']);
|
|
|
|
RouteMap::setRoute($this->param['alias'] ?: $this->param['name'],
|
|
|
|
RouteMap::SOURCE_NEWS_CATE, $cate_id, $this->user['project_id']);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'],
|
|
|
|
'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -87,10 +90,12 @@ class NewsCategoryLogic extends BaseLogic |
|
|
|
//验证是否可编辑
|
|
|
|
$this->verifyEditParam();
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$this->param['alias'] = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->param['alias'] = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'],
|
|
|
|
RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'],
|
|
|
|
'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -213,7 +218,8 @@ class NewsCategoryLogic extends BaseLogic |
|
|
|
$param['create_id'] = $this->user['id'];
|
|
|
|
$param['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$param['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$param['alias'] = RouteMap::generateRoute($param['alias'], RouteMap::SOURCE_NEWS_CATE, $param['id'], $this->user['project_id']);
|
|
|
|
$param['alias'] = RouteMap::generateRoute($param['alias'],
|
|
|
|
RouteMap::SOURCE_NEWS_CATE, $param['id'], $this->user['project_id']);
|
|
|
|
return $this->success($param);
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|