|
@@ -54,6 +54,7 @@ class TrainplanService extends CrudService {
|
|
|
}
|
|
|
// 如果培训计划状态改为发布
|
|
|
if (status === '1') {
|
|
|
+ trainplan.status = status;
|
|
|
// 查询所有入库的教师
|
|
|
const teachers = await this.tmodel.find({ status: '4' });
|
|
|
for (const teacher of teachers) {
|
|
@@ -65,7 +66,9 @@ class TrainplanService extends CrudService {
|
|
|
let date = new Date();
|
|
|
date = moment(date).format('YYYY-MM-DD HH:mm:ss');
|
|
|
const remark = '感谢您的使用';
|
|
|
- this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', detail, date, remark);
|
|
|
+ if (openid) {
|
|
|
+ this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', detail, date, remark);
|
|
|
+ }
|
|
|
}
|
|
|
// 查询所有学校用户
|
|
|
const schools = await this.umodel.find({ type: '2' });
|
|
@@ -76,7 +79,9 @@ class TrainplanService extends CrudService {
|
|
|
let date = new Date();
|
|
|
date = moment(date).format('YYYY-MM-DD HH:mm:ss');
|
|
|
const remark = '感谢您的使用';
|
|
|
- this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', detail, date, remark);
|
|
|
+ if (openid) {
|
|
|
+ this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', detail, date, remark);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return await trainplan.save();
|