vip.go 776 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. // UpdateVipStatus .
  11. func (d *Dao) UpdateVipStatus(c context.Context, mid int64, vs int32) (err error) {
  12. var (
  13. vipByte = make([]byte, 8)
  14. ctx, cancel = context.WithTimeout(c, time.Duration(conf.Conf.HBase.WriteTimeout))
  15. )
  16. defer cancel()
  17. binary.BigEndian.PutUint64(vipByte, uint64(vs))
  18. values := map[string]map[string][]byte{model.USFamilyUser: map[string][]byte{model.USColumnVipStatus: vipByte}}
  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, d.rowKey(mid), values)
  21. }
  22. return
  23. }