feat: 订单创建时快照买家手机号/昵称和套餐类型
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
新增字段: - tb_order: buyer_phone, buyer_nickname(个人客户下单时快照) - tb_order_item: package_type(套餐类型快照) 后台订单列表支持按 buyer_phone 精确过滤查询。 OpenSpec: order-buyer-snapshot
This commit is contained in:
@@ -29,6 +29,7 @@ type OrderListRequest struct {
|
||||
EndTime *time.Time `json:"end_time" query:"end_time" description:"创建时间结束"`
|
||||
IsExpired *bool `json:"is_expired" query:"is_expired" description:"是否已过期 (true:已过期, false:未过期)"`
|
||||
Identifier string `json:"identifier" query:"identifier" validate:"omitempty,max=100" maxLength:"100" description:"资产标识符(ICCID 或 VirtualNo)精确查询"`
|
||||
BuyerPhone string `json:"buyer_phone" query:"buyer_phone" validate:"omitempty,max=20" maxLength:"20" description:"买家手机号精确查询"`
|
||||
}
|
||||
|
||||
type PayOrderRequest struct {
|
||||
@@ -36,12 +37,13 @@ type PayOrderRequest struct {
|
||||
}
|
||||
|
||||
type OrderItemResponse struct {
|
||||
ID uint `json:"id" description:"明细ID"`
|
||||
PackageID uint `json:"package_id" description:"套餐ID"`
|
||||
PackageName string `json:"package_name" description:"套餐名称"`
|
||||
Quantity int `json:"quantity" description:"数量"`
|
||||
UnitPrice int64 `json:"unit_price" description:"单价(分)"`
|
||||
Amount int64 `json:"amount" description:"小计金额(分)"`
|
||||
ID uint `json:"id" description:"明细ID"`
|
||||
PackageID uint `json:"package_id" description:"套餐ID"`
|
||||
PackageName string `json:"package_name" description:"套餐名称"`
|
||||
PackageType *string `json:"package_type" description:"套餐类型快照 (formal:正式套餐, addon:加油包)"`
|
||||
Quantity int `json:"quantity" description:"数量"`
|
||||
UnitPrice int64 `json:"unit_price" description:"单价(分)"`
|
||||
Amount int64 `json:"amount" description:"小计金额(分)"`
|
||||
}
|
||||
|
||||
type OrderResponse struct {
|
||||
@@ -50,6 +52,8 @@ type OrderResponse struct {
|
||||
OrderType string `json:"order_type" description:"订单类型 (single_card:单卡购买, device:设备购买)"`
|
||||
BuyerType string `json:"buyer_type" description:"买家类型 (personal:个人客户, agent:代理商)"`
|
||||
BuyerID uint `json:"buyer_id" description:"买家ID"`
|
||||
BuyerPhone *string `json:"buyer_phone" description:"买家手机号快照(个人客户下单时记录)"`
|
||||
BuyerNickname *string `json:"buyer_nickname" description:"买家昵称快照(个人客户下单时记录)"`
|
||||
IotCardID *uint `json:"iot_card_id,omitempty" description:"IoT卡ID"`
|
||||
DeviceID *uint `json:"device_id,omitempty" description:"设备ID"`
|
||||
TotalAmount int64 `json:"total_amount" description:"订单总金额(分)"`
|
||||
|
||||
@@ -18,8 +18,10 @@ type Order struct {
|
||||
OrderType string `gorm:"column:order_type;type:varchar(20);not null;comment:订单类型 single_card-单卡购买 device-设备购买" json:"order_type"`
|
||||
|
||||
// 买家信息
|
||||
BuyerType string `gorm:"column:buyer_type;type:varchar(20);not null;comment:买家类型 personal-个人客户 agent-代理商" json:"buyer_type"`
|
||||
BuyerID uint `gorm:"column:buyer_id;index:idx_order_buyer;not null;comment:买家ID(个人客户ID或店铺ID)" json:"buyer_id"`
|
||||
BuyerType string `gorm:"column:buyer_type;type:varchar(20);not null;comment:买家类型 personal-个人客户 agent-代理商" json:"buyer_type"`
|
||||
BuyerID uint `gorm:"column:buyer_id;index:idx_order_buyer;not null;comment:买家ID(个人客户ID或店铺ID)" json:"buyer_id"`
|
||||
BuyerPhone *string `gorm:"column:buyer_phone;type:varchar(20);comment:下单时买家主手机号快照" json:"buyer_phone"`
|
||||
BuyerNickname *string `gorm:"column:buyer_nickname;type:varchar(100);comment:下单时买家昵称快照" json:"buyer_nickname"`
|
||||
|
||||
// 关联资源
|
||||
IotCardID *uint `gorm:"column:iot_card_id;index;comment:IoT卡ID(单卡购买时有值)" json:"iot_card_id,omitempty"`
|
||||
@@ -121,12 +123,13 @@ type OrderItem struct {
|
||||
gorm.Model
|
||||
BaseModel `gorm:"embedded"`
|
||||
|
||||
OrderID uint `gorm:"column:order_id;index:idx_order_item_order_id;not null;comment:订单ID" json:"order_id"`
|
||||
PackageID uint `gorm:"column:package_id;index;not null;comment:套餐ID" json:"package_id"`
|
||||
PackageName string `gorm:"column:package_name;type:varchar(100);not null;comment:套餐名称(快照)" json:"package_name"`
|
||||
Quantity int `gorm:"column:quantity;type:int;default:1;not null;comment:数量" json:"quantity"`
|
||||
UnitPrice int64 `gorm:"column:unit_price;type:bigint;not null;comment:单价(分)" json:"unit_price"`
|
||||
Amount int64 `gorm:"column:amount;type:bigint;not null;comment:小计金额(分)" json:"amount"`
|
||||
OrderID uint `gorm:"column:order_id;index:idx_order_item_order_id;not null;comment:订单ID" json:"order_id"`
|
||||
PackageID uint `gorm:"column:package_id;index;not null;comment:套餐ID" json:"package_id"`
|
||||
PackageName string `gorm:"column:package_name;type:varchar(100);not null;comment:套餐名称(快照)" json:"package_name"`
|
||||
PackageType *string `gorm:"column:package_type;type:varchar(20);comment:套餐类型快照 formal-正式套餐 addon-加油包" json:"package_type"`
|
||||
Quantity int `gorm:"column:quantity;type:int;default:1;not null;comment:数量" json:"quantity"`
|
||||
UnitPrice int64 `gorm:"column:unit_price;type:bigint;not null;comment:单价(分)" json:"unit_price"`
|
||||
Amount int64 `gorm:"column:amount;type:bigint;not null;comment:小计金额(分)" json:"amount"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
Reference in New Issue
Block a user