lrf402788946 4 년 전
부모
커밋
98553c5e4e
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      app/service/leave.js

+ 5 - 5
app/service/leave.js

@@ -27,7 +27,7 @@ class LeaveService extends CrudService {
     const user = await this.umodel.findOne({ uid: _id, type: '2' });
     const entity = await this.model.create(newdata);
     if (user) {
-      const openid = 'ocPqjswkUejZHq2ANriNrFFC7A3I'; // user.openid
+      const openid = user.openid;
       const date = await this.ctx.service.util.updatedate();
       const detail = student.name + '发起了请假请求(点击消息审核请假)';
       const remark = '感谢您的使用';
@@ -83,7 +83,7 @@ class LeaveService extends CrudService {
         for (const user of users) {
           const openid = user.openid;
           const date = await this.ctx.service.util.updatedate();
-          this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, 'ocPqjswkUejZHq2ANriNrFFC7A3I', '您有一个新的通知', toOtherMsg, date, remark);
+          this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', toOtherMsg, date, remark);
         }
         const _class = await this.cmodel.findById(student.classid);
         // 通知班主任学生请假通过
@@ -96,9 +96,9 @@ class LeaveService extends CrudService {
           if (leave.type === '1') {
             const to_uri = `${this.app.config.baseUrl}/msgconfirm/leave/confirm?id=${leave.id}`;
             const remark = '点击消息确认学生是否已经退出';
-            this.ctx.service.weixin.sendTemplateDesign(this.ctx.app.config.REVIEW_TEMPLATE_ID, 'ocPqjswkUejZHq2ANriNrFFC7A3I', '您有一个新的通知', toOtherMsg, date, remark, to_uri);
+            this.ctx.service.weixin.sendTemplateDesign(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', toOtherMsg, date, remark, to_uri);
           } else {
-            this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, 'ocPqjswkUejZHq2ANriNrFFC7A3I', '您有一个新的通知', toOtherMsg, date, remark);
+            this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', toOtherMsg, date, remark);
           }
         }
         const leadstu = await this.smodel.findOne({ classid: student.classid, job: '班长' });
@@ -107,7 +107,7 @@ class LeaveService extends CrudService {
           if (leaduser) {
             const openid = leaduser.openid;
             const date = await this.ctx.service.util.updatedate();
-            this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, 'ocPqjswkUejZHq2ANriNrFFC7A3I', '您有一个新的通知', toOtherMsg, date, remark);
+            this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, openid, '您有一个新的通知', toOtherMsg, date, remark);
           }
         }
         const stuopenid = stuuser.openid;