request->get(); $type = isset($get['type']) ? $get['type'] : 0; $mobile = isset($get['mobile']) ? $get['mobile'] : 0; if (stringUtil::isMobile($mobile) == false) { util::fail('请填写手机号'); } $code = stringUtil::getRandNum(4); $msg = "您的验证码:" . $code . "。为了您的帐号安全,验证码不要告诉别人哦"; $userId = $this->userId; $cacheKey = 'OPEN_SHOP_APPLY_' . $userId; Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 120, $code]); sms::send($mobile, $msg); util::ok('已发送'); } }