fix: 排行榜榜内记录同样标记 is_mine(此前仅榜外附加记录可高亮)
This commit is contained in:
@@ -304,14 +304,14 @@ func (h *Handler) Rankings(c *gin.Context) {
|
||||
items[i].Rank = i + 1
|
||||
}
|
||||
|
||||
// 附加"我的记录"(不在榜内时)
|
||||
// 附加"我的记录"并标记 is_mine(无论是否在榜内,前端均高亮)
|
||||
if idStr := strings.TrimSpace(c.Query("include_id")); idStr != "" {
|
||||
if id, err := strconv.ParseUint(idStr, 10, 64); err == nil && id > 0 {
|
||||
inList := false
|
||||
for _, it := range items {
|
||||
if uint64(it.ID) == id {
|
||||
for i := range items {
|
||||
if uint64(items[i].ID) == id {
|
||||
items[i].IsMine = true // 榜内:直接标记
|
||||
inList = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !inList {
|
||||
|
||||
Reference in New Issue
Block a user