feat: 邀请注册

This commit is contained in:
archer
2023-04-16 23:26:14 +08:00
parent faf722fa15
commit 03f1ab1a2f
5 changed files with 35 additions and 5 deletions

View File

@@ -3,6 +3,9 @@ import { hashPassword } from '@/service/utils/tools';
import { PRICE_SCALE } from '@/constants/common';
import { UserModelSchema } from '@/types/mongoSchema';
const UserSchema = new Schema({
email: {
type: String
},
username: {
// 可以是手机/邮箱,新的验证都只用手机
type: String,
@@ -17,9 +20,27 @@ const UserSchema = new Schema({
select: false
},
balance: {
// 平台余额,不可提现
type: Number,
default: 0.5 * PRICE_SCALE
},
inviterId: {
// 谁邀请注册的
type: Schema.Types.ObjectId,
ref: 'user'
},
promotion: {
rate: {
// 返现比例
type: Number,
default: 15
},
amount: {
// 推广金额
type: Number,
default: 0
}
},
openaiKey: {
type: String,
default: ''