发货结果通知接口新增 game_channel、game_uid、role_name、pay_score 字段
This commit is contained in:
@@ -147,17 +147,21 @@ func (s *OrderService) UpdateStatus(id uint, status string) error {
|
||||
|
||||
// OpenOrderQuery 开放接口订单查询结果
|
||||
type OpenOrderQuery struct {
|
||||
OrderNo string `json:"order_no"`
|
||||
Status string `json:"status"`
|
||||
CanShip bool `json:"can_ship"`
|
||||
CannotShipReason string `json:"cannot_ship_reason,omitempty"`
|
||||
OrderNo string `json:"order_no"`
|
||||
Status string `json:"status"`
|
||||
CanShip bool `json:"can_ship"`
|
||||
CannotShipReason string `json:"cannot_ship_reason,omitempty"`
|
||||
Product *OpenOrderProduct `json:"product,omitempty"`
|
||||
BuyerName string `json:"buyer_name"`
|
||||
Amount float64 `json:"amount"`
|
||||
ProviderOrderNo string `json:"provider_order_no,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ShippedAt *time.Time `json:"shipped_at"`
|
||||
ShipFailReason string `json:"ship_fail_reason,omitempty"`
|
||||
BuyerName string `json:"buyer_name"`
|
||||
Amount float64 `json:"amount"`
|
||||
ProviderOrderNo string `json:"provider_order_no,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ShippedAt *time.Time `json:"shipped_at"`
|
||||
ShipFailReason string `json:"ship_fail_reason,omitempty"`
|
||||
GameChannel string `json:"game_channel,omitempty"`
|
||||
GameUID string `json:"game_uid,omitempty"`
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
PayScore int `json:"pay_score,omitempty"`
|
||||
}
|
||||
|
||||
type OpenOrderProduct struct {
|
||||
@@ -174,6 +178,10 @@ type ShipNotifyInput struct {
|
||||
ShippedAt *time.Time
|
||||
FailReason string
|
||||
RawPayload string
|
||||
GameChannel *string
|
||||
GameUID *string
|
||||
RoleName *string
|
||||
PayScore *int
|
||||
}
|
||||
|
||||
type ShipNotifyResult struct {
|
||||
@@ -215,6 +223,10 @@ func (s *OrderService) QueryOpenOrder(orderNo string) (*OpenOrderQuery, error) {
|
||||
CreatedAt: order.CreatedAt,
|
||||
ShippedAt: order.ShippedAt,
|
||||
ShipFailReason: order.ShipFailReason,
|
||||
GameChannel: order.GameChannel,
|
||||
GameUID: order.GameUID,
|
||||
RoleName: order.RoleName,
|
||||
PayScore: order.PayScore,
|
||||
}
|
||||
if order.Skin != nil {
|
||||
out.Product = &OpenOrderProduct{
|
||||
@@ -337,6 +349,19 @@ func (s *OrderService) HandleShipNotify(in ShipNotifyInput) (*ShipNotifyResult,
|
||||
msg = "订单已标记为发货中"
|
||||
}
|
||||
|
||||
if in.GameChannel != nil {
|
||||
updates["game_channel"] = *in.GameChannel
|
||||
}
|
||||
if in.GameUID != nil {
|
||||
updates["game_uid"] = *in.GameUID
|
||||
}
|
||||
if in.RoleName != nil {
|
||||
updates["role_name"] = *in.RoleName
|
||||
}
|
||||
if in.PayScore != nil {
|
||||
updates["pay_score"] = *in.PayScore
|
||||
}
|
||||
|
||||
if err := s.db.Model(&model.Order{}).Where("id = ?", order.ID).Updates(updates).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user