vue 阿里云发送短信Api
Posted 小小小菜鸟1
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue 阿里云发送短信Api相关的知识,希望对你有一定的参考价值。
const Core = require("@alicloud/pop-core"); var client = new Core({ accessKeyId: "xxxxxx", accessKeySecret: "xxxxxxx", endpoint: "https://dysmsapi.aliyuncs.com", apiVersion: "2017-05-25" }); var params = { RegionId: "cn-hangzhou", PhoneNumbers: mobile, SignName: "十面埋伏", // 签名名称 公司名 TemplateCode: "xxxxx", // --短信模板id TemplateParam: "{‘code‘:‘aaaaa‘}" }; var requestOption = { method: "POST" }; await client.request("SendSms", params, requestOption).then( result => { if (result.Code == "OK") { this.info.result = true; this.info.msg = "发送成功"; } //this.ctx.body = JSON.stringify(result); // console.log(JSON.stringify(result)); }, ex => { this.info.result = false; let mobilebaid = ""; if (mobile) { mobile += ","; } mobilebaid += mobile; this.info.msg = "发送失败,失败号码" + mobilebaid + "其它发送成功"; console.log(ex); }, await this.dbWrite.update(BizContractSub, { mobile: item.mobile }, { sendNumber: sendNumber }) );
以上是关于vue 阿里云发送短信Api的主要内容,如果未能解决你的问题,请参考以下文章