HbController.php 843 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace hd\controllers;
  3. use biz\ghs\classes\GhsClass;
  4. use biz\shop\classes\ShopClass;
  5. use common\components\util;
  6. use Yii;
  7. class HbController extends BaseController
  8. {
  9. public $guestAccess = [];
  10. //获取新人红包福利 shish 20211026
  11. public function actionGetNewGift()
  12. {
  13. $ghsId = Yii::$app->request->get('ghsId', 0);
  14. $ghs = GhsClass::getById($ghsId, true);
  15. GhsClass::valid($ghs, $this->shopId);
  16. $ghsShopId = $ghs->shopId ?? 0;
  17. $ghsShop = ShopClass::getById($ghsShopId, true);
  18. $xrFl = $ghsShop->xrFl ?? 0;
  19. if ($xrFl == 0) {
  20. util::fail('活动已结束');
  21. }
  22. $sendNewGift = $ghs->sendNewGift ?? 0;
  23. if ($sendNewGift == 1) {
  24. util::fail('已经领过了');
  25. }
  26. util::complete('领取成功');
  27. }
  28. }