1
0

ShopExpressController.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\shops;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\shops\ShopExpressLists;
  17. use app\adminapi\logic\shops\ShopCategoryLogic;
  18. use app\adminapi\logic\shops\ShopExpressLogic;
  19. use app\adminapi\validate\shops\ShopCategoryValidate;
  20. use app\adminapi\validate\shops\ShopExpressValidate;
  21. /**
  22. * ShopCategory控制器
  23. * Class ShopCategoryController
  24. * @package app\adminapi\controller\shops
  25. */
  26. class ShopExpressController extends BaseAdminController
  27. {
  28. public array $notNeedLogin = ['lists'];
  29. /**
  30. * @notes 获取列表
  31. * @return \think\response\Json
  32. * @author likeadmin
  33. * @date 2024/08/04 10:42
  34. */
  35. public function lists()
  36. { $params = $this->request->get();
  37. if(empty($params['admin_type'])){
  38. $result = ShopExpressLogic::lists($params);
  39. return $this->data($result);
  40. }
  41. return $this->dataLists(new ShopExpressLists());
  42. }
  43. /**
  44. * @notes 添加
  45. * @return \think\response\Json
  46. * @author likeadmin
  47. * @date 2024/08/04 10:42
  48. */
  49. public function add()
  50. {
  51. $params = (new ShopExpressValidate())->post()->goCheck('add');
  52. $result = ShopExpressLogic::add($params);
  53. if (true === $result) {
  54. return $this->success('添加成功', [], 1, 1);
  55. }
  56. return $this->fail(ShopExpressLogic::getError());
  57. }
  58. /**
  59. * @notes 编辑
  60. * @return \think\response\Json
  61. * @author likeadmin
  62. * @date 2024/08/04 10:42
  63. */
  64. public function edit()
  65. {
  66. $params = (new ShopCategoryValidate())->post()->goCheck('edit');
  67. $result = ShopCategoryLogic::edit($params);
  68. if (true === $result) {
  69. return $this->success('编辑成功', [], 1, 1);
  70. }
  71. return $this->fail(ShopCategoryLogic::getError());
  72. }
  73. /**
  74. * @notes 删除
  75. * @return \think\response\Json
  76. * @author likeadmin
  77. * @date 2024/08/04 10:42
  78. */
  79. public function delete()
  80. {
  81. $params = (new ShopCategoryValidate())->post()->goCheck('delete');
  82. ShopCategoryLogic::delete($params);
  83. return $this->success('删除成功', [], 1, 1);
  84. }
  85. /**
  86. * @notes 获取详情
  87. * @return \think\response\Json
  88. * @author likeadmin
  89. * @date 2024/08/04 10:42
  90. */
  91. public function detail()
  92. {
  93. $params = (new ShopCategoryValidate())->goCheck('detail');
  94. $result = ShopCategoryLogic::detail($params);
  95. return $this->data($result);
  96. }
  97. public function treeData()
  98. {
  99. $result = ShopCategoryLogic::getTreeData();
  100. return $this->data($result);
  101. }
  102. }