ShopApply.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace app\api\controller\shop;
  3. use app\dict\shop\ShopApplyDict;
  4. use app\service\admin\shop\admin\ShopCategoryService;
  5. use app\service\api\agreement\AgreementService;
  6. use app\service\api\shop\ShopApplyService;
  7. use app\service\admin\site\SiteGroupService;
  8. use core\base\BaseApiController;
  9. use think\Response;
  10. class ShopApply extends BaseApiController
  11. {
  12. /**
  13. * 店铺申请列表
  14. * @return Response
  15. */
  16. public function lists()
  17. {
  18. $data = $this->request->params([
  19. [ 'status', '' ]
  20. ]);
  21. return success((new ShopApplyService())->getPage($data));
  22. }
  23. /**
  24. * 店铺申请详情
  25. * @return Response
  26. */
  27. public function info($id)
  28. {
  29. return success((new ShopApplyService())->getInfo($id));
  30. }
  31. /**
  32. * 添加店铺申请
  33. * @return Response
  34. */
  35. public function add()
  36. {
  37. $data = $this->request->params([
  38. [ 'site_name', '' ],
  39. [ 'user_name', '' ],
  40. [ 'user_mobile', '' ],
  41. [ 'category_id', '' ],
  42. [ 'group_id', '' ],
  43. [ 'business_license', '' ],
  44. [ 'status', 1 ]
  45. ]);
  46. $this->validate($data, 'app\validate\shop\ShopApply.add');
  47. $id = ( new ShopApplyService() )->add($data);
  48. return success('ADD_SUCCESS', [ 'id' => $id ]);
  49. }
  50. /**
  51. * 编辑店铺申请
  52. * @param $id - 店铺申请id
  53. * @return Response
  54. */
  55. public function edit($id)
  56. {
  57. $data = $this->request->params([
  58. [ 'site_name', '' ],
  59. [ 'user_name', '' ],
  60. [ 'user_mobile', '' ],
  61. [ 'category_id', '' ],
  62. [ 'group_id', '' ],
  63. [ 'business_license', '' ],
  64. [ 'status', 1 ]
  65. ]);
  66. $this->validate($data, 'app\validate\shop\ShopApply.edit');
  67. ( new ShopApplyService() )->edit($id, $data);
  68. return success('EDIT_SUCCESS');
  69. }
  70. /**
  71. * 查询店铺分类列表
  72. * @return Response
  73. */
  74. public function shopCategory()
  75. {
  76. $data = $this->request->params([
  77. [ 'category_name', '' ],
  78. ]);
  79. return success(( new ShopCategoryService() )->getList($data ,'category_id, category_name'));
  80. }
  81. /**
  82. * 查询店铺套餐列表
  83. * @return Response
  84. */
  85. public function siteGroup()
  86. {
  87. $data = $this->request->params([
  88. [ 'group_name', '' ],
  89. ]);
  90. return success(( new SiteGroupService() )->getList($data ,'group_id, group_name'));
  91. }
  92. /**
  93. * 获取店铺申请协议内容
  94. * @return Response
  95. */
  96. public function agreement()
  97. {
  98. return success(( new AgreementService() )->getAgreement('apply'));
  99. }
  100. /**
  101. * 店铺申请状态
  102. * @return Response
  103. */
  104. public function statusList()
  105. {
  106. return success((new ShopApplyService())->getStatusList());
  107. }
  108. }