package watcher import ( "91porn-server/common" "91porn-server/common/constant" "91porn-server/common/stderr" "91porn-server/models/v/usermod" "net/http" "github.com/gin-gonic/gin" ) // 异常用户处理 func WatcherUnusualUser() gin.HandlerFunc { return func(ctx *gin.Context) { uid, err := common.GetUID(ctx) //检查当前用户注册得分情况 if uid != 0 && err == nil { user, _ := usermod.FindUserByUIDForNoCache(uid) if user != nil { if user.TrueScore == -1 || (user.TrueScore <= constant.UserLowestTrueScore && user.TrueScore > 0) { ctx.AbortWithStatusJSON(http.StatusForbidden, stderr.UserIsException.Struct()) return } } } } }