| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace hd\controllers;
- use biz\ghs\classes\GhsClass;
- use biz\market\classes\XrFlClass;
- use biz\shop\classes\ShopClass;
- use bizGhs\custom\classes\CustomClass;
- use common\components\util;
- use Yii;
- class HbController extends BaseController
- {
- public $guestAccess = [];
- //获取新人红包福利 ssh 20211026
- public function actionGetNewGift()
- {
- $ghsId = Yii::$app->request->get('ghsId', 0);
- $ghs = GhsClass::getById($ghsId, true);
- GhsClass::valid($ghs, $this->shopId);
- $ghsShopId = $ghs->shopId ?? 0;
- $ghsShop = ShopClass::getById($ghsShopId, true);
- $xrFl = $ghsShop->xrFl ?? 0;
- if ($xrFl == 0) {
- util::fail('活动已结束');
- }
- $sendNewGift = $ghs->sendNewGift ?? 0;
- if ($sendNewGift == 1) {
- util::fail('已经领过了');
- }
- $new = $ghs->new ?? 0;
- if ($new == 0) {
- util::fail('新人才能领取哦');
- }
- $customId = $ghs->customId ?? 0;
- $custom = CustomClass::getById($customId, true);
- XrFlClass::giveGift($ghs, $custom);
- util::complete('领取成功');
- }
- }
|