ShopCouponController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace hd\controllers;
  3. use biz\shop\classes\ShopCouponClass;
  4. use biz\shop\services\ShopCouponService;
  5. use common\components\util;
  6. use Yii;
  7. class ShopCouponController extends BaseController
  8. {
  9. public $guestAccess = [];
  10. //门店列表 ssh 2021.5.15
  11. public function actionList()
  12. {
  13. $get = Yii::$app->request->get();
  14. $where = [];
  15. $where['shopId'] = $this->shopId;
  16. $status = $get['status'] ?? 0;
  17. if (!empty($status)) {
  18. $where['status'] = $status;
  19. if ($status == 1) {
  20. $where['take'] = 1;
  21. }
  22. }
  23. $ghsId = $get['ghsId'] ?? 0;
  24. if (!empty($ghsId)) {
  25. $where['ghsId'] = $ghsId;
  26. }
  27. $list = ShopCouponService::getCouponList($where);
  28. util::success($list);
  29. }
  30. //有可用红包 ssh 2021.5.15
  31. public function actionHas()
  32. {
  33. //不要考虑最低消费,把客户所有红包列出来,这样客户可以有选择的消费!!!!!!
  34. $ghsId = Yii::$app->request->get('ghsId', 0);
  35. $has = ShopCouponClass::hasValidCoupon($this->shopId, $ghsId);
  36. $data = ['has' => $has];
  37. util::success($data);
  38. }
  39. //供货商发放的有效优惠券、红包 ssh 20211001
  40. public function actionGhsSendHb()
  41. {
  42. $get = Yii::$app->request->get();
  43. $amount = $get['amount'] ?? 0;
  44. $ghsId = $get['ghsId'] ?? 0;
  45. $list = ShopCouponClass::ghsSendHb($this->shopId, $ghsId, $amount);
  46. util::success(['list' => $list]);
  47. }
  48. }