Clean backend debug logging and standardize error reporting.

This removes verbose trace output in handlers/services and keeps only actionable error-level logs.
This commit is contained in:
2026-03-09 22:18:53 +08:00
parent 4d8f2ec997
commit 4c0177149a
13 changed files with 8 additions and 163 deletions

View File

@@ -1,7 +1,6 @@
package handler
import (
"fmt"
"strconv"
"github.com/gin-gonic/gin"
@@ -572,16 +571,12 @@ func (h *UserHandler) GetFollowersList(c *gin.Context) {
page := c.DefaultQuery("page", "1")
pageSize := c.DefaultQuery("page_size", "20")
fmt.Printf("[DEBUG] GetFollowersList: userID=%s, currentUserID=%s\n", userID, currentUserID)
users, err := h.userService.GetFollowersList(c.Request.Context(), userID, page, pageSize)
if err != nil {
response.InternalServerError(c, "failed to get followers list")
return
}
fmt.Printf("[DEBUG] GetFollowersList: found %d users\n", len(users))
// 如果已登录,获取双向关注状态和实时计算的帖子数量
var userResponses []*dto.UserResponse
if currentUserID != "" && len(users) > 0 {
@@ -589,7 +584,6 @@ func (h *UserHandler) GetFollowersList(c *gin.Context) {
for i, u := range users {
userIDs[i] = u.ID
}
fmt.Printf("[DEBUG] GetFollowersList: checking mutual follow status for userIDs=%v\n", userIDs)
statusMap, _ := h.userService.GetMutualFollowStatus(c.Request.Context(), currentUserID, userIDs)
postsCountMap, _ := h.userService.GetUserPostCountBatch(c.Request.Context(), userIDs)
userResponses = dto.ConvertUsersToResponseWithMutualFollowAndPostsCount(users, statusMap, postsCountMap)