feat: 增加充值功能

This commit is contained in:
archer
2023-03-21 23:14:28 +08:00
parent 129f3a2a30
commit d065539707
24 changed files with 389 additions and 35 deletions

23
src/service/models/pay.ts Normal file
View File

@@ -0,0 +1,23 @@
import { Schema, model, models } from 'mongoose';
const PaySchema = new Schema({
userId: {
type: Schema.Types.ObjectId,
ref: 'user',
required: true
},
time: {
type: Number,
default: () => Date.now()
},
price: {
type: Number,
required: true
},
orderId: {
type: String,
required: true
}
});
export const Pay = models['pay'] || model('pay', PaySchema);

View File

@@ -16,7 +16,7 @@ const UserSchema = new Schema({
},
balance: {
type: Number,
default: 0
default: 0.5
},
accounts: [
{