flow.go 957 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package dao
  2. import (
  3. "context"
  4. "net/url"
  5. "strconv"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. )
  9. const (
  10. _typeArticleFlow = "3"
  11. )
  12. // FlowSync 流量管理同步过审文章
  13. func (d *Dao) FlowSync(c context.Context, mid, aid int64) (err error) {
  14. params := url.Values{}
  15. params.Set("oid", strconv.FormatInt(aid, 10))
  16. params.Set("mid", strconv.FormatInt(mid, 10))
  17. params.Set("business", _typeArticleFlow)
  18. resp := struct {
  19. Code int
  20. Data interface{}
  21. }{}
  22. if err = d.httpClient.Post(c, d.c.Job.FlowURL, "", params, &resp); err != nil {
  23. log.Error("flow: d.FlowSync.Post(%s) error(%+v)", d.c.Job.FlowURL+params.Encode(), err)
  24. PromError("flow:文章过审")
  25. return
  26. }
  27. if resp.Code != 0 {
  28. err = ecode.Int(resp.Code)
  29. log.Error("flow: d.FlowSync.Post(%s) error(%+v)", d.c.Job.FlowURL+"?"+params.Encode(), resp)
  30. PromError("flow:文章过审")
  31. return
  32. }
  33. log.Info("flow: dao.FlowSync success aid: %v mid: %v ", aid, mid)
  34. return
  35. }