Files
2026-07-30 18:04:34 +08:00

38 lines
4.2 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import (
"git.apinb.com/bsm-sdk/core/database"
"time"
)
// EcOrder 对应 ec_order保存电商订单与组织快照。
type EcOrder struct {
Entity // 公共实体字段
OrderStatus int `gorm:"column:order_status;not null;default:16;index" json:"order_status"` // 商城订单业务状态
OrderNo string `gorm:"column:order_no;type:varchar(64);not null;uniqueIndex" json:"order_no"` // order_no 业务字段
RequestNo string `gorm:"column:request_no;type:varchar(128);not null;default:'';uniqueIndex:,where:request_no <> ''" json:"request_no"` // 创建幂等号
UserAccountID uint64 `gorm:"column:user_account_id;not null;index" json:"user_account_id"` // user_account_id 业务字段
GasStationID uint64 `gorm:"column:gas_station_id;not null;default:0;index" json:"gas_station_id"` // gas_station_id 业务字段
DeliveryPointID uint64 `gorm:"column:delivery_point_id;not null;default:0;index" json:"delivery_point_id"` // delivery_point_id 业务字段
TotalAmount int64 `gorm:"column:total_amount;not null;default:0;check:total_amount >= 0" json:"total_amount"` // total_amount 业务字段
UserAddressID uint64 `gorm:"column:user_address_id;not null;default:0;index" json:"user_address_id"` // 收货地址内部主键
Address string `gorm:"column:address;type:varchar(255);not null;default:''" json:"address"` // 收货地址快照
Longitude string `gorm:"column:longitude;type:varchar(32);not null;default:''" json:"longitude"` // 收货地址经度快照
Latitude string `gorm:"column:latitude;type:varchar(32);not null;default:''" json:"latitude"` // 收货地址纬度快照
ContactName string `gorm:"column:contact_name;type:varchar(64);not null;default:''" json:"contact_name"` // 收货联系人快照
ContactPhone string `gorm:"column:contact_phone;type:varchar(32);not null;default:''" json:"contact_phone"` // 收货电话快照
ProductAmount int64 `gorm:"column:product_amount;not null;default:0;check:product_amount >= 0" json:"product_amount"` // 商品金额,单位分
DiscountAmount int64 `gorm:"column:discount_amount;not null;default:0;check:discount_amount >= 0" json:"discount_amount"` // 优惠金额,单位分
PayableAmount int64 `gorm:"column:payable_amount;not null;default:0;check:payable_amount >= 0" json:"payable_amount"` // 应付金额,单位分
PaidAt *time.Time `gorm:"column:paid_at;type:timestamptz" json:"paid_at"` // 支付完成时间
Remark string `gorm:"column:remark;type:text;not null;default:''" json:"remark"` // 订单备注
LogisticsNo string `gorm:"column:logistics_no;type:varchar(128);not null;default:'';index" json:"logistics_no"` // 物流单号
LogisticsCompany string `gorm:"column:logistics_company;type:varchar(128);not null;default:''" json:"logistics_company"` // 物流公司
LogisticsStatus int `gorm:"column:logistics_status;not null;default:10;index" json:"logistics_status"` // 独立物流状态
ShippedAt *time.Time `gorm:"column:shipped_at;type:timestamptz" json:"shipped_at"` // 发货时间
ReceivedAt *time.Time `gorm:"column:received_at;type:timestamptz" json:"received_at"` // 用户收货时间
}
func init() { database.AppendMigrate(&EcOrder{}) }
func (table *EcOrder) TableName() string { return "ec_order" }