ShopCouponController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. //门店列表 shish 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. }
  20. $ghsId = $get['ghsId'] ?? 0;
  21. if (!empty($ghsId)) {
  22. $where['ghsId'] = $ghsId;
  23. }
  24. $list = ShopCouponService::getCouponList($where);
  25. util::success($list);
  26. }
  27. //有可用红包 shish 2021.5.15
  28. public function actionHas()
  29. {
  30. //不要考虑最低消费,把客户所有红包列出来,这样客户可以有选择的消费!!!!!!
  31. $ghsId = Yii::$app->request->get('ghsId', 0);
  32. $has = ShopCouponClass::hasValidCoupon($this->shopId, $ghsId);
  33. $data = ['has' => $has];
  34. util::success($data);
  35. }
  36. //供应商发放的有效优惠券、红包 shish 20211001
  37. public function actionGhsSendHb()
  38. {
  39. $get = Yii::$app->request->get();
  40. $amount = $get['amount'] ?? 0;
  41. $ghsId = $get['ghsId'] ?? 0;
  42. $list = ShopCouponClass::ghsSendHb($this->shopId, $ghsId, $amount);
  43. util::success(['list' => $list]);
  44. }
  45. }