|
...
|
...
|
@@ -66,27 +66,26 @@ class NewsCategoryLogic extends BaseLogic |
|
|
|
//验证名称是否存在
|
|
|
|
$this->verifyParamName($this->param['name']);
|
|
|
|
$this->param = $this->handleParam($this->param);
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$id = $this->param['id'];
|
|
|
|
$this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
|
|
|
|
$route = $this->param['alias'];
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$this->edit($this->param,['id'=>$id]);
|
|
|
|
}else{
|
|
|
|
if(!isset($this->param['alias']) || empty($this->param['alias'])){
|
|
|
|
$this->param['alias'] = Translate::tran($this->param['name'], 'en');
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$id = $this->param['id'];
|
|
|
|
$this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
|
|
|
|
$route = $this->param['alias'];
|
|
|
|
if(empty($route)){
|
|
|
|
$this->fail('alias路由不能为空');
|
|
|
|
}
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$this->edit($this->param,['id'=>$id]);
|
|
|
|
}else{
|
|
|
|
if(!isset($this->param['alias']) || empty($this->param['alias'])){
|
|
|
|
$this->param['alias'] = Translate::tran($this->param['name'], 'en');
|
|
|
|
if(empty($route)){
|
|
|
|
$this->fail('路由翻译错误,请手动输入');
|
|
|
|
}
|
|
|
|
$this->param = $this->addParamProcessing($this->param);
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['alias'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
$this->param = $this->addParamProcessing($this->param);
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['alias'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
$this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
|
|
|
|
$this->curlDelRoute(['new_route'=>$route]);
|
...
|
...
|
|