Commit 0def32cf20f107ea0dcdee98f54936619d32a22c

Authored by vking
1 parent 017b423a

rebot

@@ -149,6 +149,7 @@ function rpc(host = '', act, data = {}, fouce = false, header = {}, silence = tr @@ -149,6 +149,7 @@ function rpc(host = '', act, data = {}, fouce = false, header = {}, silence = tr
149 success: function (res) { 149 success: function (res) {
150 console.log('request.api[' + (new Date() - stime) + 'ms]==>', host + cache_key + ('&formids=' + formids.toString()) + '\nrequest.success', res.data); 150 console.log('request.api[' + (new Date() - stime) + 'ms]==>', host + cache_key + ('&formids=' + formids.toString()) + '\nrequest.success', res.data);
151 // return; 151 // return;
  152 + //bot.msg({url: host + cache_key, res: res.data})
152 if (res.data) { 153 if (res.data) {
153 if (cachetime != 0 && res.data.ret == 200) { 154 if (cachetime != 0 && res.data.ret == 200) {
154 cache(cache_key, res.data, cachetime);//.then().catch(); 155 cache(cache_key, res.data, cachetime);//.then().catch();
1 //https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=9094c8cc-ec7f-4221-b1d9-50e71e008aa9 1 //https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=9094c8cc-ec7f-4221-b1d9-50e71e008aa9
  2 +import util from './util'
2 export default { 3 export default {
3 - msg(message){ 4 + msg(json){
4 wx.request({ 5 wx.request({
5 url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=9094c8cc-ec7f-4221-b1d9-50e71e008aa9', 6 url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=9094c8cc-ec7f-4221-b1d9-50e71e008aa9',
6 method: 'POST', 7 method: 'POST',
7 data: { 8 data: {
8 - msgtype:'text',  
9 - text:{  
10 - content:JSON.stringify(message), 9 + msgtype:'markdown',
  10 + markdown:{
  11 + content:
  12 + "**"+util.unixtoTime(new Date()/1000,'YYYY-MM-DD HH:II:SS')+"**\n"+
  13 + ">"+json.url+"\n\n"+
  14 + (typeof json.res == 'string'?json.res:JSON.stringify(json.res)).substr(0,500)+"\n\n"
11 }, 15 },
12 }, 16 },
13 header: { 17 header: {