|
@@ -0,0 +1,27 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
+
|
|
|
+// 充值记录
|
|
|
+const charge = {
|
|
|
+ school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
|
|
|
+ payer_id: { type: String, required: false, zh: '充值用户角色id', refPath: 'payer_role', getProp: [ 'name' ] }, //
|
|
|
+ payer_role: { type: String, required: false, zh: '充值用户角色' }, //
|
|
|
+ money: { type: Number, required: false, zh: '充值金额' }, //
|
|
|
+ pay_id: { type: String, required: false, zh: '支付id', ref: 'Payorder' }, //
|
|
|
+ is_pay: { type: String, required: false, zh: '支付状态' }, // 0:未支付;1:支付成功;-1:支付失败;-3:已退款
|
|
|
+ time: { type: String, required: false, zh: '时间' }, //
|
|
|
+};
|
|
|
+const schema = new Schema(charge, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ id: 1 });
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
+schema.index({ school_id: 1 });
|
|
|
+schema.index({ payer_id: 1 });
|
|
|
+schema.index({ payer_role: 1 });
|
|
|
+schema.index({ is_pay: 1 });
|
|
|
+
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('Charge', schema, 'charge');
|
|
|
+};
|