InfoCategoryController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller\info;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\info\InfoCategoryLists;
  22. use app\adminapi\validate\info\InfoCategoryValidate;
  23. use app\adminapi\logic\info\InfoCategoryLogic;
  24. class InfoCategoryController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 添加分类
  28. * @return \think\response\Json
  29. * @author ljj
  30. * @date 2021/7/14 3:04
  31. */
  32. public function add()
  33. {
  34. $params = (new InfoCategoryValidate())->post()->goCheck('add');
  35. (new InfoCategoryLogic())->add($params);
  36. return $this->success('添加分类成功',[],1,1);
  37. }
  38. /**
  39. * @notes 查看分类信息
  40. * @return \think\response\Json
  41. * @author ljj
  42. * @date 2021/7/14 5:41
  43. */
  44. public function lists()
  45. {
  46. return $this->dataLists(new InfoCategoryLists());
  47. }
  48. /**
  49. * @notes 删除分类
  50. * @return \think\response\Json
  51. * @author ljj
  52. * @date 2021/7/14 7:07
  53. */
  54. public function del()
  55. {
  56. $params = (new InfoCategoryValidate())->post()->goCheck('del');
  57. (new InfoCategoryLogic())->del($params);
  58. return $this->success('删除成功',[],1,1);
  59. }
  60. /**
  61. * @notes 编辑分类
  62. * @return \think\response\Json
  63. * @author ljj
  64. * @date 2021/7/15 10:55
  65. */
  66. public function edit()
  67. {
  68. $params = (new InfoCategoryValidate())->post()->goCheck('edit');
  69. (new InfoCategoryLogic())->edit($params);
  70. return $this->success('修改成功',[],1,1);
  71. }
  72. /**
  73. * @notes 修改分类状态
  74. * @return \think\response\Json
  75. * @throws \think\db\exception\DataNotFoundException
  76. * @throws \think\db\exception\DbException
  77. * @throws \think\db\exception\ModelNotFoundException
  78. * @author ljj
  79. * @date 2021/7/15 11:42
  80. */
  81. public function status()
  82. {
  83. $params = (new InfoCategoryValidate())->post()->goCheck('status');
  84. (new InfoCategoryLogic())->status($params);
  85. return $this->success('状态修改成功',[],1,1);
  86. }
  87. /**
  88. * @notes 查看分类详情
  89. * @return \think\response\Json
  90. * @throws \think\db\exception\DataNotFoundException
  91. * @throws \think\db\exception\DbException
  92. * @throws \think\db\exception\ModelNotFoundException
  93. * @author ljj
  94. * @date 2021/7/19 4:46 下午
  95. */
  96. public function detail()
  97. {
  98. $params = (new InfoCategoryValidate())->goCheck('detail');
  99. $result = (new InfoCategoryLogic())->detail($params);
  100. return $this->success('分类详情获取成功',$result,1,0);
  101. }
  102. }