feat: 完善 Rock 发货异常闭环与绑定判定

This commit is contained in:
yml
2026-11-14 23:58:57 +08:00
parent 9353b439a7
commit 6a87fe5228
45 changed files with 3497 additions and 389 deletions
+9 -9
View File
@@ -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) != ""