cash.js 892 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. // 提现表
  6. const cash = {
  7. account: { type: String }, // 账户
  8. name: { type: String, required: true }, // 用户名
  9. mobile: { type: String, required: true }, // 手机号
  10. b_point: { type: Number }, // 提现前积分
  11. i_point: { type: Number }, // 本次提现积分
  12. e_point: { type: Number }, // 剩余积分
  13. remark: { type: String, maxLength: 200 },
  14. create_time: {
  15. type: String,
  16. default: moment().format('YYYY-MM-DD HH:mm:ss'),
  17. },
  18. };
  19. const schema = new Schema(cash, { toJSON: { virtuals: true } });
  20. schema.index({ id: 1 });
  21. schema.index({ 'meta.createdAt': 1 });
  22. schema.plugin(metaPlugin);
  23. module.exports = app => {
  24. const { mongoose } = app;
  25. return mongoose.model('Cash', schema, 'cash');
  26. };