pgc_search.go 842 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 pgcSearch(c *bm.Context) {
  9. params := c.Request.Form
  10. appidStr := params.Get("appid")
  11. switch appidStr {
  12. case "pgc_media":
  13. pgcMedia(c)
  14. default:
  15. c.JSON(nil, ecode.RequestErr)
  16. return
  17. }
  18. }
  19. func pgcMedia(c *bm.Context) {
  20. var (
  21. err error
  22. sp = &model.PgcMediaParams{
  23. Bsp: &model.BasicSearchParams{},
  24. }
  25. res *model.SearchResult
  26. )
  27. if err = c.Bind(sp); err != nil {
  28. c.JSON(nil, ecode.RequestErr)
  29. return
  30. }
  31. if err = c.Bind(sp.Bsp); err != nil {
  32. c.JSON(nil, ecode.RequestErr)
  33. return
  34. }
  35. res, err = svr.PgcMedia(c, sp)
  36. if err != nil {
  37. log.Error("srv.DmHistory(%v) error(%v)", sp, err)
  38. c.JSON(nil, ecode.ServerErr)
  39. return
  40. }
  41. c.JSON(res, err)
  42. }