lrf402788946 4 年之前
父節點
當前提交
3ba062d523
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      app/service/apply.js

+ 4 - 2
app/service/apply.js

@@ -332,7 +332,7 @@ class ApplyService extends CrudService {
       msg = `${msg}\n 如果您无法进行授课,请及时联系中心负责人`;
       const { openid } = teauser;
       let tourl;
-      let to_send = true;
+      let to_send = false;
       if (openid) {
         let notice = await this.nmodel.findOne({ planid, termid, classid, type: '6' });
         // 找下是否发过信息
@@ -343,11 +343,12 @@ class ApplyService extends CrudService {
             const has_notice = notified.find(f => f.notifiedid === teaid);
             if (has_notice) {
               const { status } = has_notice;
-              if (status === '1') to_send = false;
+              if (status !== '1') to_send = true;
             } else {
               const obj = { notifiedid: teaid, username: _.get(tea, 'name', ''), content: msg };
               notice.notified.push(obj);
               await notice.save();
+              to_send = true;
             }
           }
         } else {
@@ -355,6 +356,7 @@ class ApplyService extends CrudService {
           const noticeObj = { planyearid, planid, termid, classid, noticeid: 'system', type: '6', content: `${term}期-${name.includes('班') ? name : `${name}班`}教师计划初步信息确认`, notified };
           await this.nmodel.create(noticeObj);
           notice = await this.nmodel.findOne({ planid, termid, classid, type: '6' });
+          to_send = true;
         }
         tourl = this.ctx.app.config.baseUrl + '/msgconfirm/?userid=' + teaid + '&noticeid=' + notice._id;
       }