feat():learning后台管理项目初始化
This commit is contained in:
28
internal/models/balance_operation_log.go
Normal file
28
internal/models/balance_operation_log.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// 操作类型常量
|
||||
const (
|
||||
OperationTypeAdd = "add"
|
||||
OperationTypeDeduct = "deduct"
|
||||
)
|
||||
|
||||
// BalanceOperationLog 余额操作日志
|
||||
type BalanceOperationLog struct {
|
||||
ID uint `json:"id" gorm:"primaryKey;autoIncrement;comment:主键ID"`
|
||||
UserID int `json:"user_id" gorm:"not null;index:idx_user_id;comment:GoalfyMax用户ID"`
|
||||
OperationType string `json:"operation_type" gorm:"type:varchar(10);not null;comment:操作类型:add/deduct"`
|
||||
Amount float64 `json:"amount" gorm:"type:decimal(15,2);not null;comment:操作金额(美元)"`
|
||||
BalanceBefore float64 `json:"balance_before" gorm:"type:decimal(15,2);not null;comment:操作前余额(美元)"`
|
||||
BalanceAfter float64 `json:"balance_after" gorm:"type:decimal(15,2);not null;comment:操作后余额(美元)"`
|
||||
OperatorID int `json:"operator_id" gorm:"not null;index:idx_operator_id;comment:操作者ID"`
|
||||
OperatorName string `json:"operator_name" gorm:"type:varchar(50);comment:操作者名称"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"not null;index:idx_created_at;comment:创建时间"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"not null;comment:更新时间"`
|
||||
}
|
||||
|
||||
func (BalanceOperationLog) TableName() string {
|
||||
return "balance_operation_logs"
|
||||
}
|
||||
Reference in New Issue
Block a user