12345678910111213141516171819202122232425 |
- '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 StudentApplyForSchoolService extends CrudService {
- constructor(ctx) {
- super(ctx, 'studentapplyforschool');
- this.model = this.ctx.model.Relation.StudentApplyForSchool;
- this.rssModel = this.ctx.model.Relation.RelationStudentSchool;
- }
- async afterUpdate(filter, body, data) {
- const { result, student_id, school_id } = data;
- if (result !== '1') return data;
- // 审核通过,建立关系
- const obj = { school_id, student_id };
- await this.rssModel.create(obj);
- return data;
- }
- }
- module.exports = StudentApplyForSchoolService;
|