Commit c4125e0e by v_vjyjiang

d

parent bc8e3354
......@@ -23,7 +23,7 @@ class VCodeCache extends CacheBase {
var signName = items ? items[0] : "";
var vcode = await this.smsUtil.getUidStr(6, 10);
if (!tmplCode && !signName) {
console.log("=====================================")
console.log("=====================================", mobile, vcode)
this.smsUtil.sendMsg(mobile, vcode);
} //tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
else {
......
const system=require("../system");
const system = require("../system");
const Core = require('@alicloud/pop-core');
class SmsClient{
constructor(){
this.smsTeml="http://123.57.156.109:4103/api/Send";
this.restClient=system.getObject("util.restClient");
this.aliclient=new Core({
class SmsClient {
constructor() {
this.smsTeml = "http://123.57.156.109:4103/api/Send";
this.restClient = system.getObject("util.restClient");
this.aliclient = new Core({
accessKeyId: 'LTAI4FtNp3wcqFzaADvo1WtZ',
accessKeySecret: 'VBKn1Anx4UmMF0LKNz7PVaCFG1phcg',
endpoint: 'https://dysmsapi.aliyuncs.com',
......@@ -13,7 +13,7 @@ class SmsClient{
}
async aliSendMsg(to,tmplcode,signName,jsonContent){
async aliSendMsg (to, tmplcode, signName, jsonContent) {
var params = {
"RegionId": "default",
"PhoneNumbers": to,
......@@ -31,15 +31,15 @@ class SmsClient{
})
}
async sendMsg(to,content){
var txtObj ={
"appId":8,
"mobilePhone":to,
"content":content
async sendMsg (to, content) {
var txtObj = {
"appId": 8,
"mobilePhone": to,
"content": content
}
return this.restClient.execPost(txtObj,this.smsTeml);
return this.restClient.execPost(txtObj, this.smsTeml);
}
async getUidStr(len, radix) {
async getUidStr (len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
var uuid = [], i;
radix = radix || chars.length;
......@@ -60,7 +60,7 @@ class SmsClient{
}
}
module.exports=SmsClient;
module.exports = SmsClient;
// var sms=new SmsClient();
// sms.aliSendMsg("13381139519","SMS_173946419","iboss",JSON.stringify({code:"hello"}));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment