113 lines
4.1 KiB
Go
113 lines
4.1 KiB
Go
package dto
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
// GetWalletByUserIdReq 根据用户ID获取钱包请求
|
|
type GetWalletByUserIdReq struct {
|
|
g.Meta `path:"/getWallet" method:"get" tags:"钱包管理" summary:"获取钱包" dc:"根据用户ID获取钱包信息"`
|
|
|
|
UserId int64 `json:"userId" v:"required|min:1" dc:"用户ID"`
|
|
}
|
|
|
|
// GetWalletByUserIdResp 根据用户ID获取钱包响应
|
|
type GetWalletByUserIdResp struct {
|
|
Data WalletInfo `json:"data"`
|
|
}
|
|
|
|
// WalletInfo 钱包信息
|
|
type WalletInfo struct {
|
|
ID int64 `json:"id" dc:"钱包ID"`
|
|
UserID int64 `json:"userId" dc:"用户ID"`
|
|
Balance int64 `json:"balance" dc:"余额(分)"`
|
|
Currency string `json:"currency" dc:"货币类型"`
|
|
Status int `json:"status" dc:"状态"`
|
|
}
|
|
|
|
// CreateWalletReq 创建钱包请求
|
|
type CreateWalletReq struct {
|
|
g.Meta `path:"/createWallet" method:"post" tags:"钱包管理" summary:"创建钱包" dc:"为用户创建钱包"`
|
|
|
|
UserId int64 `json:"userId" v:"required|min:1" dc:"用户ID"`
|
|
Currency string `json:"currency" v:"required" dc:"货币类型"`
|
|
}
|
|
|
|
// CreateWalletResp 创建钱包响应
|
|
type CreateWalletResp struct {
|
|
Data CreateWalletData `json:"data"`
|
|
}
|
|
|
|
// CreateWalletData 创建钱包数据
|
|
type CreateWalletData struct {
|
|
WalletID int64 `json:"walletId" dc:"钱包ID"`
|
|
}
|
|
|
|
// UpdateBalanceReq 更新余额请求
|
|
type UpdateBalanceReq struct {
|
|
g.Meta `path:"/updateBalance" method:"post" tags:"钱包管理" summary:"更新余额" dc:"对钱包余额进行收入/支出/冻结/解冻操作"`
|
|
|
|
WalletID int64 `json:"walletId" v:"required" dc:"钱包ID"`
|
|
Amount int64 `json:"amount" v:"required|min:1" dc:"金额(分)"`
|
|
Type string `json:"type" v:"required|in:income,expense,freeze,unfreeze" dc:"操作类型"`
|
|
OrderNo string `json:"orderNo" dc:"业务订单号"`
|
|
TransactionNo string `json:"transactionNo" dc:"钱包交易流水号"`
|
|
Description string `json:"description" dc:"描述"`
|
|
ExtraData map[string]interface{} `json:"extraData" dc:"额外数据"`
|
|
}
|
|
|
|
// UpdateBalanceResp 更新余额响应
|
|
type UpdateBalanceResp struct {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
// GetWalletLogsReq 获取钱包日志请求
|
|
type GetWalletLogsReq struct {
|
|
g.Meta `path:"/getWalletLogs" method:"get" tags:"钱包管理" summary:"获取钱包日志" dc:"分页获取钱包操作日志"`
|
|
|
|
UserId int64 `json:"userId" v:"required|min:1" dc:"用户ID"`
|
|
Page int `json:"page" v:"required|min:1" dc:"页码"`
|
|
PageSize int `json:"pageSize" v:"required|min:1|max:100" dc:"每页大小"`
|
|
}
|
|
|
|
// GetWalletLogsResp 获取钱包日志响应
|
|
type GetWalletLogsResp struct {
|
|
Data WalletLogData `json:"data"`
|
|
}
|
|
|
|
// WalletLogData 钱包日志数据
|
|
type WalletLogData struct {
|
|
Logs []WalletLogInfo `json:"logs"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
// WalletLogInfo 钱包日志信息
|
|
type WalletLogInfo struct {
|
|
ID int64 `json:"id"`
|
|
OrderNo string `json:"orderNo"`
|
|
TransactionNo string `json:"transactionNo"`
|
|
Type string `json:"type"`
|
|
Amount int64 `json:"amount"`
|
|
BalanceBefore int64 `json:"balanceBefore"`
|
|
BalanceAfter int64 `json:"balanceAfter"`
|
|
Currency string `json:"currency"`
|
|
Description string `json:"description"`
|
|
CreatedAt string `json:"createdAt"`
|
|
}
|
|
|
|
// CreateWalletLogReq 创建钱包日志请求(内部使用)
|
|
type CreateWalletLogReq struct {
|
|
UserID int64 `json:"userId"`
|
|
WalletID int64 `json:"walletId"`
|
|
OrderNo string `json:"orderNo"`
|
|
TransactionNo string `json:"transactionNo"`
|
|
Type string `json:"type"`
|
|
Amount int64 `json:"amount"`
|
|
BalanceBefore int64 `json:"balanceBefore"`
|
|
BalanceAfter int64 `json:"balanceAfter"`
|
|
Currency string `json:"currency"`
|
|
Description string `json:"description"`
|
|
ExtraData map[string]interface{} `json:"extraData"`
|
|
}
|