dmhistory_search.go 818 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package http
  2. import (
  3. "go-common/app/service/main/search/model"
  4. "go-common/library/ecode"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. func dmHistorySearch(c *bm.Context) {
  9. var (
  10. err error
  11. params = c.Request.Form
  12. sp = &model.DmHistoryParams{
  13. Bsp: &model.BasicSearchParams{},
  14. }
  15. res *model.SearchResult
  16. )
  17. if params.Get("appid") == "" || params.Get("oid") == "" {
  18. c.JSON(nil, ecode.RequestErr)
  19. return
  20. }
  21. if err = c.Bind(sp); err != nil {
  22. c.JSON(nil, ecode.RequestErr)
  23. return
  24. }
  25. if err = c.Bind(sp.Bsp); err != nil {
  26. c.JSON(nil, ecode.RequestErr)
  27. return
  28. }
  29. sp.Bsp.Source = []string{"id"}
  30. res, err = svr.DmHistory(c, sp)
  31. if err != nil {
  32. log.Error("srv.DmHistory(%v) error(%v)", sp, err)
  33. c.JSON(nil, ecode.ServerErr)
  34. return
  35. }
  36. c.JSON(res, err)
  37. }