ShopApply.php 2.6 KB

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