@@ -0,0 +1,32 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user