bnj.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package http
  2. import (
  3. "strconv"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. // viewIndex view handler
  8. func bnj2019(c *bm.Context) {
  9. var (
  10. mid int64
  11. relateID int64
  12. params = c.Request.Form
  13. )
  14. if midInter, ok := c.Get("mid"); ok {
  15. mid = midInter.(int64)
  16. }
  17. if !viewSvr.CheckAccess(mid) {
  18. c.JSON(nil, ecode.AccessDenied)
  19. return
  20. }
  21. relateID, _ = strconv.ParseInt(params.Get("relate_id"), 10, 64)
  22. c.JSON(viewSvr.Bnj2019(c, mid, relateID))
  23. }
  24. // viewPage view page handler.
  25. func bnjList(c *bm.Context) {
  26. var mid int64
  27. if midInter, ok := c.Get("mid"); ok {
  28. mid = midInter.(int64)
  29. }
  30. if !viewSvr.CheckAccess(mid) {
  31. c.JSON(nil, ecode.AccessDenied)
  32. return
  33. }
  34. c.JSON(viewSvr.BnjList(c, mid))
  35. }
  36. // videoShot video shot .
  37. func bnjItem(c *bm.Context) {
  38. var mid int64
  39. if midInter, ok := c.Get("mid"); ok {
  40. mid = midInter.(int64)
  41. }
  42. if !viewSvr.CheckAccess(mid) {
  43. c.JSON(nil, ecode.AccessDenied)
  44. return
  45. }
  46. params := c.Request.Form
  47. aidStr := params.Get("aid")
  48. aid, err := strconv.ParseInt(aidStr, 10, 64)
  49. if err != nil || aid <= 0 {
  50. c.JSON(nil, ecode.RequestErr)
  51. return
  52. }
  53. c.JSON(viewSvr.BnjItem(c, aid, mid))
  54. }