fix: api sms
This commit is contained in:
@@ -22,6 +22,14 @@ module.exports = {
|
|||||||
CODE_TYPE,
|
CODE_TYPE,
|
||||||
async sendMsgCode (phone, type) {
|
async sendMsgCode (phone, type) {
|
||||||
const validCodeType = CODE_TYPE[type];
|
const validCodeType = CODE_TYPE[type];
|
||||||
|
const exist = await Code.exists({
|
||||||
|
id: phone,
|
||||||
|
type: CODE_TYPE[type]
|
||||||
|
});
|
||||||
|
if (exist) return {
|
||||||
|
code: 1,
|
||||||
|
error: '请勿多次请求'
|
||||||
|
};
|
||||||
if (phone && type && validCodeType) {
|
if (phone && type && validCodeType) {
|
||||||
const code = Crypto.randomNumber({length: 6});
|
const code = Crypto.randomNumber({length: 6});
|
||||||
const [ sms, save ] = await Promise.all([
|
const [ sms, save ] = await Promise.all([
|
||||||
|
|||||||
Reference in New Issue
Block a user