发短信 支持native

This commit is contained in:
wkj 2023-12-14 20:26:01 +08:00
parent 69a8732908
commit ebf3210c8f
3 changed files with 6 additions and 7 deletions

View File

@ -1036,7 +1036,7 @@ export async function syncUserInfoWechatMp({ nickname, avatarUrl, encryptedData,
}
export async function sendCaptcha({ mobile, env, type: type2 }, context) {
const { type } = env;
assert(type === 'web');
assert(type === 'web' || type === 'native');
let { visitorId } = env;
const application = context.getApplication();
const { system } = application;

View File

@ -1045,7 +1045,7 @@ async function syncUserInfoWechatMp({ nickname, avatarUrl, encryptedData, iv, si
exports.syncUserInfoWechatMp = syncUserInfoWechatMp;
async function sendCaptcha({ mobile, env, type: type2 }, context) {
const { type } = env;
(0, assert_1.assert)(type === 'web');
(0, assert_1.assert)(type === 'web' || type === 'native');
let { visitorId } = env;
const application = context.getApplication();
const { system } = application;

View File

@ -1509,17 +1509,17 @@ export async function sendCaptcha<
{
mobile,
env,
type: type2
type: type2,
}: {
mobile: string;
env: WechatMpEnv | WebEnv;
env: WechatMpEnv | WebEnv | NativeEnv;
type: 'login' | 'changePassword' | 'confirm';
},
context: Cxt
): Promise<string> {
const { type } = env;
assert(type === 'web');
assert(type === 'web' || type === 'native');
let { visitorId } = env;
const application = context.getApplication();
const { system } = application!;
@ -1591,8 +1591,7 @@ export async function sendCaptcha<
if (process.env.NODE_ENV !== 'production' || mockSend) {
closeRootMode();
return `验证码[${code}]已创建`;
}
else if (captcha.$$createAt$$! as number - now < 60000) {
} else if ((captcha.$$createAt$$! as number) - now < 60000) {
closeRootMode();
throw new OakUserException('您的操作太迅捷啦,请稍等再点吧');
} else {