reply_search.go 984 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 replySearch(c *bm.Context) {
  9. params := c.Request.Form
  10. appidStr := params.Get("appid")
  11. switch appidStr {
  12. case "reply_record":
  13. replyRecord(c)
  14. default:
  15. c.JSON(nil, ecode.RequestErr)
  16. return
  17. }
  18. }
  19. func replyRecord(c *bm.Context) {
  20. var (
  21. err error
  22. sp = &model.ReplyRecordParams{
  23. Bsp: &model.BasicSearchParams{},
  24. }
  25. res *model.SearchResult
  26. params = c.Request.Form
  27. )
  28. if params.Get("mid") == "" {
  29. log.Error("mid is required")
  30. c.JSON(nil, ecode.RequestErr)
  31. return
  32. }
  33. if err = c.Bind(sp); err != nil {
  34. c.JSON(nil, ecode.RequestErr)
  35. return
  36. }
  37. if err = c.Bind(sp.Bsp); err != nil {
  38. c.JSON(nil, ecode.RequestErr)
  39. return
  40. }
  41. res, err = svr.ReplyRecord(c, sp)
  42. if err != nil {
  43. log.Error("svr.ArchiveCheck(%v,%d,%d) error(%v)", sp, sp.Bsp.Pn, sp.Bsp.Ps, err)
  44. }
  45. c.JSON(res, err)
  46. }