Commit 448050a8 authored by Aria's avatar Aria

add wx_sendText

parent 63d4a464
Pipeline #19697 passed with stage
in 2 seconds
...@@ -53,6 +53,7 @@ class WechatService extends Service { ...@@ -53,6 +53,7 @@ class WechatService extends Service {
} }
const id = data.Content.replace('在线课程编号:', ''); const id = data.Content.replace('在线课程编号:', '');
const classInfo = await ctx.classModel.V4.CourseOnlineClass.findOne({ where: { id } }); const classInfo = await ctx.classModel.V4.CourseOnlineClass.findOne({ where: { id } });
ctx.logger.info('course_v4: ' + JSON.stringify(classInfo));
const content = ctx.isEmpty(classInfo) || ctx.isEmpty(classInfo.channel) ? '' : classInfo.channel; const content = ctx.isEmpty(classInfo) || ctx.isEmpty(classInfo.channel) ? '' : classInfo.channel;
const token = await this.getAccessToken(); const token = await this.getAccessToken();
const url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' + token; const url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' + token;
...@@ -62,7 +63,7 @@ class WechatService extends Service { ...@@ -62,7 +63,7 @@ class WechatService extends Service {
msgtype: 'text', msgtype: 'text',
text: { content }, text: { content },
}; };
ctx.logger.info('course_wechat_v4_param: ' + JSON.stringify(params));
const resp = await ctx.helper.send_request(url, params, { method: 'POST' }); const resp = await ctx.helper.send_request(url, params, { method: 'POST' });
ctx.logger.info('course_wechat_v4_resp: ' + JSON.stringify(resp)); ctx.logger.info('course_wechat_v4_resp: ' + JSON.stringify(resp));
return; return;
......
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