|
@@ -6,24 +6,24 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
const payOrder = {
|
|
const payOrder = {
|
|
openid: { type: String, required: false, zh: '微信id' }, // 其实和user_id有些重复,但是这里一定要留痕,因为有可能发生更换绑定
|
|
openid: { type: String, required: false, zh: '微信id' }, // 其实和user_id有些重复,但是这里一定要留痕,因为有可能发生更换绑定
|
|
school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
|
|
school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
|
|
- user_id: { type: String, required: false, zh: '用户id' }, // 不是角色的数据id,是普通用户的那个id,因为付款需要确定openid,和你是什么角色没关系
|
|
|
|
|
|
+ payer_id: { type: String, required: false, zh: '支付的用户id', refPath: 'payer_role' }, // 由payer_role决定是教练还是学员
|
|
|
|
+ payer_role: { type: String, required: false, zh: '支付的用户角色' }, //
|
|
pay_for: { type: String, required: false, zh: '支付原因' }, // lesson:上课,写表名等...
|
|
pay_for: { type: String, required: false, zh: '支付原因' }, // lesson:上课,写表名等...
|
|
from_id: { type: String, required: false, zh: '关联id' }, // 支付原因的数据id.有就写,没有不写
|
|
from_id: { type: String, required: false, zh: '关联id' }, // 支付原因的数据id.有就写,没有不写
|
|
money: { type: Number, required: false, zh: '金额' }, //
|
|
money: { type: Number, required: false, zh: '金额' }, //
|
|
time: { type: String, required: false, zh: '时间' }, //
|
|
time: { type: String, required: false, zh: '时间' }, //
|
|
order_no: { type: String, required: false, zh: '订单号' }, //
|
|
order_no: { type: String, required: false, zh: '订单号' }, //
|
|
desc: { type: String, required: false, zh: '支付说明' }, //
|
|
desc: { type: String, required: false, zh: '支付说明' }, //
|
|
- status: { type: String, required: false, default: '0', zh: '支付状态' }, // 0:未支付;1:已支付;-1:支付失败-2:已退款
|
|
|
|
|
|
+ status: { type: String, required: false, default: '0', zh: '支付状态' }, // 0:未支付;1:已支付;-1:支付失败;-2:已退款
|
|
|
|
+ config: { type: Object, zh: '设置' },
|
|
};
|
|
};
|
|
const schema = new Schema(payOrder, { toJSON: { virtuals: true } });
|
|
const schema = new Schema(payOrder, { toJSON: { virtuals: true } });
|
|
schema.index({ id: 1 });
|
|
schema.index({ id: 1 });
|
|
schema.index({ 'meta.createdAt': 1 });
|
|
schema.index({ 'meta.createdAt': 1 });
|
|
schema.index({ openid: 1 });
|
|
schema.index({ openid: 1 });
|
|
schema.index({ school_id: 1 });
|
|
schema.index({ school_id: 1 });
|
|
-schema.index({ user_id: 1 });
|
|
|
|
-schema.index({ order_no: 1 });
|
|
|
|
-schema.index({ time: 1 });
|
|
|
|
-schema.index({ status: 1 });
|
|
|
|
|
|
+schema.index({ payer_id: 1 });
|
|
|
|
+schema.index({ from_id: 1 });
|
|
|
|
|
|
schema.plugin(metaPlugin);
|
|
schema.plugin(metaPlugin);
|
|
module.exports = app => {
|
|
module.exports = app => {
|