复制项目

This commit is contained in:
kim.dev.6789
2026-01-14 22:16:44 +08:00
parent e2577b8cee
commit e50142a3b9
691 changed files with 97009 additions and 1 deletions

View File

@@ -0,0 +1,56 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package model
import (
"time"
)
const (
WalletTableName = "wallets"
WalletBalanceRecordTableName = "wallet_balance_records"
)
// Wallet 用户钱包表
type Wallet struct {
UserID string `bson:"user_id"` // 用户ID唯一
Balance int64 `bson:"balance"` // 余额(分)
Version int64 `bson:"version"` // 版本号(用于乐观锁,防止并发覆盖)
CreateTime time.Time `bson:"create_time"` // 创建时间
UpdateTime time.Time `bson:"update_time"` // 更新时间
Ex string `bson:"ex"` // 扩展字段
}
type WalletBalanceRecord struct {
ID string `bson:"_id"` // 记录ID
UserID string `bson:"user_id"` // 用户ID
Amount int64 `bson:"amount"` // 变动金额(单位:分,正数表示增加,负数表示减少)
Type int32 `bson:"type"` // 变动类型1-充值2-提现/提款3-消费4-退款5-奖励6-后台充值7-发红包8-抢红包99-其他
BeforeBalance int64 `bson:"before_balance"` // 变动前余额(单位:分)
AfterBalance int64 `bson:"after_balance"` // 变动后余额(单位:分)
OrderID string `bson:"order_id"` // 关联订单ID可选
TransactionID string `bson:"transaction_id"` // 交易ID可选
RedPacketID string `bson:"red_packet_id"` // 红包ID用于发红包和抢红包记录关联可选
Remark string `bson:"remark"` // 备注
CreateTime time.Time `bson:"create_time"` // 创建时间
}
func (*Wallet) TableName() string {
return WalletTableName
}
func (*WalletBalanceRecord) TableName() string {
return WalletBalanceRecordTableName
}