white_list.go 455 B

12345678910111213141516171819202122
  1. package dao
  2. import (
  3. "context"
  4. "go-common/library/cache/redis"
  5. "go-common/library/log"
  6. )
  7. //IsWhietListUID 通过UID判读是否是白名单用户
  8. func (d *Dao) IsWhietListUID(ctx context.Context, key string) (isWhite bool) {
  9. conn := d.whitelistredis.Get(ctx)
  10. defer conn.Close()
  11. var err error
  12. isWhite, err = redis.Bool(conn.Do("EXISTS", key))
  13. if err != nil {
  14. log.Error("[DM] GetWhietListByUID redis err:%+v", err)
  15. return true
  16. }
  17. return
  18. }