37 lines
1.4 KiB
Go
37 lines
1.4 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type UserCharge struct {
|
|
Created `xorm:"extends"`
|
|
Seq int64 `xorm:"bigint pk not null autoincr" json:"seq"`
|
|
UserId string `xorm:"varchar(120) not null" json:"userId"`
|
|
Fee decimal.NullDecimal `xorm:"numeric(12,2)" json:"fee"`
|
|
Discount decimal.NullDecimal `xorm:"numeric(5,4)" json:"discount"`
|
|
Amount decimal.NullDecimal `xorm:"numeric(12,2)" json:"amount"`
|
|
ChargeTo time.Time `xorm:"date not null" json:"chargeTo" time_format:"simple_date" time_location:"shanghai"`
|
|
Settled bool `xorm:"bool not null default false" json:"settled"`
|
|
SettledAt *time.Time `xorm:"timestampz" json:"settledAt" time_format:"simple_datetime" time_location:"shanghai"`
|
|
Cancelled bool `xorm:"bool not null default false" json:"cancelled"`
|
|
CancelledAt *time.Time `xorm:"timestampz" json:"cancelledAt" time_format:"simple_datetime" time_location:"shanghai"`
|
|
Refunded bool `xorm:"bool not null default false" json:"refunded"`
|
|
RefundedAt *time.Time `xorm:"timestampz" json:"refundedAt" time_format:"simple_datetime" time_location:"shanghai"`
|
|
}
|
|
|
|
func (UserCharge) TableName() string {
|
|
return "user_charge"
|
|
}
|
|
|
|
type ChargeWithName struct {
|
|
UserDetail `xorm:"extends"`
|
|
UserCharge `xorm:"extends"`
|
|
}
|
|
|
|
func (ChargeWithName) TableName() string {
|
|
return "user_detail"
|
|
}
|