123456789101112131415161718192021222324252627282930313233343536373839 |
- 'use strict';
- const { CrudService } = require('naf-framework-mongoose/lib/service');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- const _ = require('lodash');
- const assert = require('assert');
- // 审核记录
- class Achieve_verify_recordService extends CrudService {
- constructor(ctx) {
- super(ctx, 'achieve_verify_record');
- this.model = this.ctx.model.AchieveVerifyRecord;
- this.apply = this.ctx.model.AchieveApply;
- this.expert = this.ctx.model.AchieveExpert;
- }
- /**
- * 添加审核记录
- * @param {Object} data 审核数据
- */
- async create(data) {
- const { status, apply_id } = data;
- const res = await this.apply.updateOne({ _id: apply_id }, { status });
- if (res.ok && _.isNumber(res.ok) && res.ok > 0) {
- const record = await this.model.create(data);
- // 21-03-22 先不需要了:status=2时(评分已过,需要缴费),需要将该apply_id下的临时专家全部修改成GG状态(status=1)
- // if (status === '2') {
- // await this.expert.updateMany({ apply_id }, { status: '1' });
- // }
- // if (status === '3') {
- // await this.expert.updateMany({ apply_id }, { status: '1' });
- // }
- return record;
- }
- throw new BusinessError(ErrorCode.SERVICE_FAULT, '审核失败');
- }
- }
- module.exports = Achieve_verify_recordService;
|