audit.go 974 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package dao
  2. import (
  3. "context"
  4. "net/url"
  5. "strconv"
  6. "go-common/app/service/main/spy/model"
  7. "go-common/library/ecode"
  8. "go-common/library/log"
  9. )
  10. const (
  11. _auditInfo = "/api/member/audit"
  12. )
  13. // AuditInfo get user audit info
  14. func (d *Dao) AuditInfo(c context.Context, mid int64, remoteIP string) (rs *model.AuditInfo, err error) {
  15. params := url.Values{}
  16. params.Set("mid", strconv.FormatInt(mid, 10))
  17. var res struct {
  18. Code int `json:"code"`
  19. Data model.AuditInfo `json:"data"`
  20. }
  21. if err = d.httpClient.Get(c, d.auditInfoURI, remoteIP, params, &res); err != nil {
  22. log.Error("account get audit info url(%s) error(%v)", d.auditInfoURI+"?"+params.Encode(), err)
  23. return
  24. }
  25. if res.Code != 0 {
  26. log.Error("account get audit info url(%s) error(%v)", d.auditInfoURI+"?"+params.Encode(), res.Code)
  27. err = ecode.Int(res.Code)
  28. return
  29. }
  30. rs = &res.Data
  31. log.Info("GET AuditInfoURL suc url(%s) resp(%v)", d.auditInfoURI+"?"+params.Encode(), res)
  32. return
  33. }