Commit 1d732172 authored by 任国军's avatar 任国军

add transferCustomerService

parent a65870ba
Pipeline #22607 passed with stage
in 12 seconds
......@@ -39,29 +39,23 @@ class WechatService extends Service {
}
ctx.logger.info(data.MsgType);
let flag = true;
if (data.MsgType === 'miniprogrampage') {
ctx.logger.info('------------miniprogrampage---------');
await this.sendImage(data);
} else if (data.MsgType === 'text') {
ctx.logger.info('------------sendText------');
await this.sendText(data);
flag = await this.sendText(data);
}
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',
if (!flag) {
return {
MsgType: 'transfer_customer_service',
ToUserName: data.FromUserName,
FromUserName: data.ToUserName,
CreateTime: parseInt(new Date() / 1000),
};
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;
}
......@@ -69,8 +63,7 @@ class WechatService extends Service {
const { ctx } = this;
if (ctx.isEmpty(data) || ctx.isEmpty(data.Content) || !data.Content.includes('在线课程编号:')) {
await this.transferCustomerService(data);
return;
return false;
}
const id = data.Content.replace('在线课程编号:', '');
const classInfo = await ctx.classModel.V5.CourseOnlineClass.findOne({ where: { id } });
......
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