feat(v2): gateway 经 Picker 路由选账户 + retry 换号(ExcludeAccounts);替换首个 enabled
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/wangjia/pay/internal/model"
|
||||
)
|
||||
|
||||
// AttemptAccountIDs returns the distinct account_ids already tried for an order on a
|
||||
// channel (used by retry to switch to a not-yet-tried account via PickHint.ExcludeAccounts).
|
||||
func (s *OrderStore) AttemptAccountIDs(outTradeNo, channel string) ([]string, error) {
|
||||
var ids []string
|
||||
if err := s.db.Model(&model.Attempt{}).
|
||||
Where("out_trade_no = ? AND channel = ? AND account_id <> ''", outTradeNo, channel).
|
||||
Distinct().Pluck("account_id", &ids).Error; err != nil {
|
||||
return nil, fmt.Errorf("store.AttemptAccountIDs: %w", err)
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
Reference in New Issue
Block a user