Browse Source

增加email发送审核信息

liuyu 5 năm trước cách đây
mục cha
commit
20f78cd010
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  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, '');
+      }
+
     }
   }