|
@@ -318,10 +318,15 @@ class LessonService extends CrudService {
|
|
|
const { termid } = classInfo;
|
|
|
// 班主任信息
|
|
|
let data = await this.getHeadTeacherMsg(classInfo);
|
|
|
+ // 礼仪教师信息
|
|
|
+ const lydata = await this.getLyTeacherMsg(classInfo);
|
|
|
// 整理信息
|
|
|
data = { ...data, ...defaults, termid, classid, planyearid, planid };
|
|
|
const dirIsBefore = moment().isBefore(classInfo.startdate);
|
|
|
- if (dirIsBefore) { noticeList.push(data); }
|
|
|
+ if (dirIsBefore) {
|
|
|
+ noticeList.push(data);
|
|
|
+ if (lydata) noticeList.push(lydata);
|
|
|
+ }
|
|
|
const { lessons } = l;
|
|
|
let have_teacherLesson = lessons.filter(f => f.teaid);
|
|
|
have_teacherLesson = JSON.parse(JSON.stringify(have_teacherLesson));
|
|
@@ -383,7 +388,7 @@ class LessonService extends CrudService {
|
|
|
const { openid, email } = await this.getSendInfo(headteacherid);
|
|
|
return { openid, email, notifiedid: headteacherid, username: headteacher, content: msg, ncontent: `${term}期-${batch}批-${name.includes('班') ? name : `${name}班`}课表确认` };
|
|
|
}
|
|
|
-
|
|
|
+ // 给教师发送信息
|
|
|
async getTeacherMsg(classInfo, lessonInfo) {
|
|
|
if (!classInfo || !lessonInfo) return;
|
|
|
const { term, batch, name, headteacherid } = classInfo;
|
|
@@ -412,6 +417,26 @@ class LessonService extends CrudService {
|
|
|
return { openid, email, notifiedid: _.get(lessonInfo, 'teaid'), username: _.get(lessonInfo, 'teaname'), content: msg, ncontent: `${term}期-${batch}批-${name.includes('班') ? name : `${name}班`}课表确认` };
|
|
|
}
|
|
|
|
|
|
+ // 给礼仪教师发送信息
|
|
|
+ async getLyTeacherMsg(classInfo) {
|
|
|
+ const { term, batch, name, headteacherid, lyteacherid, lyteacher } = classInfo;
|
|
|
+ if (headteacherid === lyteacherid) return;
|
|
|
+ let msg = `${lyteacher}您好,中心为您安排了\n ${term}期-${name.includes('班') ? name : `${name}班`}的礼仪课`;
|
|
|
+ if (_.get(classInfo, 'jslocationid'))msg = `${msg} \n 上课教室地点为:${_.get(classInfo, 'jslocation')}`;
|
|
|
+ if (_.get(classInfo, 'headteacherid')) {
|
|
|
+ msg = `${msg} \n 班主任为: \n ${_.get(classInfo, 'headteacher')}`;
|
|
|
+ if (headteacherid) {
|
|
|
+ const r = await this.umodel.findOne({ uid: headteacherid });
|
|
|
+ if (r) {
|
|
|
+ const { mobile } = r;
|
|
|
+ if (mobile) msg = `${msg} 电话:${mobile}`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const { openid, email } = await this.getSendInfo(lyteacherid);
|
|
|
+ return { openid, email, notifiedid: lyteacherid, username: lyteacher, content: msg, ncontent: `${term}期-${batch}批-${name.includes('班') ? name : `${name}班`}课表确认` };
|
|
|
+ }
|
|
|
+
|
|
|
// 查找openid和emaiil
|
|
|
async getSendInfo(uid) {
|
|
|
const user = await this.umodel.findOne({ uid });
|
|
@@ -466,7 +491,6 @@ class LessonService extends CrudService {
|
|
|
|
|
|
// 邮件
|
|
|
if (email) {
|
|
|
-
|
|
|
const subject = '吉林省高等学校毕业生就业指导中心通知';
|
|
|
await this.ctx.service.util.sendMail(email, subject, content);
|
|
|
}
|