Skip to content

Commit fef452f

Browse files
committed
完成要求的更改
1 parent cf5c1f6 commit fef452f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

plugin/niuniu/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ var (
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

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

0 commit comments

Comments
 (0)