正在显示
5 个修改的文件
包含
62 行增加
和
7 行删除
| @@ -35,6 +35,21 @@ class BlogCategoryController extends BaseController | @@ -35,6 +35,21 @@ class BlogCategoryController extends BaseController | ||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | + * @name :(添加/编辑时获取顶级分类)topList | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2023/6/13 9:03 | ||
| 42 | + */ | ||
| 43 | + public function categoryTopList(BlogCategoryLogic $blogCategoryLogic){ | ||
| 44 | + $this->map = [ | ||
| 45 | + 'project_id'=>$this->user['project_id'], | ||
| 46 | + 'pid'=>0 | ||
| 47 | + ]; | ||
| 48 | + $list = $blogCategoryLogic->categoryTopList(); | ||
| 49 | + $this->response('success',Code::SUCCESS,$list); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 38 | * @name :获取当前分类详情 | 53 | * @name :获取当前分类详情 |
| 39 | * @author :liyuhang | 54 | * @author :liyuhang |
| 40 | * @method | 55 | * @method |
| @@ -20,9 +20,6 @@ class NewsCategoryController extends BaseController | @@ -20,9 +20,6 @@ class NewsCategoryController extends BaseController | ||
| 20 | public function lists(NewsCategoryModel $newsCategory){ | 20 | public function lists(NewsCategoryModel $newsCategory){ |
| 21 | //搜索条件 | 21 | //搜索条件 |
| 22 | $this->map['project_id'] = $this->user['project_id']; | 22 | $this->map['project_id'] = $this->user['project_id']; |
| 23 | - if(!isset($this->map['pid']) && empty($this->map['pid'])){ | ||
| 24 | - $this->map['pid'] = 0; | ||
| 25 | - } | ||
| 26 | $lists = $newsCategory->lists($this->map,$this->page,$this->row,$this->order, | 23 | $lists = $newsCategory->lists($this->map,$this->page,$this->row,$this->order, |
| 27 | ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at']); | 24 | ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at']); |
| 28 | if(!empty($lists['list'])){ | 25 | if(!empty($lists['list'])){ |
| @@ -38,6 +35,21 @@ class NewsCategoryController extends BaseController | @@ -38,6 +35,21 @@ class NewsCategoryController extends BaseController | ||
| 38 | } | 35 | } |
| 39 | 36 | ||
| 40 | /** | 37 | /** |
| 38 | + * @name :(添加/编辑时获取顶级分类)topList | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2023/6/13 9:03 | ||
| 42 | + */ | ||
| 43 | + public function categoryTopList(NewsCategoryLogic $newsCategoryLogic){ | ||
| 44 | + $this->map = [ | ||
| 45 | + 'project_id'=>$this->user['project_id'], | ||
| 46 | + 'pid'=>0 | ||
| 47 | + ]; | ||
| 48 | + $list = NewsCategoryLogic->categoryTopList(); | ||
| 49 | + $this->response('success',Code::SUCCESS,$list); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 41 | * @name :获取当前分类详情 | 53 | * @name :获取当前分类详情 |
| 42 | * @author :liyuhang | 54 | * @author :liyuhang |
| 43 | * @method | 55 | * @method |
| @@ -78,9 +78,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -78,9 +78,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| 81 | - | ||
| 82 | RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']); | 81 | RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']); |
| 83 | - | ||
| 84 | DB::commit(); | 82 | DB::commit(); |
| 85 | }catch (\Exception $e){ | 83 | }catch (\Exception $e){ |
| 86 | DB::rollBack(); | 84 | DB::rollBack(); |
| @@ -171,4 +169,19 @@ class BlogCategoryLogic extends BaseLogic | @@ -171,4 +169,19 @@ class BlogCategoryLogic extends BaseLogic | ||
| 171 | $this->del($this->param,$ids); | 169 | $this->del($this->param,$ids); |
| 172 | return $this->success(); | 170 | return $this->success(); |
| 173 | } | 171 | } |
| 172 | + | ||
| 173 | + /** | ||
| 174 | + * @name :(添加分类时获取1级分类)categoryTopList | ||
| 175 | + * @author :lyh | ||
| 176 | + * @method :post | ||
| 177 | + * @time :2023/6/13 9:09 | ||
| 178 | + */ | ||
| 179 | + public function categoryTopList(){ | ||
| 180 | + $map = [ | ||
| 181 | + 'pid'=>0, | ||
| 182 | + 'status'=>0, | ||
| 183 | + ]; | ||
| 184 | + $list = $this->model->list($map); | ||
| 185 | + return $this->success($list); | ||
| 186 | + } | ||
| 174 | } | 187 | } |
| @@ -167,4 +167,19 @@ class NewsCategoryLogic extends BaseLogic | @@ -167,4 +167,19 @@ class NewsCategoryLogic extends BaseLogic | ||
| 167 | $this->del($this->param,$ids); | 167 | $this->del($this->param,$ids); |
| 168 | return $this->success(); | 168 | return $this->success(); |
| 169 | } | 169 | } |
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * @name :(添加分类时获取1级分类)categoryTopList | ||
| 173 | + * @author :lyh | ||
| 174 | + * @method :post | ||
| 175 | + * @time :2023/6/13 9:09 | ||
| 176 | + */ | ||
| 177 | + public function categoryTopList(){ | ||
| 178 | + $map = [ | ||
| 179 | + 'pid'=>0, | ||
| 180 | + 'status'=>0, | ||
| 181 | + ]; | ||
| 182 | + $list = $this->model->list($map); | ||
| 183 | + return $this->success($list); | ||
| 184 | + } | ||
| 170 | } | 185 | } |
| @@ -52,7 +52,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -52,7 +52,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 52 | Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'edit'])->name('news_category_edit'); | 52 | Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'edit'])->name('news_category_edit'); |
| 53 | Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del'); | 53 | Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del'); |
| 54 | Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status'); | 54 | Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status'); |
| 55 | - | 55 | + Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList'); |
| 56 | //新闻 | 56 | //新闻 |
| 57 | Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists'); | 57 | Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists'); |
| 58 | Route::any('/get_category_list', [\App\Http\Controllers\Bside\News\NewsController::class, 'get_category_list'])->name('news_get_category_list'); | 58 | Route::any('/get_category_list', [\App\Http\Controllers\Bside\News\NewsController::class, 'get_category_list'])->name('news_get_category_list'); |
| @@ -73,7 +73,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -73,7 +73,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 73 | Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'edit'])->name('blog_category_edit'); | 73 | Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'edit'])->name('blog_category_edit'); |
| 74 | Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); | 74 | Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); |
| 75 | Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); | 75 | Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); |
| 76 | - | 76 | + Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList'); |
| 77 | //博客 | 77 | //博客 |
| 78 | Route::any('/', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'lists'])->name('blog_lists'); | 78 | Route::any('/', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'lists'])->name('blog_lists'); |
| 79 | Route::any('/get_category_list', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'get_category_list'])->name('blog_get_category_list'); | 79 | Route::any('/get_category_list', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'get_category_list'])->name('blog_get_category_list'); |
-
请 注册 或 登录 后发表评论