File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 })
4444 dajiaoLimiter = rate .NewManager [string ](time .Second * 90 , 1 )
4545 jjLimiter = rate .NewManager [string ](time .Second * 150 , 1 )
46- jjCount = syncx.Map [string , * niu.Rm ]{}
47- register = syncx.Map [string , * niu.Rm ]{}
46+ jjCount = syncx.Map [string , * niu.PKRecord ]{}
47+ register = syncx.Map [string , * niu.PKRecord ]{}
4848)
4949
5050func init () {
@@ -350,26 +350,26 @@ func init() {
350350 ctx .SendChain (message .Reply (ctx .Event .MessageID ), message .Text (msg ))
351351 j := fmt .Sprintf ("%d_%d" , gid , adduser )
352352 count , ok := jjCount .Load (j )
353- var c niu.Rm
353+ var c niu.PKRecord
354354 // 按照最后一次被 jj 时的时间计算,超过60分钟则重置
355355 if ! ok {
356356 // 第一次被 jj
357- c = niu.Rm {
357+ c = niu.PKRecord {
358358 NiuID : niuID ,
359359 TimeLimit : time .Now (),
360360 Count : 1 ,
361361 Length : length ,
362362 }
363363 } else {
364- c = niu.Rm {
364+ c = niu.PKRecord {
365365 NiuID : niuID ,
366366 TimeLimit : time .Now (),
367367 Count : count .Count + 1 ,
368368 Length : count .Length ,
369369 }
370370 // 超时了,重置
371371 if time .Since (c .TimeLimit ) > time .Hour {
372- c = niu.Rm {
372+ c = niu.PKRecord {
373373 NiuID : niuID ,
374374 TimeLimit : time .Now (),
375375 Count : 1 ,
@@ -404,7 +404,7 @@ func init() {
404404 data , ok := register .Load (key )
405405 switch {
406406 case ! ok || time .Since (data .TimeLimit ) > time .Hour * 24 :
407- data = & niu.Rm {
407+ data = & niu.PKRecord {
408408 TimeLimit : time .Now (),
409409 Count : 1 ,
410410 }
You can’t perform that action at this time.
0 commit comments