cash.js 966 B

12345678910111213141516171819202122232425
  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, required: true }, // 账户
  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 }, // 剩余积分, 计算公式:b_p - (i_p+ _.ceil(i_p*0.06)) 收取6%手续费, 不足1积分按1积分计算
  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.plugin(metaPlugin);
  22. module.exports = app => {
  23. const { mongoose } = app;
  24. return mongoose.model('Cash', schema, 'cash');
  25. };