samba/util/model/realPlayeGame.go
2025-06-04 09:51:39 +08:00

30 lines
613 B
Go

package model
import (
"context"
"fmt"
"github.com/go-redis/redis/v8"
"samba/pkg/log"
"samba/pkg/xtime"
"samba/util/rdbkey"
)
type RealPlayGameOp struct {
rdb *redis.Client
}
func NewRealPlayGameOp() *RealPlayGameOp {
return &RealPlayGameOp{rdb: rdbGameLog}
}
func (op *RealPlayGameOp) Update() {
err := op.rdb.Set(context.TODO(), rdbkey.RealPlayerGameKey(), xtime.Now().Timestamp(), 0).Err()
if err != nil {
log.Error(fmt.Sprintf("update realPlayGame faild:%s", err))
}
}
func (op *RealPlayGameOp) Get() (int64, error) {
return op.rdb.Get(context.TODO(), rdbkey.RealPlayerGameKey()).Int64()
}