feat:Rock刷新去UID拦截,新增绑定错误自动刷新与使用/绑定超时预警

This commit is contained in:
2026-11-08 18:03:48 +08:00
parent 1dba8e4c2e
commit 51dcb9de5a
22 changed files with 768 additions and 182 deletions
+23
View File
@@ -416,6 +416,29 @@ func (h *RockHandler) ReleaseToken(c *gin.Context) {
response.OK(c, gin.H{"message": "已释放回可用库存,该提货链接可以再次分配"})
}
// RefreshMismatchTokens 一键刷新全部绑定错误的 Token(同步执行,单次最多 20 条)。
func (h *RockHandler) RefreshMismatchTokens(c *gin.Context) {
result, err := h.rockSvc.RefreshAllMismatchTokens(c.Request.Context())
if err != nil {
response.BadRequest(c, err.Error())
return
}
message := fmt.Sprintf("已扫描 %d 条绑定错误 Token,修复 %d 条", result.Scanned, result.Fixed)
if result.Failed > 0 {
message += fmt.Sprintf(",失败 %d 条", result.Failed)
}
if result.Remaining > 0 {
message += fmt.Sprintf(",仍异常 %d 条", result.Remaining)
}
response.OK(c, gin.H{
"scanned": result.Scanned,
"fixed": result.Fixed,
"failed": result.Failed,
"remaining": result.Remaining,
"message": message,
})
}
// RefreshBinding 人工刷新指定 Token 的上游绑定状态
func (h *RockHandler) RefreshBinding(c *gin.Context) {
idUint, err := strconv.ParseUint(c.Param("id"), 10, 64)