feat: 完善 Rock 发货异常闭环与绑定判定
This commit is contained in:
@@ -153,13 +153,6 @@ type RockTokenData struct {
|
||||
RedeemedAt string `json:"redeemed_at"`
|
||||
}
|
||||
|
||||
func (t *RockTokenData) IsBound() bool {
|
||||
if t.Status == "bound" || t.Status == "redeemed" {
|
||||
return true
|
||||
}
|
||||
return strings.TrimSpace(t.BoundAccountID) != ""
|
||||
}
|
||||
|
||||
func (t *RockTokenData) GetRoleName() string {
|
||||
return strings.TrimSpace(t.BoundAccount)
|
||||
}
|
||||
@@ -214,11 +207,18 @@ type RockRefreshResponse struct {
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
func (r *RockRefreshResponse) IsBound() bool {
|
||||
// HasBindingSignal 表示上游存在任何绑定痕迹,不代表该绑定属于本轮。
|
||||
// 本轮判定必须使用 rockCurrentCycleBinding。
|
||||
func (r *RockRefreshResponse) HasBindingSignal() bool {
|
||||
if r == nil {
|
||||
return false
|
||||
}
|
||||
if r.Token.IsBound() {
|
||||
switch strings.ToLower(strings.TrimSpace(r.Token.Status)) {
|
||||
case "bound", "redeemed":
|
||||
return true
|
||||
}
|
||||
if strings.TrimSpace(r.Token.BoundAccountID) != "" ||
|
||||
strings.TrimSpace(r.Token.BindChangedAt) != "" {
|
||||
return true
|
||||
}
|
||||
return r.Binding.Bound || strings.TrimSpace(r.Binding.RoleID) != ""
|
||||
|
||||
Reference in New Issue
Block a user