查询绑定结果增加预期账号比对:mismatch 提前拦截
- 下单 data 传了 game_account 时,bind-result 返回 expected_game_account 与 mismatch - 绑定账号与预期不一致时 message 提示,配合 submit 已有的一致性校验提前发现 - 对接文档补充 mismatch 字段与说明
This commit is contained in:
@@ -128,14 +128,16 @@ type DeliveryProduct struct {
|
||||
}
|
||||
|
||||
type DeliveryBindResult struct {
|
||||
BindUUID string `json:"bind_uuid"`
|
||||
BindURL string `json:"bind_url"`
|
||||
QRURL string `json:"qr_url"`
|
||||
Bound bool `json:"bound"`
|
||||
GameAccount string `json:"game_account,omitempty"`
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
GameChannel string `json:"game_channel,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
BindUUID string `json:"bind_uuid"`
|
||||
BindURL string `json:"bind_url"`
|
||||
QRURL string `json:"qr_url"`
|
||||
Bound bool `json:"bound"`
|
||||
GameAccount string `json:"game_account,omitempty"`
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
GameChannel string `json:"game_channel,omitempty"`
|
||||
ExpectedGameAccount string `json:"expected_game_account,omitempty"`
|
||||
Mismatch bool `json:"mismatch,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type DeliveryLinkResult struct {
|
||||
@@ -220,14 +222,24 @@ func (s *DeliveryService) GetBindResult(merchantID uint, orderNo, bindUUID strin
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return &DeliveryBindResult{
|
||||
boundAccount := stringFromMap(account, "game_account")
|
||||
result := &DeliveryBindResult{
|
||||
BindUUID: bindUUID,
|
||||
Bound: true,
|
||||
GameAccount: stringFromMap(account, "game_account"),
|
||||
GameAccount: boundAccount,
|
||||
RoleName: stringFromMap(account, "game_account_role_name"),
|
||||
GameChannel: gameChannelText(account),
|
||||
Message: "绑定成功",
|
||||
}, nil
|
||||
}
|
||||
// 下单时 data 透传的预期账号:绑定账号与预期不一致时提示,供自建页提前拦截。
|
||||
if expected := requestDataString(order.RequestData, "game_account"); expected != "" {
|
||||
result.ExpectedGameAccount = expected
|
||||
if boundAccount != expected {
|
||||
result.Mismatch = true
|
||||
result.Message = "绑定成功,但绑定账号与下单预期账号不一致,请确认"
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *DeliveryService) bindWithOrder(orderNo, gameAccount string, auth *DeliveryLinkAuth, merchantID uint) (*DeliveryBindResult, error) {
|
||||
|
||||
Reference in New Issue
Block a user