|
@@ -133,16 +133,36 @@ class NavController extends BaseController |
|
@@ -133,16 +133,36 @@ class NavController extends BaseController |
|
133
|
$id = BNav::_save($this->user['project_id'],$data,$data['id']??0);
|
133
|
$id = BNav::_save($this->user['project_id'],$data,$data['id']??0);
|
|
134
|
|
134
|
|
|
135
|
if($id===-1){
|
135
|
if($id===-1){
|
|
136
|
- return $this->response('导航数据不存在','B_NAV_NOTFOUND');
|
136
|
+ return $this->response('导航菜单不存在','B_NAV_NOTFOUND');
|
|
137
|
}
|
137
|
}
|
|
138
|
|
138
|
|
|
139
|
return $this->success(BNav::_find($this->user['project_id'],$id,true));
|
139
|
return $this->success(BNav::_find($this->user['project_id'],$id,true));
|
|
140
|
}
|
140
|
}
|
|
141
|
|
141
|
|
|
142
|
|
142
|
|
|
|
|
143
|
+ /**
|
|
|
|
144
|
+ * 删除数据
|
|
|
|
145
|
+ * @return \Illuminate\Http\JsonResponse
|
|
|
|
146
|
+ * @author:dc
|
|
|
|
147
|
+ * @time 2023/5/9 9:20
|
|
|
|
148
|
+ */
|
|
|
|
149
|
+ public function delete(){
|
|
|
|
150
|
+ $id = $this->param['id']??0;
|
|
|
|
151
|
+ $data = BNav::_find($this->user['project_id'],$id);
|
|
|
|
152
|
+
|
|
|
|
153
|
+ if(empty($data)){
|
|
|
|
154
|
+ return $this->response('导航菜单不存在','B_NAV_NOTFOUND');
|
|
|
|
155
|
+ }
|
|
143
|
|
156
|
|
|
144
|
|
157
|
|
|
145
|
- public function delete(){
|
158
|
+ if(BNav::isChild($data['id'],$this->user['project_id'])){
|
|
|
|
159
|
+ return $this->response('存在下级无法删除','B_NAV_DELETE_CHILD');
|
|
|
|
160
|
+ }
|
|
|
|
161
|
+
|
|
|
|
162
|
+
|
|
|
|
163
|
+ if($data->delete()){
|
|
|
|
164
|
+ return $this->response('删除成功',Code::SUCCESS);
|
|
|
|
165
|
+ }
|
|
146
|
|
166
|
|
|
147
|
}
|
167
|
}
|
|
148
|
|
168
|
|