|
@@ -194,6 +194,33 @@ class LessonService extends CrudService {
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ async teaclass({ planid, teaid }) {
|
|
|
+
|
|
|
+
|
|
|
+ const plan = await this.tmodel.findById(planid);
|
|
|
+ if (!plan) {
|
|
|
+ throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '全年计划信息不存在');
|
|
|
+ }
|
|
|
+ const terms = await plan.termnum;
|
|
|
+
|
|
|
+ const data = [];
|
|
|
+ for (const term of terms) {
|
|
|
+
|
|
|
+ const lessons = await this.model.find({
|
|
|
+ termid: term.id,
|
|
|
+ 'lessons.teaid': teaid,
|
|
|
+ });
|
|
|
+ for (const elm of lessons) {
|
|
|
+ if (elm.classid) {
|
|
|
+ const cla = await this.ctx.service.class.fetch(elm.classid);
|
|
|
+ data.push(cla);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
async uplessones(data) {
|
|
|
for (const _data of data) {
|
|
|
await this.model.findByIdAndUpdate(_data.id, _data);
|