You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
3.9 KiB
52 lines
3.9 KiB
package model
|
|
|
|
import "time"
|
|
|
|
type SimPackage struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
Code string `gorm:"column:code;type:VARCHAR(64);not null" json:"code"`
|
|
Name string `gorm:"column:name;type:VARCHAR(128);not null" json:"name"`
|
|
Carrier string `gorm:"column:carrier;type:VARCHAR(16);not null" json:"carrier"`
|
|
ProviderRatePlanID int64 `gorm:"column:provider_rate_plan_id;type:BIGINT;not null" json:"-"`
|
|
AmountGb int `gorm:"column:amount_gb;type:INT;not null" json:"amountGb"`
|
|
ValidityMonths int `gorm:"column:validity_months;type:INT;not null" json:"validityMonths"`
|
|
CostFeeFen int64 `gorm:"column:cost_fee_fen;type:BIGINT;not null" json:"-"`
|
|
SaleFeeFen int64 `gorm:"column:sale_fee_fen;type:BIGINT;not null" json:"saleFeeFen"`
|
|
Status string `gorm:"column:status;type:VARCHAR(16);not null;default:active" json:"status"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (SimPackage) TableName() string { return "sim_package" }
|
|
|
|
type SimRechargeOrder struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
UserID int64 `gorm:"column:user_id;type:BIGINT;not null" json:"userId"`
|
|
SimCardID int64 `gorm:"column:sim_card_id;type:BIGINT;not null" json:"simCardId"`
|
|
PackageID int64 `gorm:"column:package_id;type:BIGINT;not null" json:"packageId"`
|
|
PackageCode string `gorm:"column:package_code;type:VARCHAR(64);not null" json:"packageCode"`
|
|
ProviderRatePlanID int64 `gorm:"column:provider_rate_plan_id;type:BIGINT;not null" json:"-"`
|
|
IccidSnapshot string `gorm:"column:iccid_snapshot;type:VARCHAR(32);not null" json:"-"`
|
|
AmountGb int `gorm:"column:amount_gb;type:INT;not null" json:"amountGb"`
|
|
ValidityMonths int `gorm:"column:validity_months;type:INT;not null" json:"validityMonths"`
|
|
TotalFeeFen int64 `gorm:"column:total_fee_fen;type:BIGINT;not null" json:"totalFeeFen"`
|
|
PaymentStatus string `gorm:"column:payment_status;type:VARCHAR(16);not null;default:unpaid" json:"paymentStatus"`
|
|
FulfillmentStatus string `gorm:"column:fulfillment_status;type:VARCHAR(16);not null;default:pending" json:"fulfillmentStatus"`
|
|
FulfillmentLeaseToken string `gorm:"column:fulfillment_lease_token;type:VARCHAR(64)" json:"-"`
|
|
FulfillmentLeaseUntil *time.Time `gorm:"column:fulfillment_lease_until" json:"-"`
|
|
ExternalOrderNo string `gorm:"column:external_order_no;type:VARCHAR(128);not null;uniqueIndex:uk_sim_recharge_external" json:"-"`
|
|
ProviderOrderNo string `gorm:"column:provider_order_no;type:VARCHAR(128)" json:"-"`
|
|
AttemptCount int `gorm:"column:attempt_count;type:INT;not null;default:0" json:"-"`
|
|
NextAttemptAt *time.Time `gorm:"column:next_attempt_at" json:"-"`
|
|
LastErrorCode string `gorm:"column:last_error_code;type:VARCHAR(64)" json:"-"`
|
|
LastErrorMessage string `gorm:"column:last_error_message;type:VARCHAR(256)" json:"-"`
|
|
FulfillmentStartedAt *time.Time `gorm:"column:fulfillment_started_at" json:"-"`
|
|
FulfillmentMessage string `gorm:"column:fulfillment_message;type:VARCHAR(128)" json:"fulfillmentMessage"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
PaidAt *time.Time `gorm:"column:paid_at" json:"paidAt"`
|
|
ClosedAt *time.Time `gorm:"column:closed_at" json:"closedAt"`
|
|
FulfilledAt *time.Time `gorm:"column:fulfilled_at" json:"fulfilledAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (SimRechargeOrder) TableName() string { return "sim_recharge_order" }
|
|
|