码迷,mamicode.com
首页 > Windows程序 > 详细

vue 阿里云发送短信Api

时间:2020-03-22 17:40:01      阅读:284      评论:0      收藏:0      [点我收藏+]

标签:one   https   ber   result   res   Nid   模板   template   version   

  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

标签:one   https   ber   result   res   Nid   模板   template   version   

原文地址:https://www.cnblogs.com/lvqianqian/p/12546783.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!