rename SMS_*
to MSG_*
This commit is contained in:
parent
e03784482f
commit
90aff88301
20
messenger.js
20
messenger.js
@ -20,10 +20,10 @@ module.exports = {
|
|||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result.messageId && result.response === '250 Ok') {
|
if (result.messageId && result.response === '250 Ok') {
|
||||||
console.log(result)
|
console.log(result)
|
||||||
return { _state: 'SMS_SENT_SUCCESS' }
|
return { _state: 'MSG_SENT_SUCCESS' }
|
||||||
}
|
}
|
||||||
console.log(result)
|
console.log(result)
|
||||||
return { _state: 'SMS_SEND_FAIL' }
|
return { _state: 'MSG_SEND_FAIL' }
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
@ -84,9 +84,9 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
resp.on('end', () => {
|
resp.on('end', () => {
|
||||||
if (parseInt(returnCode) === 100) {
|
if (parseInt(returnCode) === 100) {
|
||||||
resolve({ _state: 'SMS_SENT_SUCCESS' }) // 100: 发送成功 (表示已和我们接口连通)
|
resolve({ _state: 'MSG_SENT_SUCCESS' }) // 100: 发送成功 (表示已和我们接口连通)
|
||||||
} else {
|
} else {
|
||||||
resolve({ _state: 'SMS_SEND_FAIL', error: { returnCode } }) // 短信接口错误代码:http://www.dxton.com/help_detail/2.html
|
resolve({ _state: 'MSG_SEND_FAIL', error: { returnCode } }) // 短信接口错误代码:http://www.dxton.com/help_detail/2.html
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -113,9 +113,9 @@ module.exports = {
|
|||||||
function (result) {
|
function (result) {
|
||||||
let { Code } = result
|
let { Code } = result
|
||||||
if (Code === 'OK') {
|
if (Code === 'OK') {
|
||||||
return { _state: 'SMS_SENT_SUCCESS' }
|
return { _state: 'MSG_SENT_SUCCESS' }
|
||||||
} else {
|
} else {
|
||||||
return { _state: 'SMS_SEND_FAIL', error: result }
|
return { _state: 'MSG_SEND_FAIL', error: result }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
@ -135,11 +135,11 @@ module.exports = {
|
|||||||
data: msgParam, // 模版中的变量的值,例如 { passcode: '234345', purpose: '注册' }
|
data: msgParam, // 模版中的变量的值,例如 { passcode: '234345', purpose: '注册' }
|
||||||
})
|
})
|
||||||
|
|
||||||
return { _state: 'SMS_SENT_SUCCESS', result } // 调用成功,请注意这时不代表发送成功。// { code:0, errCode:0, success:true } 错误码参见 https://uniapp.dcloud.net.cn/uniCloud/send-sms.html
|
return { _state: 'MSG_SENT_SUCCESS', result } // 调用成功,请注意这时不代表发送成功。// { code:0, errCode:0, success:true } 错误码参见 https://uniapp.dcloud.net.cn/uniCloud/send-sms.html
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 调用失败 例如 {"code":undefined,"msg":"短信发送失败:账户余额不足"}
|
// 调用失败 例如 {"code":undefined,"msg":"短信发送失败:账户余额不足"}
|
||||||
return {
|
return {
|
||||||
_state: 'SMS_SEND_FAIL',
|
_state: 'MSG_SEND_FAIL',
|
||||||
error, // { errCode, errMsg }
|
error, // { errCode, errMsg }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,9 +161,9 @@ module.exports = {
|
|||||||
function ({ SendStatusSet, RequestId } = {}) {
|
function ({ SendStatusSet, RequestId } = {}) {
|
||||||
let { SerialNo, PhoneNumber, Fee, Code, Message, IsoCode } = SendStatusSet[0]
|
let { SerialNo, PhoneNumber, Fee, Code, Message, IsoCode } = SendStatusSet[0]
|
||||||
if (Code === 'Ok') {
|
if (Code === 'Ok') {
|
||||||
return { _state: 'SMS_SENT_SUCCESS' }
|
return { _state: 'MSG_SENT_SUCCESS' }
|
||||||
} else {
|
} else {
|
||||||
return { _state: 'SMS_SEND_FAIL', error: { SendStatusSet, RequestId } }
|
return { _state: 'MSG_SEND_FAIL', error: { SendStatusSet, RequestId } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user