fix 发短信验证码时, 测试只mock短信
This commit is contained in:
parent
0be5555f60
commit
215b82af6c
|
|
@ -1148,37 +1148,30 @@ export async function sendCaptcha({ mobile, env, type: type2, }, context) {
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const result = await sendSms({
|
||||
origin: 'tencent',
|
||||
templateName: '登录',
|
||||
mobile,
|
||||
templateParam: { code, duration: duration.toString() },
|
||||
}, context);
|
||||
closeRootMode();
|
||||
if (result.success) {
|
||||
return '验证码已发送';
|
||||
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
} else {
|
||||
//发送短信
|
||||
const result = await sendSms(
|
||||
{
|
||||
origin: 'tencent',
|
||||
templateName: '登录',
|
||||
mobile,
|
||||
templateParam: {
|
||||
code,
|
||||
duration: duration.toString(),
|
||||
},
|
||||
},
|
||||
context
|
||||
);
|
||||
closeRootMode();
|
||||
if (result.success) {
|
||||
return '验证码已发送';
|
||||
}
|
||||
return '验证码发送失败';
|
||||
}
|
||||
return '验证码发送失败';
|
||||
// if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
// closeRootMode();
|
||||
// return `验证码[${code}]已创建`;
|
||||
// } else {
|
||||
// //发送短信
|
||||
// const result = await sendSms<ED, Cxt>(
|
||||
// {
|
||||
// origin: 'tencent',
|
||||
// templateName: '登录',
|
||||
// mobile,
|
||||
// templateParam: { code, duration: duration.toString() },
|
||||
// },
|
||||
// context
|
||||
// );
|
||||
// closeRootMode();
|
||||
// if (result === true) {
|
||||
// return '验证码已发送';
|
||||
// }
|
||||
// return '验证码发送失败';
|
||||
// }
|
||||
}
|
||||
}
|
||||
export async function switchTo({ userId }, context) {
|
||||
|
|
|
|||
|
|
@ -1157,37 +1157,27 @@ async function sendCaptcha({ mobile, env, type: type2, }, context) {
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const result = await (0, sms_1.sendSms)({
|
||||
origin: 'tencent',
|
||||
templateName: '登录',
|
||||
mobile,
|
||||
templateParam: { code, duration: duration.toString() },
|
||||
}, context);
|
||||
closeRootMode();
|
||||
if (result.success) {
|
||||
return '验证码已发送';
|
||||
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
} else {
|
||||
//发送短信
|
||||
const result = await (0, sms_1.sendSms)(
|
||||
{
|
||||
origin: 'tencent',
|
||||
templateName: '登录',
|
||||
mobile,
|
||||
templateParam: { code, duration: duration.toString() },
|
||||
},
|
||||
context
|
||||
);
|
||||
closeRootMode();
|
||||
if (result.success) {
|
||||
return '验证码已发送';
|
||||
}
|
||||
return '验证码发送失败';
|
||||
}
|
||||
return '验证码发送失败';
|
||||
// if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
// closeRootMode();
|
||||
// return `验证码[${code}]已创建`;
|
||||
// } else {
|
||||
// //发送短信
|
||||
// const result = await sendSms<ED, Cxt>(
|
||||
// {
|
||||
// origin: 'tencent',
|
||||
// templateName: '登录',
|
||||
// mobile,
|
||||
// templateParam: { code, duration: duration.toString() },
|
||||
// },
|
||||
// context
|
||||
// );
|
||||
// closeRootMode();
|
||||
// if (result === true) {
|
||||
// return '验证码已发送';
|
||||
// }
|
||||
// return '验证码发送失败';
|
||||
// }
|
||||
}
|
||||
}
|
||||
exports.sendCaptcha = sendCaptcha;
|
||||
|
|
|
|||
|
|
@ -1648,40 +1648,27 @@ export async function sendCaptcha<
|
|||
dontCollect: true,
|
||||
}
|
||||
);
|
||||
const result = await sendSms<ED, Cxt>(
|
||||
{
|
||||
origin: 'tencent',
|
||||
templateName: '登录',
|
||||
mobile,
|
||||
templateParam: { code, duration: duration.toString() },
|
||||
},
|
||||
context
|
||||
);
|
||||
closeRootMode();
|
||||
if (result.success) {
|
||||
return '验证码已发送';
|
||||
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
} else {
|
||||
//发送短信
|
||||
const result = await sendSms<ED, Cxt>(
|
||||
{
|
||||
origin: 'tencent',
|
||||
templateName: '登录',
|
||||
mobile,
|
||||
templateParam: { code, duration: duration.toString() },
|
||||
},
|
||||
context
|
||||
);
|
||||
closeRootMode();
|
||||
if (result.success) {
|
||||
return '验证码已发送';
|
||||
}
|
||||
return '验证码发送失败';
|
||||
}
|
||||
return '验证码发送失败';
|
||||
// if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
// closeRootMode();
|
||||
// return `验证码[${code}]已创建`;
|
||||
// } else {
|
||||
// //发送短信
|
||||
// const result = await sendSms<ED, Cxt>(
|
||||
// {
|
||||
// origin: 'tencent',
|
||||
// templateName: '登录',
|
||||
// mobile,
|
||||
// templateParam: { code, duration: duration.toString() },
|
||||
// },
|
||||
// context
|
||||
// );
|
||||
// closeRootMode();
|
||||
// if (result === true) {
|
||||
// return '验证码已发送';
|
||||
// }
|
||||
// return '验证码发送失败';
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue