Commit a65870ba authored by 任国军's avatar 任国军

add transferCustomerService

parent 7ba523c3
Pipeline #22600 passed with stage
in 3 seconds
......@@ -50,17 +50,30 @@ class WechatService extends Service {
return;
}
async transferCustomerService(data) {
const { ctx } = this;
const token = await this.getAccessToken();
const url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' + token;
const params = {
access_token: token,
touser: data.FromUserName,
msgtype: 'transfer_customer_service',
};
ctx.logger.info('course_wechat_v5_param: ' + JSON.stringify(params));
const resp = await ctx.helper.send_request(url, params, { method: 'POST' });
ctx.logger.info('course_wechat_v5_resp: ' + JSON.stringify(resp));
return;
}
async sendText(data) {
const { ctx } = this;
if (ctx.isEmpty(data) || ctx.isEmpty(data.Content) || !data.Content.includes('在线课程编号:')) {
ctx.logger.info(data.Content);
ctx.logger.info(data.Content.includes('在线课程编号:'));
await this.transferCustomerService(data);
return;
}
const id = data.Content.replace('在线课程编号:', '');
const classInfo = await ctx.classModel.V5.CourseOnlineClass.findOne({ where: { id } });
ctx.logger.info('course_v4: ' + JSON.stringify(classInfo));
const content = ctx.isEmpty(classInfo) || ctx.isEmpty(classInfo.channel) ? '' : classInfo.channel;
const token = await this.getAccessToken();
const url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' + token;
......
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