|
@@ -140,25 +140,27 @@ module.exports = app => {
|
|
|
|
|
|
async testwx(ctx) {
|
|
|
try {
|
|
|
- // 绑定成功通知
|
|
|
- const templateId = 'ElT988uf7EV8ROPKSAX7z7tN9ZxZCDMaXK5ouc9N49E';
|
|
|
+ const sessionUser = ctx.session.sessionUser;
|
|
|
+ // 获取账号数据
|
|
|
+ const accountData = await ctx.service.projectAccount.getDataByCondition({ id: sessionUser.accountId });
|
|
|
+ // 解绑成功通知
|
|
|
+ const templateId = 'gsYUIt5CFY1uJQhiqnkhu38yi0adkZtEH9fGI49g_Lk';
|
|
|
const url = '';
|
|
|
- const topColor = '#FFFFFF';
|
|
|
const msgData = {
|
|
|
first: {
|
|
|
- value: '微信绑定成功',
|
|
|
+ value: '你已成功与纵横云计量帐号解除绑定',
|
|
|
},
|
|
|
keyword1: {
|
|
|
- value: 'hello world',
|
|
|
+ value: sessionUser.account,
|
|
|
},
|
|
|
keyword2: {
|
|
|
- value: 'hello world 绑定成功',
|
|
|
+ value: '项目编号' + ctx.session.sessionProject.code + ' 账号' + sessionUser.account + ' 解绑成功',
|
|
|
},
|
|
|
remark: {
|
|
|
value: '欢迎使用纵横云计量,我们竭诚为您服务。',
|
|
|
},
|
|
|
};
|
|
|
- await app.wechat.api.sendTemplate(ctx.session.wechatToken.openid, templateId, url, topColor, msgData);
|
|
|
+ await app.wechat.api.sendTemplate(accountData.wx_openid, templateId, url, '', msgData);
|
|
|
ctx.body = 'success';
|
|
|
} catch (error) {
|
|
|
console.log(error);
|