| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace mall\controllers;
- use bizHd\birthday\classes\BirthdayGiftClass;
- use common\components\util;
- use Yii;
- class BirthdayGiftController extends BaseController
- {
- public $guestAccess = ['info', 'claim'];
- public function actionInfo()
- {
- $get = Yii::$app->request->get();
- $token = trim($get['token'] ?? '');
- $account = intval($get['account'] ?? 0);
- if (empty($token) || $account <= 0) {
- util::fail('参数错误');
- }
- $data = BirthdayGiftClass::getInfoByToken($account, $token);
- util::success($data);
- }
- public function actionClaim()
- {
- $post = Yii::$app->request->post();
- if (empty($post)) {
- $post = Yii::$app->request->get();
- }
- $token = trim($post['token'] ?? '');
- $account = intval($post['account'] ?? 0);
- $pickupTime = trim($post['pickupTime'] ?? '');
- if (empty($token) || $account <= 0) {
- util::fail('参数错误');
- }
- BirthdayGiftClass::claimByToken($account, $token, $pickupTime);
- util::complete('领取成功');
- }
- }
|