lrf402788946 4 jaren geleden
bovenliggende
commit
a4b2fbc891
1 gewijzigde bestanden met toevoegingen van 6 en 3 verwijderingen
  1. 6 3
      app/service/lesson.js

+ 6 - 3
app/service/lesson.js

@@ -320,7 +320,8 @@ class LessonService extends CrudService {
       let data = await this.getHeadTeacherMsg(classInfo);
       // 整理信息
       data = { ...data, ...defaults, termid, classid, planyearid, planid };
-      noticeList.push(data);
+      const dirIsBefore = moment().isBefore(classInfo.startdate);
+      if (dirIsBefore) { noticeList.push(data); }
       const { lessons } = l;
       let have_teacherLesson = lessons.filter(f => f.teaid);
       have_teacherLesson = JSON.parse(JSON.stringify(have_teacherLesson));
@@ -328,8 +329,9 @@ class LessonService extends CrudService {
       for (const l of have_teacherLesson) {
         // 整理时间 TODO,不需要合并时间了,先留着,之后真不需要就删掉
         const { subid, teaid, date } = l;
+        // 超过日期了就不发了
         const isBefore = moment().isBefore(date);
-        if (!isBefore) false;
+        if (!isBefore) continue;
         if (!subid && teaid) continue;
         const r = newArr.find(f => f.subid === subid && f.teaid === teaid);
         const ri = newArr.findIndex(
@@ -432,7 +434,7 @@ class LessonService extends CrudService {
 
 
   async toSendMsg(noticeList) {
-    // console.log(noticeList);
+    console.log(noticeList);
     for (const notice of noticeList) {
       // 先找信息notice,然后查看有没有这个人的信息,有就发送,没有就添加,再发送
       // 课表通知,1个班的信息放一起,按班级来看
@@ -464,6 +466,7 @@ class LessonService extends CrudService {
 
       // 邮件
       if (email) {
+
         const subject = '吉林省高等学校毕业生就业指导中心通知';
         await this.ctx.service.util.sendMail(email, subject, content);
       }