12345678910111213141516171819202122232425262728 |
- package model
- import (
- "context"
- "fmt"
- "github.com/gogf/gf/v2/frame/g"
- "github.com/gogf/gf/v2/os/gctx"
- )
- var (
- UserBlackList = &cUserBlackList{}
- )
- type cUserBlackList struct {
- }
- func init() {
- g.Redis("black").Set(gctx.New(), "aiChat_black_14891", 1)
- }
- // CheckBlackList 校验黑名单
- func (l *cUserBlackList) CheckBlackList(ctx context.Context, accountId int64) bool {
- v, e := g.Redis("black").Get(ctx, fmt.Sprintf("aiChat_black_%d", accountId))
- if e != nil {
- return false
- }
- return !v.IsEmpty()
- }
|