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(); } if (BirthdayGiftClass::isSmsClaimPush($post)) { Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; try { BirthdayGiftClass::claimBySmsPush($post); return ['clcode' => '000000']; } catch (\Throwable $e) { Yii::error('birthday gift sms claim failed: ' . $e->getMessage() . ' params=' . json_encode($post, JSON_UNESCAPED_UNICODE), __METHOD__); return ['clcode' => '111111']; } } $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('领取成功'); } }