Shop.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-mall 企业快速开发的多应用管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\api\controller\shop;
  12. use app\service\api\shop\ShopMemberService;
  13. use app\service\api\shop\ShopService;
  14. use core\base\BaseApiController;
  15. use think\Response;
  16. class Shop extends BaseApiController
  17. {
  18. /**
  19. * 店铺列表
  20. * @return Response
  21. */
  22. public function lists()
  23. {
  24. $data = $this->request->params([
  25. ['keyword', ''],
  26. ['group_id', ''],
  27. ['category_id', ''],
  28. ['is_self', ''],
  29. ]);
  30. return success((new ShopService())->getPage($data));
  31. }
  32. /**
  33. * 甄选好店列表(web端)
  34. * @return Response
  35. */
  36. public function selectShopLists()
  37. {
  38. return success((new ShopService())->getSelectShopLists());
  39. }
  40. /**
  41. * 店铺列表(wap端)
  42. * @return Response
  43. */
  44. public function shopLists()
  45. {
  46. $data = $this->request->params([
  47. ['keyword', ''],
  48. ['group_id', ''],
  49. ['category_id', ''],
  50. ['is_self', ''],
  51. ]);
  52. return success((new ShopService())->getShopPage($data));
  53. }
  54. /**
  55. * 店铺列表
  56. * @return Response
  57. */
  58. public function all()
  59. {
  60. $data = $this->request->params([
  61. ['limit', 0],
  62. ]);
  63. return success((new ShopService())->getAll($data['limit']));
  64. }
  65. /**
  66. * 店铺详情
  67. * @param int $id
  68. * @return Response
  69. */
  70. public function info($id)
  71. {
  72. return success((new ShopService())->getInfo($id));
  73. }
  74. /**
  75. * 店铺关注
  76. * @return Response
  77. */
  78. public function follow($id, $is_follow)
  79. {
  80. (new ShopMemberService())->follow($id, $is_follow);
  81. return success('SUCCESS');
  82. }
  83. /**
  84. * 获取店铺列表供组件调用
  85. * @return Response
  86. */
  87. public function components()
  88. {
  89. $data = $this->request->params([
  90. [ 'num', 0 ],
  91. [ 'site_ids', '' ],
  92. [ 'category_id', 0 ],
  93. [ 'order', '' ] // 排序方式
  94. ]);
  95. return success(( new ShopService() )->getShopComponents($data));
  96. }
  97. /**
  98. * 获取店铺二维码
  99. */
  100. public function qrcode($id){
  101. return success(data: (new ShopService())->getQrcode($id));
  102. }
  103. }