clean_cache.go 969 B

123456789101112131415161718192021222324252627282930313233343536
  1. package dao
  2. import (
  3. "context"
  4. "net/url"
  5. "strconv"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. )
  9. // AsoCleanCache aso clean cache
  10. func (d *Dao) AsoCleanCache(c context.Context, token, session string, mid int64) (err error) {
  11. log.Info("aso clean cache,mid = %d,token = %s, session = %s", mid, token, session)
  12. params := url.Values{}
  13. params.Set("token", token)
  14. params.Set("session", session)
  15. params.Set("mid", strconv.Itoa(int(mid)))
  16. res := &struct {
  17. Code int `json:"code"`
  18. }{}
  19. if err = d.httpClient.Get(c, d.c.AuthJobConfig.AsoCleanURL, "127.0.0.2", params, res); err != nil {
  20. log.Error("AsoCleanCache HTTP request err %v,token = %s,session = %s,mid = %d", err, token, session, mid)
  21. return
  22. }
  23. if res.Code != 0 {
  24. log.Error("AsoCleanCache server err_code %d,token = %s,session = %s,mid=%d", res.Code, token, session, mid)
  25. if res.Code == ecode.RequestErr.Code() {
  26. err = nil
  27. return
  28. }
  29. err = ecode.Int(res.Code)
  30. return
  31. }
  32. return
  33. }