bug处理优化

bug处理优化
This commit is contained in:
truewhile
2026-08-20 15:43:39 +08:00
parent d368353656
commit 495292ab3b
24 changed files with 1043 additions and 121 deletions
+6 -2
View File
@@ -20,8 +20,12 @@ func updateProfileHandler(svc *service.Container) gin.HandlerFunc {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
uid, _ := c.Get(middleware.CtxUserID)
userID := uid.(string)
uid, exists := c.Get(middleware.CtxUserID)
userID, ok := uid.(string)
if !exists || !ok || userID == "" {
c.JSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"})
return
}
hideAdultChanged, err := profileHideAdultChanged(c.Request.Context(), svc, userID, patch)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})