card.go 823 B

1234567891011121314151617181920212223242526272829303132333435
  1. package account
  2. import (
  3. "context"
  4. accwar "go-common/app/service/main/account/api"
  5. accmdl "go-common/app/service/main/account/model"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. )
  9. // Card3 get card info by mid
  10. func (d *Dao) Card3(c context.Context, mid int64) (res *accmdl.Card, err error) {
  11. var (
  12. arg = &accwar.MidReq{Mid: mid}
  13. reply *accwar.CardReply
  14. )
  15. if reply, err = d.accClient.Card3(c, arg); err != nil || reply == nil || reply.Card == nil {
  16. if err != nil {
  17. log.Error("s.accDao.Info(%d) error(%v)", mid, err)
  18. }
  19. err = ecode.AccessDenied
  20. return
  21. }
  22. res = reply.Card
  23. return
  24. }
  25. // IsVip checks whether the member is vip
  26. func IsVip(card *accmdl.Card) bool {
  27. if card.Vip.Type == 0 || card.Vip.Status == 0 || card.Vip.Status == 2 || card.Vip.Status == 3 {
  28. return false
  29. }
  30. return true
  31. }