BargainController.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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\shopapi\controller;
  20. use app\common\enum\DeliveryEnum;
  21. use app\shopapi\lists\BargainRecordLists;
  22. use app\shopapi\logic\BargainLogic;
  23. use app\shopapi\validate\BargainValidate;
  24. /**
  25. * 砍价控制器
  26. * Class BargainController
  27. * @package app\shopapi\controller
  28. */
  29. class BargainController extends BaseShopController
  30. {
  31. public array $notNeedLogin = ['lists', 'detail'];
  32. /**
  33. * @notes 查看砍价活动列表
  34. * @author Tab
  35. * @date 2021/8/28 11:53
  36. */
  37. public function lists()
  38. {
  39. return $this->dataLists();
  40. }
  41. /**
  42. * @notes 砍价商品详情
  43. * @return \think\response\Json
  44. * @author Tab
  45. * @date 2021/8/28 15:42
  46. */
  47. public function detail()
  48. {
  49. $params = (new BargainValidate())->goCheck('detail');
  50. $result = BargainLogic::detail($params);
  51. return $this->data($result);
  52. }
  53. /**
  54. * @notes 发起砍价
  55. * @return \think\response\Json
  56. * @author Tab
  57. * @date 2021/8/28 16:34
  58. */
  59. public function initiate()
  60. {
  61. $params = (new BargainValidate())->post()->goCheck('initiate');
  62. $params['user_id'] = $this->userId;
  63. $result = BargainLogic::initiate($params);
  64. if ($result) {
  65. return $this->success('发起砍价成功', $result);
  66. }
  67. return $this->fail(BargainLogic::getError());
  68. }
  69. /**
  70. * @notes 帮助砍价
  71. * @return \think\response\Json
  72. * @throws \Exception
  73. * @author Tab
  74. * @date 2021/8/30 11:11
  75. */
  76. public function help()
  77. {
  78. $params = (new BargainValidate())->post()->goCheck('help');
  79. $params['user_id'] = $this->userId;
  80. $result = BargainLogic::help($params);
  81. if ($result) {
  82. return $this->success('帮助砍价成功', $result);
  83. }
  84. return $this->fail(BargainLogic::getError());
  85. }
  86. /**
  87. * @notes 砍价记录列表
  88. * @return \think\response\Json
  89. * @author Tab
  90. * @date 2021/8/30 14:36
  91. */
  92. public function record()
  93. {
  94. return $this->dataLists(new BargainRecordLists());
  95. }
  96. /**
  97. * @notes 查看砍价进度
  98. * @return \think\response\Json
  99. * @author Tab
  100. * @date 2021/9/18 14:36
  101. */
  102. public function bargainProgress()
  103. {
  104. $params = (new BargainValidate())->goCheck('bargainProgress');
  105. $result = BargainLogic::bargainProgress($params);
  106. return $this->data($result);
  107. }
  108. /**
  109. * @notes 分享帮砍详情
  110. * @return \think\response\Json
  111. * @author Tab
  112. * @date 2021/9/18 17:16
  113. */
  114. public function shareDetail()
  115. {
  116. $params = (new BargainValidate())->goCheck('shareDetail');
  117. $params['user_id'] = $this->userId;
  118. $result = BargainLogic::shareDetail($params);
  119. return $this->data($result);
  120. }
  121. }