Files
huangguo_server/app/middleware/watcher/watch.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

29 lines
686 B
Go

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
}
}
}
}
}