限制前端发短信次数,只给三次,超过请清除localstorage
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
285b919be7
commit
967936a6e3
|
|
@ -1,38 +1,42 @@
|
||||||
const activated = true;
|
const activated = true;
|
||||||
const department = ['', '电脑部', '电器部', '文宣部', '人资部', '财外部'];
|
const department = ["", "电脑部", "电器部", "文宣部", "人资部", "财外部"];
|
||||||
|
|
||||||
export default function successInform(phone, name, stuID, first, second) {
|
export default function successInform(phone, name, stuID, first, second) {
|
||||||
if (!activated) return;
|
if (!activated) return;
|
||||||
// console.log(phone, name, stuID, first, second);
|
// console.log(phone, name, stuID, first, second);
|
||||||
|
let nownum = localStorage.getItem("EVA_SMS_SERVICE");
|
||||||
|
if (nownum === null) localStorage.setItem("EVA_SMS_SERVICE", "1");
|
||||||
|
else if (nownum === "1") localStorage.setItem("EVA_SMS_SERVICE", "2");
|
||||||
|
else if (nownum === "2") localStorage.setItem("EVA_SMS_SERVICE", "3");
|
||||||
|
if (nownum === "3") return;
|
||||||
|
const Core = require("@alicloud/pop-core");
|
||||||
|
let client = new Core({
|
||||||
|
accessKeyId: "LTAI4GGAnN9vPGAGph9foYuN",
|
||||||
|
accessKeySecret: "PyDLVnceUuXWsT9DhiDJtDJ0NXLPxM",
|
||||||
|
endpoint: "https://dysmsapi.aliyuncs.com",
|
||||||
|
apiVersion: "2017-05-25",
|
||||||
|
});
|
||||||
|
|
||||||
const Core = require('@alicloud/pop-core');
|
let temp = {
|
||||||
let client = new Core({
|
name: name,
|
||||||
accessKeyId: 'LTAI4GGAnN9vPGAGph9foYuN',
|
stuID: stuID,
|
||||||
accessKeySecret: 'PyDLVnceUuXWsT9DhiDJtDJ0NXLPxM',
|
first: department[first],
|
||||||
endpoint: 'https://dysmsapi.aliyuncs.com',
|
second: department[second],
|
||||||
apiVersion: '2017-05-25'
|
};
|
||||||
});
|
temp = JSON.stringify(temp);
|
||||||
|
|
||||||
let temp = {
|
let params = {
|
||||||
"name": name,
|
RegionId: "cn-hangzhou",
|
||||||
"stuID": stuID,
|
PhoneNumbers: phone,
|
||||||
"first": department[first],
|
SignName: "EVA记录",
|
||||||
"second": department[second]
|
TemplateCode: "SMS_199600228",
|
||||||
};
|
TemplateParam: temp,
|
||||||
temp = JSON.stringify(temp);
|
};
|
||||||
|
// console.log(params);
|
||||||
|
let requestOption = {
|
||||||
|
method: "POST",
|
||||||
|
headers: {},
|
||||||
|
};
|
||||||
|
|
||||||
let params = {
|
client.request("SendSms", params, requestOption);
|
||||||
"RegionId": "cn-hangzhou",
|
|
||||||
"PhoneNumbers": phone,
|
|
||||||
"SignName": "EVA记录",
|
|
||||||
"TemplateCode": "SMS_199600228",
|
|
||||||
"TemplateParam": temp
|
|
||||||
};
|
|
||||||
// console.log(params);
|
|
||||||
let requestOption = {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
client.request('SendSms', params, requestOption);
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue