|
@@ -16,6 +16,7 @@ class ApplyService extends CrudService {
|
|
|
this.tmodel = this.ctx.model.Teacher;
|
|
|
this.submodel = this.ctx.model.Subject;
|
|
|
this.trainmodel = this.ctx.model.Trainplan;
|
|
|
+ this.umodel = this.ctx.model.User;
|
|
|
this.dayList = [ '日', '一', '二', '三', '四', '五', '六' ];
|
|
|
}
|
|
|
|
|
@@ -268,12 +269,17 @@ class ApplyService extends CrudService {
|
|
|
teaids = _.uniq(teaids);
|
|
|
// 找到教师信息
|
|
|
let teaList = await this.tmodel.find({ _id: teaids });
|
|
|
+ // 找到教师用户信息
|
|
|
+ let teauserList = await this.umodel.find({ uid: teaids });
|
|
|
if (teaList) teaList = JSON.parse(JSON.stringify(teaList));
|
|
|
+ if (teauserList)teauserList = JSON.parse(JSON.stringify(teauserList));
|
|
|
// 发送,此处是根据安排,给教师发.还有一种方案是根据教师,整理安排一起发送
|
|
|
for (const l of arr) {
|
|
|
// 教师id,期数,班级名,上课的日期,课程名
|
|
|
const { teaid, term, name, day, subname } = l;
|
|
|
const tea = teaList.find(f => f._id === teaid);
|
|
|
+ const teauser = teauserList.find(f => f.uid === teaid);
|
|
|
+ console.log(teauser);
|
|
|
// 文案
|
|
|
const msg = `${_.get(tea, 'name', '')}老师您好:
|
|
|
吉林省高等学校毕业生就业指导中心-双困生培训系统提醒您:
|
|
@@ -281,11 +287,14 @@ class ApplyService extends CrudService {
|
|
|
${day}(星期${this.dayList[moment(day).days()]})
|
|
|
有您的课程安排:${subname}`;
|
|
|
// 邮箱与微信都发送
|
|
|
- const { openid, email } = tea;
|
|
|
+ const { email } = tea;
|
|
|
if (email) {
|
|
|
- this.toSendEmail('402788946@qq.com', msg, tea.name);
|
|
|
+ // this.toSendEmail(email, msg, tea.name);
|
|
|
+ }
|
|
|
+ const { openid } = teauser;
|
|
|
+ if (openid) {
|
|
|
+ this.toSendWxMsg('ocPqjswkUejZHq2ANriNrFFC7A3I', msg, tea.name);
|
|
|
}
|
|
|
- if (openid) this.toSendWxMsg('ocPqjswkUejZHq2ANriNrFFC7A3I', msg, tea.name);
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
@@ -299,7 +308,7 @@ class ApplyService extends CrudService {
|
|
|
console.error(`计划教师发送通知:${teaname}没有email`);
|
|
|
return;
|
|
|
}
|
|
|
- const subject = '吉林省高等学校毕业生就业指导中心通知(测试)'; //
|
|
|
+ const subject = '吉林省高等学校毕业生就业指导中心通知(系统邮件,请勿回复)'; //
|
|
|
this.ctx.service.util.sendMail(email, subject, content);
|
|
|
}
|
|
|
/**
|
|
@@ -315,15 +324,14 @@ class ApplyService extends CrudService {
|
|
|
}
|
|
|
// TODO or notTODO 发送微信推送记录
|
|
|
// const tourl = this.ctx.app.config.baseUrl + '/msgconfirm/?userid=' + teacherUser.uid + '¬iceid=' + nresid;
|
|
|
+ console.log('in function:');
|
|
|
await this.ctx.service.weixin.sendTemplateDesign(
|
|
|
this.ctx.app.config.REVIEW_TEMPLATE_ID,
|
|
|
openid,
|
|
|
- // '您有一个新的通知',
|
|
|
- '测试信息推送',
|
|
|
+ '您有一个新的通知',
|
|
|
'您有新的安排',
|
|
|
content,
|
|
|
'感谢您的使用'
|
|
|
- // tourl
|
|
|
);
|
|
|
}
|
|
|
}
|