38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
const activated = true;
|
|
const department = ['', '电脑部', '电器部', '文宣部', '人资部', '财外部'];
|
|
|
|
export default function successInform(phone, name, stuID, first, second) {
|
|
if (!activated) return;
|
|
// console.log(phone, name, stuID, first, second);
|
|
|
|
const Core = require('@alicloud/pop-core');
|
|
let client = new Core({
|
|
accessKeyId: 'LTAI4GGAnN9vPGAGph9foYuN',
|
|
accessKeySecret: 'PyDLVnceUuXWsT9DhiDJtDJ0NXLPxM',
|
|
endpoint: 'https://dysmsapi.aliyuncs.com',
|
|
apiVersion: '2017-05-25'
|
|
});
|
|
|
|
let temp = {
|
|
"name": name,
|
|
"stuID": stuID,
|
|
"first": department[first],
|
|
"second": department[second]
|
|
};
|
|
temp = JSON.stringify(temp);
|
|
|
|
let params = {
|
|
"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);
|
|
} |