Files
goalfylearning-admin/internal/models/balance_operation_log.go

29 lines
1.4 KiB
Go

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"
}