正在显示
3 个修改的文件
包含
17 行增加
和
3 行删除
| @@ -28,9 +28,7 @@ class NavController extends BaseController | @@ -28,9 +28,7 @@ class NavController extends BaseController | ||
| 28 | */ | 28 | */ |
| 29 | public function index(){ | 29 | public function index(){ |
| 30 | 30 | ||
| 31 | - | ||
| 32 | return $this->success(NavLogic::instance()->list()); | 31 | return $this->success(NavLogic::instance()->list()); |
| 33 | - | ||
| 34 | } | 32 | } |
| 35 | 33 | ||
| 36 | 34 | ||
| @@ -47,7 +45,6 @@ class NavController extends BaseController | @@ -47,7 +45,6 @@ class NavController extends BaseController | ||
| 47 | */ | 45 | */ |
| 48 | public function save(NavRequest $request){ | 46 | public function save(NavRequest $request){ |
| 49 | $data = $request->validated(); | 47 | $data = $request->validated(); |
| 50 | - | ||
| 51 | return $this->success(NavLogic::instance()->save($data)); | 48 | return $this->success(NavLogic::instance()->save($data)); |
| 52 | 49 | ||
| 53 | } | 50 | } |
| @@ -48,6 +48,21 @@ class NavLogic extends BaseLogic | @@ -48,6 +48,21 @@ class NavLogic extends BaseLogic | ||
| 48 | 48 | ||
| 49 | public function save($data) | 49 | public function save($data) |
| 50 | { | 50 | { |
| 51 | + if(isset($data['id']) && !empty($data['id'])){ | ||
| 52 | + $condition = [ | ||
| 53 | + 'url'=>$data['url'], | ||
| 54 | + 'id'=>['!=',$data['id']], | ||
| 55 | + ]; | ||
| 56 | + }else{ | ||
| 57 | + $condition = [ | ||
| 58 | + 'url'=>$data['url'], | ||
| 59 | + ]; | ||
| 60 | + } | ||
| 61 | + $navModel = new BNav(); | ||
| 62 | + $info = $navModel->read($condition); | ||
| 63 | + if($info === false){ | ||
| 64 | + $this->fail('当前路由已存在'); | ||
| 65 | + } | ||
| 51 | if($data['pid']){ | 66 | if($data['pid']){ |
| 52 | // 验证是否存在上级 | 67 | // 验证是否存在上级 |
| 53 | $all = BNav::_all($this->user['project_id'],$data['location']); | 68 | $all = BNav::_all($this->user['project_id'],$data['location']); |
| @@ -32,6 +32,8 @@ class VisitLogic extends BaseLogic | @@ -32,6 +32,8 @@ class VisitLogic extends BaseLogic | ||
| 32 | public function getItemList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20){ | 32 | public function getItemList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20){ |
| 33 | $this->model = new VisitItem(); | 33 | $this->model = new VisitItem(); |
| 34 | $map['domain'] = $this->user['domain']; | 34 | $map['domain'] = $this->user['domain']; |
| 35 | + var_dump(111); | ||
| 36 | + die(); | ||
| 35 | return Logic::getList($map, $sort, ['url', 'created_at'], 0); | 37 | return Logic::getList($map, $sort, ['url', 'created_at'], 0); |
| 36 | } | 38 | } |
| 37 | 39 |
-
请 注册 或 登录 后发表评论