http.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. package http
  2. import (
  3. "go-common/app/admin/main/videoup/conf"
  4. "go-common/app/admin/main/videoup/service"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. "go-common/library/net/http/blademaster/middleware/permit"
  8. "go-common/library/net/http/blademaster/middleware/verify"
  9. )
  10. var (
  11. vfySvc *verify.Verify
  12. authSrc *permit.Permit
  13. vdaSvc *service.Service
  14. )
  15. // Init http server
  16. func Init(c *conf.Config, s *service.Service) {
  17. vdaSvc = s
  18. vfySvc = verify.New(nil)
  19. authSrc = permit.New(c.Auth)
  20. engine := bm.DefaultServer(c.BM)
  21. innerRouter(engine)
  22. // init internal server
  23. if err := engine.Start(); err != nil {
  24. log.Error("engine.Start error(%v)", err)
  25. panic(err)
  26. }
  27. }
  28. // innerRouter
  29. func innerRouter(e *bm.Engine) {
  30. e.Ping(ping)
  31. group2 := e.Group("/x/admin/videoup", authSrc.Permit(""))
  32. {
  33. task := group2.Group("/task")
  34. {
  35. task.GET("/weightconfig/maxweight", authSrc.Permit("TASKWEIGHT"), maxweight)
  36. task.POST("/weightconfig/add", authSrc.Permit("TASKWEIGHT"), addwtconf)
  37. task.POST("/weightconfig/del", authSrc.Permit("TASKWEIGHT"), delwtconf)
  38. task.GET("/weightconfig/list", authSrc.Permit("TASKWEIGHT"), listwtconf)
  39. task.GET("/weightlog/list", authSrc.Permit("TASKWEIGHT"), listwtlog)
  40. task.GET("/wcv/show", authSrc.Permit("TASKWEIGHT"), show)
  41. task.POST("/wcv/set", authSrc.Permit("TASKWEIGHT"), set)
  42. // 用户在线
  43. task.GET("/consumer/on", checkgroup(), on)
  44. task.GET("/consumer/off", checkgroup(), off) //自己退出
  45. task.POST("/consumer/forceoff", forceoff) //强制踢出
  46. task.GET("/online", authSrc.Permit("ONLINE"), online)
  47. task.GET("/inoutlist", inoutlist)
  48. // 任务状态
  49. task.POST("/delay", checkowner(), delay)
  50. task.POST("/free", taskfree)
  51. }
  52. oversea := group2.Group("/oversea")
  53. {
  54. oversea.GET("/policy/groups", policyGroups) //策略组列表
  55. oversea.POST("/policy/group/add", authSrc.Permit("POLICY_GROUP_EDIT"), addPolicyGroup) //新增策略组
  56. oversea.POST("/policy/group/edit", authSrc.Permit("POLICY_GROUP_EDIT"), editPolicyGroup) //编辑策略组
  57. oversea.POST("/policy/groups/del", authSrc.Permit("POLICY_GROUP_EDIT"), delPolicyGroups) //删除策略组
  58. oversea.POST("/policy/groups/restore", authSrc.Permit("POLICY_GROUP_EDIT"), restorePolicyGroups) //恢复被删除的策略组
  59. oversea.GET("/policies", policies) //获取策略列表
  60. oversea.GET("/archive/groups", archiveGroups) //稿件策略组列表
  61. oversea.POST("/policies/add", authSrc.Permit("POLICY_ITEM_EDIT"), addPolicies) //给组添加策略
  62. oversea.POST("/policies/del", authSrc.Permit("POLICY_ITEM_EDIT"), delPolicies) //删除策略
  63. }
  64. search := group2.Group("/search")
  65. {
  66. search.GET("video", searchVideo)
  67. search.GET("archive", searchArchive)
  68. search.POST("copyright", searchCopyright)
  69. }
  70. staff := group2.Group("/staff")
  71. {
  72. staff.GET("", staffs)
  73. staff.POST("/batch/submit", authSrc.Permit("ARC_STAFF"), batchStaff)
  74. }
  75. //监控规则
  76. monitor := group2.Group("/monitor")
  77. {
  78. monitor.GET("/rule/result", authSrc.Permit("MONITOR_RULE_READ"), monitorRuleResult) //查看监控规则结果
  79. monitor.GET("/rule/result/oids", monitorRuleResultOids)
  80. monitor.POST("/rule/update", authSrc.Permit("MONITOR_RULE_EDIT"), monitorRuleUpdate) //修改监控规则
  81. monitor.GET("/notify", monitorNotify)
  82. }
  83. group2.POST("/archive/uptag", upArcTag)
  84. group2.POST("/archive/batch/tag", authSrc.Permit("BATCH_ARC_CHANNEL"), batchTag)
  85. group2.GET("/archive/channel/info", channelInfo)
  86. }
  87. group := e.Group("/va", vfySvc.Verify)
  88. {
  89. group.POST("/video/audit", videoAudit)
  90. group.POST("/video/batch/video", batchVideo)
  91. group.POST("/video/add", upVideo)
  92. group.POST("/video/change/index", changeIndex)
  93. group.POST("/video/del", delVideo)
  94. group.POST("/video/weblink/up", upWebLink)
  95. group.POST("/archive/submit", submit)
  96. group.POST("/archive/batch/archive", batchArchive)
  97. group.POST("/archive/batch/databus", batchArchiveSecondRound)
  98. group.POST("/archive/batch/attrs", batchAttrs)
  99. group.POST("/archive/batch/types", batchTypeIDs)
  100. group.POST("/archive/auther/up", upAuther)
  101. group.POST("/archive/access/up", upAccess)
  102. group.GET("/archive/flow/hit", hitFlows)
  103. group.GET("/archive/aitrack", aiTrack)
  104. group.POST("/cm/attr/up", upCMArr)
  105. group.POST("/cm/dtime/up", upCMArcDelay)
  106. group.POST("/pgc/pass", passByPGC)
  107. group.POST("/pgc/modify", modifyByPGC)
  108. group.POST("/pgc/lock", lockByPGC)
  109. group.GET("/track/archive", trackArchive)
  110. group.GET("/track/video", trackVideo)
  111. group.GET("/track/detail", trackDetail)
  112. group.GET("/task/tooks", taskTooks)
  113. group.GET("/stats/points", statsPoints)
  114. group.GET("/task/next", next)
  115. group.GET("/task/list", list)
  116. //同步音乐库 add,edit,delete ,log full sync tools
  117. group.POST("/music/sync", syncMusic)
  118. group.GET("/task/info", info)
  119. monitor := group.Group("/monitor")
  120. {
  121. monitor.GET("/notify", monitorNotify)
  122. }
  123. }
  124. }