http.go 840 B

1234567891011121314151617181920212223242526272829303132333435
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "net/url"
  6. "go-common/app/job/main/vip/model"
  7. "go-common/library/log"
  8. "github.com/pkg/errors"
  9. )
  10. const (
  11. _retryAutoRenew = "/x/internal/autorenew/retry"
  12. )
  13. //AutoRenewPay auto renew pay.
  14. func (d *Dao) AutoRenewPay(c context.Context, mid int64) (res *model.CommonResq, err error) {
  15. res = new(model.CommonResq)
  16. val := url.Values{}
  17. val.Add("mid", fmt.Sprintf("%d", mid))
  18. url := d.c.VipURI + _retryAutoRenew
  19. if err = d.client.Post(c, url, "", val, res); err != nil {
  20. log.Error("reques fail url %v params:%+v result:%+v, err:%+v", url, val, res, err)
  21. err = errors.WithStack(err)
  22. return
  23. }
  24. if res.Code != 0 {
  25. log.Error("reques fail url %v params:%+v result:%+v, err:%+v", url, val, res, err)
  26. return
  27. }
  28. log.Info("reques success url %v params:%+v result:%+v", url, val, res)
  29. return
  30. }