1234567891011121314151617181920212223 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 充值表
- const credit = {
- vip_id: { type: ObjectId }, // 会员id
- order_no: { type: String }, // 支付订单号
- money: { type: Number }, // 充值金额
- status: { type: String, default: '0' }, // 状态
- remark: { type: String },
- };
- const schema = new Schema(credit, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ vip_id: 1 });
- schema.index({ order_no: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Credit', schema, 'credit');
- };
|