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