cms.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. use think\facade\Route;
  12. /**
  13. * 文章管理 相关路由
  14. */
  15. Route::group('cms', function () {
  16. /** 文章 */
  17. Route::group(function () {
  18. //文章资源路由
  19. Route::resource('cms', 'v1.cms.Article')->option([
  20. 'real_name' => [
  21. 'index' => '获取文章列表',
  22. 'create' => '获取文章表单',
  23. 'read' => '获取文章详细信息',
  24. 'save' => '保存文章',
  25. 'edit' => '获取修改文章表单',
  26. 'update' => '修改文章',
  27. 'delete' => '删除文章'
  28. ]
  29. ]);
  30. //关联商品
  31. Route::put('cms/relation/:id', 'v1.cms.Article/relation')->name('Relation')->option(['real_name' => '文章关联商品']);
  32. //取消关联
  33. Route::put('cms/unrelation/:id', 'v1.cms.Article/unrelation')->name('UnRelation')->option(['real_name' => '取消文章关联商品']);
  34. })->option(['parent' => 'cms', 'cate_name' => '文章管理']);
  35. /** 文章分类 */
  36. Route::group(function () {
  37. //文章分类资源路由
  38. Route::resource('category', 'v1.cms.ArticleCategory')->except(['read'])->option([
  39. 'real_name' => [
  40. 'index' => '获取文章分类列表',
  41. 'create' => '获取文章分类表单',
  42. 'save' => '保存文章分类',
  43. 'edit' => '获取修改文章分类表单',
  44. 'update' => '修改文章分类',
  45. 'delete' => '删除文章分类'
  46. ]
  47. ]);
  48. //修改状态
  49. Route::put('category/set_status/:id/:status', 'v1.cms.ArticleCategory/set_status')->name('CategoryStatus')->option(['real_name' => '修改文章分类状态']);
  50. //分类列表
  51. Route::get('category_list', 'v1.cms.ArticleCategory/categoryList')->name('categoryList')->option(['real_name' => '分类列表']);
  52. //分类树形列表
  53. Route::get('category_tree_list', 'v1.cms.ArticleCategory/getTreeList')->name('getTreeList')->option(['real_name' => '分类树形列表']);
  54. })->option(['parent' => 'cms', 'cate_name' => '文章分类']);
  55. })->middleware([
  56. \app\http\middleware\AllowOriginMiddleware::class,
  57. \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
  58. \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
  59. \app\adminapi\middleware\AdminLogMiddleware::class
  60. ])->option(['mark' => 'cms', 'mark_name' => '文章模块']);