12345678910111213141516171819202122 |
- 'use strict';
- const assert = require('assert');
- const _ = require('lodash');
- const moment = require('moment');
- const { ObjectId } = require('mongoose').Types;
- const { CrudService } = require('naf-framework-mongoose/lib/service');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- class LunboService extends CrudService {
- constructor(ctx) {
- super(ctx, 'lunbo');
- this.model = this.ctx.model.Lunbo;
- }
- async index(data) {
- const create_time = moment().format('YYYY-MM-DD');
- const res = await this.model.create({ ...data, create_time });
- return res;
- }
- }
- module.exports = LunboService;
|