|
@@ -48,8 +48,9 @@ class LeaveService extends CrudService {
|
|
|
if (status) {
|
|
|
const student = await this.smodel.findById(studentid);
|
|
|
const remark = '感谢您的使用';
|
|
|
+ const stuuser = await this.umodel.findOne({ uid: studentid });
|
|
|
if (status === '1') {
|
|
|
- const detail = student.name + '的请假申请已通过,请及时查收!';
|
|
|
+ let detail = student.name + '的请假申请已通过,请及时查收!';
|
|
|
const users = await this.umodel.find({ type: '0' });
|
|
|
for (const user of users) {
|
|
|
const openid = user.openid;
|
|
@@ -62,10 +63,13 @@ class LeaveService extends CrudService {
|
|
|
const openid = headuser.openid;
|
|
|
const date = await this.ctx.service.util.updatedate();
|
|
|
await this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', detail, date, remark);
|
|
|
+ const stuopenid = stuuser.openid;
|
|
|
+ detail = '您的请假申请已通过,请及时查收!';
|
|
|
+ await this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, stuopenid, '您有一个新的通知', detail, date, remark);
|
|
|
+
|
|
|
}
|
|
|
if (status === '2') {
|
|
|
const detail = '您的请假申请已被拒绝,拒绝原因为:' + refcause;
|
|
|
- const stuuser = await this.umodel.findOne({ uid: studentid });
|
|
|
const openid = stuuser.openid;
|
|
|
const date = await this.ctx.service.util.updatedate();
|
|
|
await this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', detail, date, remark);
|