http.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. package http
  2. import (
  3. "go-common/app/service/main/videoup/conf"
  4. "go-common/app/service/main/videoup/service"
  5. "go-common/library/log"
  6. "go-common/library/net/http/blademaster"
  7. "go-common/library/net/http/blademaster/middleware/antispam"
  8. "go-common/library/net/http/blademaster/middleware/verify"
  9. )
  10. var (
  11. vfySvc *verify.Verify
  12. anti *antispam.Antispam
  13. vdpSvc *service.Service
  14. config *conf.Config
  15. )
  16. // Init init server.
  17. func Init(c *conf.Config, s *service.Service) {
  18. vfySvc = verify.New(nil)
  19. anti = antispam.New(c.AntispamConf)
  20. vdpSvc = s
  21. config = c
  22. eng := blademaster.DefaultServer(c.BM)
  23. route(eng)
  24. if err := eng.Start(); err != nil {
  25. log.Error("eng.Start error(%v)", err)
  26. panic(err)
  27. }
  28. }
  29. func route(e *blademaster.Engine) {
  30. e.Ping(ping)
  31. vp := e.Group("/videoup", vfySvc.Verify)
  32. {
  33. // ugc && pgc
  34. vp.GET("/simplearchive", simpleArchive)
  35. vp.GET("/simplevideos", simpleVideos)
  36. vp.GET("/view", viewArchive)
  37. vp.GET("/views", viewArchives)
  38. vp.GET("/up/archives", archivesByMid)
  39. vp.GET("/cid/archives", archivesByCids)
  40. vp.GET("/archives/rejected", rejectedArchives)
  41. vp.GET("/history/view", arcHistory)
  42. vp.GET("/history/list", arcHistorys)
  43. vp.GET("/types", types)
  44. vp.GET("/flows", flows)
  45. vp.GET("/flow/forbid", flowForbid)
  46. vp.GET("/query/cid", queryCid)
  47. vp.GET("/up/special", specialUps)
  48. vp.GET("/feed/aids", appFeedAids)
  49. vp.GET("/desc/format", descFormats)
  50. vp.POST("/archive/report", anti.Handler(), arcReport)
  51. vp.GET("/archive/reason/tag", arcReasonTag)
  52. vp.GET("/archive/addit", archiveAddit)
  53. vp.POST("/del", delArchive)
  54. // recommend archive
  55. vp.GET("/recos", Recos)
  56. vp.POST("/reco/update", RecoUpdate)
  57. // obtain cid
  58. vp.POST("/obtain/cid", obtainCid)
  59. // ugc
  60. vp.GET("/cid", videoBycid)
  61. vp.POST("/add", addArchive)
  62. vp.POST("/edit", editArchive)
  63. vp.POST("/tag/up", upArchiveTag)
  64. //setting output
  65. setting := vp.Group("/setting")
  66. {
  67. setting.GET("/dynamic", queryDynamic)
  68. }
  69. //ugc only
  70. ugc := vp.Group("/ugc")
  71. {
  72. ugc.POST("/edit/mission", editMissionByUGC)
  73. }
  74. // pgc
  75. pgc := vp.Group("/pgc")
  76. {
  77. pgc.POST("/add", addByPGC)
  78. pgc.POST("/edit", editByPGC)
  79. pgc.POST("/add/secret", saddByPGC)
  80. pgc.POST("/add/coopera", caddByPGC)
  81. pgc.POST("/edit/coopera", ceditByPGC)
  82. }
  83. vp.POST("/ns/md5", nsMd5)
  84. // Get video traffic jam level
  85. vp.GET("/video/jam", videoJam)
  86. //ad
  87. porder := vp.Group("/porder")
  88. {
  89. porder.GET("/config/list", porderCfgList)
  90. porder.GET("/arc/list", porderArcList)
  91. }
  92. flow := vp.Group("/flow")
  93. {
  94. flow.POST("/entry/mid", addByMid)
  95. flow.POST("/entry/oid", addByOid)
  96. //分页查询
  97. flow.GET("/list", listFlows)
  98. //指定查询
  99. flow.GET("/list/judge", listJudgeFlows)
  100. flow.GET("/info", queryByOid)
  101. }
  102. staff := vp.Group("/staff")
  103. {
  104. /*
  105. 1. up主申请(添加/修改) staff member edit其中涉及到 可能已经accept 变成 staffON 的case
  106. 2. 生成多个apply list
  107. 3. 受邀请者 查看 applys
  108. 4.同意 accept 拒绝 refuse
  109. 5.up主自己可以继续编辑 覆盖式 !!!
  110. 发起人维度 稿件页 是批量的
  111. 具体申请单页 是单个操作
  112. */
  113. //查看apply
  114. staff.GET("/apply", viewApply)
  115. //mid applys 计数
  116. staff.GET("/mid/applys", checkMid)
  117. //管理后台
  118. staff.POST("/apply/batch", batchApplys)
  119. //apply申请单交互
  120. staff.POST("/apply/submit", addApply)
  121. //apply申请单列表
  122. staff.GET("/apply/list", applys)
  123. staff.GET("/apply/filter", filterApplys)
  124. staff.GET("/archive/applys/", archiveApplys)
  125. //staff正式列表
  126. staff.GET("", staffs)
  127. }
  128. }
  129. }