fix(delivery): add transient retry, fix queue deadlock, and gate delivery submit by scan auth
This commit is contained in:
@@ -383,6 +383,42 @@ func (s *DeliveryService) GetBindResult(merchantID uint, orderNo, bindUUID strin
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetBindResultLinked 为公开发货链接场景提供查询绑定结果的能力。
|
||||
func (s *DeliveryService) GetBindResultLinked(orderNo, bindUUID string, auth DeliveryLinkAuth) (*DeliveryBindResult, error) {
|
||||
bindUUID = strings.TrimSpace(bindUUID)
|
||||
if bindUUID == "" {
|
||||
return nil, errors.New("bind_uuid 不能为空")
|
||||
}
|
||||
openOrder, order, goodID, err := s.loadLinkedOrder(orderNo, &auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, _, _, err := s.buildDeliveryState(openOrder, order, goodID, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
providers, _ := s.router.ResolveProviders(order)
|
||||
if len(providers) == 0 {
|
||||
return nil, errors.New("未配置发货渠道")
|
||||
}
|
||||
p := providers[0]
|
||||
res, err := p.CheckBind(context.Background(), order, bindUUID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &DeliveryBindResult{
|
||||
BindUUID: res.BindUUID,
|
||||
BindURL: res.BindURL,
|
||||
QRURL: res.QRURL,
|
||||
Bound: res.Bound,
|
||||
GameAccount: res.GameAccount,
|
||||
RoleName: res.RoleName,
|
||||
GameChannel: res.GameChannel,
|
||||
ExpectedGameAccount: res.ExpectedGameAccount,
|
||||
Mismatch: res.Mismatch,
|
||||
Message: res.Message,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *DeliveryService) bindWithOrder(orderNo, gameAccount string, auth *DeliveryLinkAuth, merchantID uint) (*DeliveryBindResult, error) {
|
||||
gameAccount = strings.TrimSpace(gameAccount)
|
||||
if gameAccount == "" {
|
||||
|
||||
Reference in New Issue
Block a user