12345678910111213141516171819202122232425262728293031323334 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- // 消费记录
- const moneylog = {
- user_id: { type: String, required: false, zh: '用户id' }, //
- user_name: { type: String, required: false, zh: '用户名称' }, //
- money_no: { type: String, required: false, zh: '订单号' }, //
- type: { type: String, required: false, zh: '交易类型' }, //
- create_time: { type: String, required: false, zh: '交易时间' }, //
- money: { type: String, required: false, zh: '交易金额' }, //
- remark: { type: String, required: false, zh: '备注' }, //
- pay_url: { type: Array, required: false, zh: '支付账单明细截图' }, //
- pay_no: { type: Number, required: false, zh: '转账单号/订单号' }, //
- };
- const schema = new Schema(moneylog, { toJSON: { getters: true, virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.index({ user_id: 1 });
- schema.index({ user_name: 1 });
- schema.index({ money_no: 1 });
- schema.index({ type: 1 });
- schema.index({ create_time: 1 });
- schema.index({ money: 1 });
- schema.index({ pay_no: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Moneylog', schema, 'moneylog');
- };
|