user_card.go 716 B

1234567891011121314151617181920212223242526272829303132
  1. package archive
  2. import (
  3. "context"
  4. "go-common/library/log"
  5. "net/url"
  6. "strconv"
  7. )
  8. //GetUserCard get user card
  9. func (d *Dao) GetUserCard(c context.Context, mid int64) (card map[string]interface{}, err error) {
  10. params := url.Values{}
  11. params.Set("mid", strconv.FormatInt(mid, 10))
  12. res := new(struct {
  13. Code int `json:"code"`
  14. Card map[string]interface{} `json:"card"`
  15. })
  16. card = map[string]interface{}{}
  17. if err = d.clientR.Get(c, d.userCardURL, "", params, res); err != nil {
  18. log.Error("GetUserCard d.clientR.Get error(%v) mid(%d)", err, mid)
  19. return
  20. }
  21. if res == nil || res.Code != 0 {
  22. log.Warn("GetUserCard request failed res(%+v)", res)
  23. return
  24. }
  25. card = res.Card
  26. return
  27. }