journal.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package dao
  2. import (
  3. "bufio"
  4. "net/http"
  5. "strings"
  6. "go-common/app/admin/main/manager/model"
  7. bm "go-common/library/net/http/blademaster"
  8. )
  9. const (
  10. _searchAuditURL = "http://manager.bilibili.co/x/admin/search/log/audit"
  11. _searchActionURL = "http://manager.bilibili.co/x/admin/search/log/user_action"
  12. )
  13. // SearchLogAudit .
  14. func (d *Dao) SearchLogAudit(c *bm.Context) (res *model.LogRes, err error) {
  15. res, err = d.combination(c, _searchAuditURL)
  16. return
  17. }
  18. // SearchLogAction .
  19. func (d *Dao) SearchLogAction(c *bm.Context) (res *model.LogRes, err error) {
  20. res, err = d.combination(c, _searchActionURL)
  21. return
  22. }
  23. // combination .
  24. func (d *Dao) combination(c *bm.Context, preURL string) (res *model.LogRes, err error) {
  25. params := c.Request.URL.RawQuery
  26. url := preURL + "?" + params
  27. cookie := c.Request.Header.Get("Cookie")
  28. req, err := http.NewRequest(http.MethodGet, url, bufio.NewReader(strings.NewReader(params)))
  29. if err != nil {
  30. return
  31. }
  32. req.Header.Set("Cookie", cookie)
  33. err = d.httpClient.Do(c, req, &res)
  34. return
  35. }