소스 검색

增加email发送审核信息

liuyu 5 년 전
부모
커밋
20f78cd010
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      app/service/teacher.js

+ 7 - 1
app/service/teacher.js

@@ -46,7 +46,13 @@ class TeacherService extends CrudService {
       const moment = require('moment');
       let date = new Date();
       date = moment(date).format('YYYY-MM-DD HH:mm:ss');
-      await this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, teacher.openid, '您有一个新的通知', detail, date, remark);
+      const user = await this.umodel.findOne({ uid: teacher.id, type: '3' });
+      if (user && user.openid) {
+        await this.ctx.service.weixin.sendTemplateMsg(this.ctx.app.config.REVIEW_TEMPLATE_ID, teacher.openid, '您有一个新的通知', detail, date, remark);
+      } else {
+        await this.ctx.service.util.sendMail(teacher.email, '账号审核', detail, '');
+      }
+
     }
   }