mail_api.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/service/main/vip/model"
  5. "go-common/library/ecode"
  6. "go-common/library/log"
  7. )
  8. const (
  9. _mailCreateCouponCodeURI = "/mall-marketing/coupon_code/create"
  10. )
  11. // MailCouponCodeCreate mail coupon code create.
  12. func (d *Dao) MailCouponCodeCreate(c context.Context, a *model.ArgMailCouponCodeCreate) (err error) {
  13. resp := new(struct {
  14. Code int `json:"code"`
  15. Message string `json:"message"`
  16. Data *model.MailCouponCodeCreateResp `json:"data"`
  17. })
  18. err = d.mailclient.Post(c, d.c.Host.Mail+_mailCreateCouponCodeURI, a, resp)
  19. if err != nil {
  20. log.Error("mail faild api(%s) args(%+v) res(%+v) error(%+v)", _mailCreateCouponCodeURI, a, resp, err)
  21. err = ecode.VipMailReqErr
  22. return
  23. }
  24. if resp.Code != ecode.OK.Code() {
  25. log.Error("mail code faild api(%s) args(%+v) res(%+v) error(%+v)", _mailCreateCouponCodeURI, a, resp, err)
  26. err = ecode.VipMailRespCodeErr
  27. return
  28. }
  29. log.Info("mail success api(%s) args(%+v) res(%+v) data(%+v)", _mailCreateCouponCodeURI, a, resp, resp.Data)
  30. return
  31. }