12345678910111213141516171819202122232425262728293031323334 |
- 'use strict';
- const { CrudService } = require('naf-framework-mongoose-free/lib/service');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- const _ = require('lodash');
- const assert = require('assert');
- //
- class LessonService extends CrudService {
- constructor(ctx) {
- super(ctx, 'lesson');
- this.model = this.ctx.model.Business.Lesson;
- }
- // TODO:缺少:使用coach_id/student_id查询课程:教练/学生看自己的课程
- // TODO:缺少:修改课程为下课状态,给教师结工资的问题
- /**
- * 处理下课的课程进行结算
- * @param {Object} filter 修改条件
- * @param {Object} body 修改内容
- * @param {Object} data 修改后的结果
- * @return {Object} 返回整理后的内容
- */
- async afterUpdate(filter, body, data) {
- const { _id: lesson_id, type, status } = data;
- if (status !== '4') return data;
- // 公开课,每个教师都带着
- return data;
- }
- }
- module.exports = LessonService;
|