Refactor order and tenant ledger models to use consts for Currency and Type fields; add new UserStatus values; implement comprehensive test cases for content, creator, order, super, and wallet services.
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"quyun/v2/pkg/consts"
|
||||
|
||||
"go.ipao.vip/gen"
|
||||
)
|
||||
|
||||
@@ -15,23 +17,23 @@ const TableNameTenantLedger = "tenant_ledgers"
|
||||
|
||||
// TenantLedger mapped from table <tenant_ledgers>
|
||||
type TenantLedger struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
|
||||
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
|
||||
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
|
||||
OrderID int64 `gorm:"column:order_id;type:bigint" json:"order_id"`
|
||||
Type string `gorm:"column:type;type:character varying(32);not null" json:"type"`
|
||||
Amount int64 `gorm:"column:amount;type:bigint;not null" json:"amount"`
|
||||
BalanceBefore int64 `gorm:"column:balance_before;type:bigint;not null" json:"balance_before"`
|
||||
BalanceAfter int64 `gorm:"column:balance_after;type:bigint;not null" json:"balance_after"`
|
||||
FrozenBefore int64 `gorm:"column:frozen_before;type:bigint;not null" json:"frozen_before"`
|
||||
FrozenAfter int64 `gorm:"column:frozen_after;type:bigint;not null" json:"frozen_after"`
|
||||
IdempotencyKey string `gorm:"column:idempotency_key;type:character varying(128);not null" json:"idempotency_key"`
|
||||
Remark string `gorm:"column:remark;type:character varying(255);not null" json:"remark"`
|
||||
OperatorUserID int64 `gorm:"column:operator_user_id;type:bigint" json:"operator_user_id"`
|
||||
BizRefType string `gorm:"column:biz_ref_type;type:character varying(32)" json:"biz_ref_type"`
|
||||
BizRefID int64 `gorm:"column:biz_ref_id;type:bigint" json:"biz_ref_id"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
|
||||
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
|
||||
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
|
||||
OrderID int64 `gorm:"column:order_id;type:bigint" json:"order_id"`
|
||||
Type consts.TenantLedgerType `gorm:"column:type;type:character varying(32);not null" json:"type"`
|
||||
Amount int64 `gorm:"column:amount;type:bigint;not null" json:"amount"`
|
||||
BalanceBefore int64 `gorm:"column:balance_before;type:bigint;not null" json:"balance_before"`
|
||||
BalanceAfter int64 `gorm:"column:balance_after;type:bigint;not null" json:"balance_after"`
|
||||
FrozenBefore int64 `gorm:"column:frozen_before;type:bigint;not null" json:"frozen_before"`
|
||||
FrozenAfter int64 `gorm:"column:frozen_after;type:bigint;not null" json:"frozen_after"`
|
||||
IdempotencyKey string `gorm:"column:idempotency_key;type:character varying(128);not null" json:"idempotency_key"`
|
||||
Remark string `gorm:"column:remark;type:character varying(255);not null" json:"remark"`
|
||||
OperatorUserID int64 `gorm:"column:operator_user_id;type:bigint" json:"operator_user_id"`
|
||||
BizRefType string `gorm:"column:biz_ref_type;type:character varying(32)" json:"biz_ref_type"`
|
||||
BizRefID int64 `gorm:"column:biz_ref_id;type:bigint" json:"biz_ref_id"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
|
||||
}
|
||||
|
||||
// Quick operations without importing query package
|
||||
|
||||
Reference in New Issue
Block a user