|
|
@@ -641,7 +641,7 @@ function ToolKit(scriptName, scriptId, options) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- pushWxMsg(summary, content, url) {
|
|
|
+ pushWxMsg(summary, content, url, callback = () => { }) {
|
|
|
let data = {
|
|
|
appToken: "AT_rTc93GQYIdMU8XLRnoJaSea8WkfhSzhX",
|
|
|
content: content,
|
|
|
@@ -651,30 +651,21 @@ function ToolKit(scriptName, scriptId, options) {
|
|
|
uids: [
|
|
|
"UID_6P4B00X6Zv8U2oKC0I2R09emxtqq"
|
|
|
],
|
|
|
+ url: "",
|
|
|
verifyPay: false
|
|
|
};
|
|
|
if (url) {
|
|
|
- data['url'] = url;
|
|
|
+ data.url = url;
|
|
|
}
|
|
|
+ const headers = this.getJsonDoneHeaders();
|
|
|
+ headers.Host = 'wxpusher.zjiecode.com';
|
|
|
+ headers['Content-Type'] = 'application/json;charset=UTF-8';
|
|
|
let options = {
|
|
|
url: 'https://wxpusher.zjiecode.com/api/send/message',
|
|
|
+ headers: headers,
|
|
|
body: JSON.stringify(data),
|
|
|
- headers: this.getJsonDoneHeaders(),
|
|
|
};
|
|
|
- this.post(options, async (error, _response, rdata) => {
|
|
|
- if (!error) {
|
|
|
- try {
|
|
|
- let ret = JSON.parse(rdata);
|
|
|
- if (ret.success) {
|
|
|
- console.log(`微信推送成功`);
|
|
|
- } else {
|
|
|
- console.log(`微信推送失败:${rdata}`);
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ this.post(options, callback);
|
|
|
}
|
|
|
|
|
|
getVal(key, defaultValue = "") {
|
|
|
@@ -1094,7 +1085,8 @@ function ToolKit(scriptName, scriptId, options) {
|
|
|
|
|
|
getJsonDoneHeaders() {
|
|
|
return this.getBaseDoneHeaders({
|
|
|
- 'Content-Type': 'text/json; charset=utf-8'
|
|
|
+ 'Content-Type': 'text/json; charset=utf-8',
|
|
|
+ 'Connection': 'keep-alive'
|
|
|
})
|
|
|
}
|
|
|
})(scriptName, scriptId, options)
|