Files
huangguo_server/app/service/commentser/cmtlimitser.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

33 lines
741 B
Go

package commentser
import (
"91porn-server/app/appg"
"91porn-server/common/constant"
"91porn-server/common/constant/redisconst"
"time"
)
// 评论发表限制
func canPublishComment(uid uint64) (isCan bool, err error) {
var LimitExpire = time.Second * time.Duration(appg.Conf.CmtLimit.CmtLimitExpire)
var key = redisconst.AutoBlockKey(constant.FrequencyComment, uid)
cnt := appg.Redis.Incr(key)
if cnt == 1 {
_, _ = appg.Redis.ExpireKey(key, LimitExpire)
}
if cnt > appg.Conf.CmtLimit.CommentCount {
// err = usermod.UpdateById(nil, uid, time.Now().Add(12*time.Hour))
// if err != nil {
// return
// }
return
}
//code := CheckCountLimit(uid)
//if code != stderr.Success {
// return
//}
isCan = true
return
}