blocked.go 762 B

123456789101112131415161718192021222324252627
  1. package dao
  2. import (
  3. "context"
  4. "encoding/binary"
  5. "time"
  6. "go-common/app/job/main/figure/conf"
  7. "go-common/app/job/main/figure/model"
  8. "github.com/pkg/errors"
  9. )
  10. // BlockedRage .
  11. func (d *Dao) BlockedRage(c context.Context, mid int64, vs int16) (err error) {
  12. var (
  13. rageByte = make([]byte, 8)
  14. ctx, cancel = context.WithTimeout(c, time.Duration(conf.Conf.HBase.WriteTimeout))
  15. )
  16. defer cancel()
  17. binary.BigEndian.PutUint16(rageByte, uint16(vs))
  18. values := map[string]map[string][]byte{model.USFamilyUser: map[string][]byte{model.USColumnBlockedRage: rageByte}}
  19. if _, err = d.hbase.PutStr(ctx, model.UserInfoTable, d.rowKey(mid), values); err != nil {
  20. err = errors.Wrapf(err, "mid(%v), hbase.Put(key: %s values: %v)", mid, mid, values)
  21. }
  22. return
  23. }