GoodsCategoryController.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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\goods;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\goods\GoodsCategoryCommonLists;
  22. use app\adminapi\lists\goods\GoodsCategoryLists;
  23. use app\adminapi\logic\goods\GoodsCategoryLogic;
  24. use app\adminapi\validate\goods\GoodsCategoryValidate;
  25. class GoodsCategoryController extends BaseAdminController
  26. {
  27. public function commonLists()
  28. {
  29. return $this->dataLists(new GoodsCategoryCommonLists());
  30. }
  31. /**
  32. * @notes 添加商品分类
  33. * @return \think\response\Json
  34. * @author ljj
  35. * @date 2021/7/17 4:38 下午
  36. */
  37. public function add()
  38. {
  39. $params = (new GoodsCategoryValidate())->post()->goCheck('add');
  40. (new GoodsCategoryLogic())->add($params);
  41. return $this->success('商品分类添加成功',[],1,1);
  42. }
  43. /**
  44. * @notes 查看商品分类列表
  45. * @return \think\response\Json
  46. * @author ljj
  47. * @date 2021/7/17 5:54 下午
  48. */
  49. public function lists()
  50. {
  51. return $this->dataLists(new GoodsCategoryLists());
  52. }
  53. /**
  54. * @notes 修改商品分类状态
  55. * @return \think\response\Json
  56. * @author ljj
  57. * @date 2021/7/19 11:46 上午
  58. */
  59. public function status()
  60. {
  61. $params = (new GoodsCategoryValidate())->post()->goCheck('status');
  62. (new GoodsCategoryLogic())->status($params);
  63. return $this->success('状态修改成功',[],1,1);
  64. }
  65. /**
  66. * @notes 删除商品分类
  67. * @return \think\response\Json
  68. * @author ljj
  69. * @date 2021/7/19 2:04 下午
  70. */
  71. public function del()
  72. {
  73. $params = (new GoodsCategoryValidate())->post()->goCheck('del');
  74. (new GoodsCategoryLogic())->del($params);
  75. return $this->success('商品分类删除成功',[],1,1);
  76. }
  77. /**
  78. * @notes 编辑商品分类
  79. * @return \think\response\Json
  80. * @author ljj
  81. * @date 2021/7/19 4:02 下午
  82. */
  83. public function edit()
  84. {
  85. $params = (new GoodsCategoryValidate())->post()->goCheck('edit');
  86. (new GoodsCategoryLogic())->edit($params);
  87. return $this->success('商品分类修改成功',[],1,1);
  88. }
  89. /**
  90. * @notes 查看商品分类详情
  91. * @return \think\response\Json
  92. * @throws \think\db\exception\DataNotFoundException
  93. * @throws \think\db\exception\DbException
  94. * @throws \think\db\exception\ModelNotFoundException
  95. * @author ljj
  96. * @date 2021/7/19 4:36 下午
  97. */
  98. public function detail()
  99. {
  100. $params = (new GoodsCategoryValidate())->goCheck('detail');
  101. $result = (new GoodsCategoryLogic())->detail($params);
  102. return $this->success('商品分类详情获取成功',$result,1,0);
  103. }
  104. }