Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitTables ¶
Types ¶
type Order ¶
type Order struct { Id int64 `gorm:"primaryKey;autoIncrement;comment:订单自增ID"` SN string `gorm:"type:varchar(255);not null;uniqueIndex:uniq_order_sn;comment:订单序列号"` BuyerId int64 `gorm:"not null;index:idx_buyer_id;comment:购买者ID"` PaymentId sql.NullInt64 `gorm:"uniqueIndex:uniq_payment_id;comment:支付自增ID,冗余允许为NULL"` PaymentSn sql.NullString `gorm:"type:varchar(255);uniqueIndex:uniq_payment_sn;comment:支付序列号,冗余允许为NULL"` OriginalTotalAmt int64 `gorm:"not null;comment:原始总价;单位为分, 999表示9.99元"` RealTotalAmt int64 `gorm:"not null;comment:实付总价;单位为分, 999表示9.99元"` Status uint8 `` /* 229-byte string literal not displayed */ Ctime int64 Utime int64 }
type OrderDAO ¶
type OrderDAO interface { CreateOrder(ctx context.Context, o Order, items []OrderItem) (int64, error) UpdateUnpaidOrderPaymentInfo(ctx context.Context, uid, oid, pid int64, psn string) error FindOrderByUIDAndSNAndStatus(ctx context.Context, uid int64, sn string, status uint8) (Order, error) FindOrderItemsByOrderID(ctx context.Context, oid int64) ([]OrderItem, error) CountOrdersByUID(ctx context.Context, uid int64, status uint8) (int64, error) FindOrdersByUID(ctx context.Context, offset, limit int, uid int64, status uint8) ([]Order, error) SetOrderCanceled(ctx context.Context, uid, oid int64) error SetOrderStatus(ctx context.Context, uid int64, orderSN string, status uint8) error FindTimeoutOrders(ctx context.Context, offset, limit int, ctime int64) ([]Order, error) CountTimeoutOrders(ctx context.Context, ctime int64) (int64, error) SetOrdersTimeoutClosed(ctx context.Context, orderIDs []int64, ctime int64) error }
func NewOrderGORMDAO ¶
type OrderItem ¶
type OrderItem struct { Id int64 `gorm:"primaryKey;autoIncrement;comment:订单项自增ID"` OrderId int64 `gorm:"not null;index:idx_order_id;comment:订单自增ID"` SPUId int64 `gorm:"column:spu_id;not null;index:idx_spu_id;comment:SPU自增ID"` SPUCategory0 string `gorm:"column:spu_category0;type:varchar(255);not null;comment:SPU分类0名称, product/code"` SPUCategory1 string `gorm:"column:spu_category1;type:varchar(255);not null;comment:SPU分类1名称, member/project"` SKUId int64 `gorm:"column:sku_id;not null;index:idx_sku_id;comment:SKU自增ID"` SKUSN string `gorm:"column:sku_sn;type:varchar(255);not null;comment:SKU序列号"` SKUImage string `gorm:"column:sku_image;type:varchar(512);not null;comment:SKU缩略图,CDN绝对路径"` SKUAttrs sql.NullString `gorm:"column:spu_attrs;comment:商品销售属性,JSON格式"` SKUName string `gorm:"column:sku_name;type:varchar(255);not null;comment:SKU名称"` SKUDescription string `gorm:"column:sku_description;not null;comment:SKU描述"` SKUOriginalPrice int64 `gorm:"column:sku_original_price;not null;comment:商品原始单价;单位为分, 999表示9.99元"` SKURealPrice int64 `gorm:"column:sku_real_price;not null;comment:商品实付单价;单位为分, 999表示9.99元"` Quantity int64 `gorm:"not null;comment:购买数量"` Ctime int64 Utime int64 }
Click to show internal directories.
Click to hide internal directories.