|
...
|
...
|
@@ -35,30 +35,23 @@ class NavLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function navSave()
|
|
|
|
{
|
|
|
|
// DB::beginTransaction();
|
|
|
|
// try {
|
|
|
|
if(!empty($this->param['location'])){
|
|
|
|
if($this->param['location'] == 'header'){
|
|
|
|
$this->param['group_id'] = BNavGroup::DEFAULT_HEADER_ID;
|
|
|
|
}
|
|
|
|
if($this->param['location'] == 'footer'){
|
|
|
|
$this->param['group_id'] = BNavGroup::DEFAULT_FOOTER_ID;
|
|
|
|
}
|
|
|
|
if(!empty($this->param['location'])){
|
|
|
|
if($this->param['location'] == 'header'){
|
|
|
|
$this->param['group_id'] = BNavGroup::DEFAULT_HEADER_ID;
|
|
|
|
}
|
|
|
|
$this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : '');
|
|
|
|
$this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : '');
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$this->handleEditParam();//验证是否可编辑分类
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$this->model->add($this->param);
|
|
|
|
if($this->param['location'] == 'footer'){
|
|
|
|
$this->param['group_id'] = BNavGroup::DEFAULT_FOOTER_ID;
|
|
|
|
}
|
|
|
|
// DB::commit();
|
|
|
|
// }catch (\Exception $e){
|
|
|
|
// DB::rollBack();
|
|
|
|
// $this->fail('error');
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
$this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : '');
|
|
|
|
$this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : '');
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$this->handleEditParam();//验证是否可编辑分类
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$this->model->add($this->param);
|
|
|
|
}
|
|
|
|
//编辑菜单后,通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
|
|
|
|
return $this->success();
|
...
|
...
|
|