feat: 修改计费模式为tokens

This commit is contained in:
archer
2023-03-25 14:43:32 +08:00
parent 4eaf3a1be0
commit 6bba859060
18 changed files with 97 additions and 38 deletions

View File

@@ -31,6 +31,11 @@ const BillSchema = new Schema({
type: Number,
required: true
},
tokenLen: {
// 折算成 token 的数量
type: Number,
required: true
},
price: {
type: Number,
required: true

View File

@@ -1,5 +1,6 @@
import { Schema, model, models } from 'mongoose';
import { hashPassword } from '@/service/utils/tools';
import { PRICE_SCALE } from '@/utils/user';
const UserSchema = new Schema({
email: {
@@ -16,7 +17,7 @@ const UserSchema = new Schema({
},
balance: {
type: Number,
default: 0.5 * 100000
default: 0.5 * PRICE_SCALE
},
accounts: [
{