http.go 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. package http
  2. import (
  3. "go-common/app/admin/main/growup/conf"
  4. "go-common/app/admin/main/growup/service"
  5. "go-common/app/admin/main/growup/service/income"
  6. "go-common/library/log"
  7. bm "go-common/library/net/http/blademaster"
  8. )
  9. var (
  10. svr *service.Service
  11. incomeSvr *income.Service
  12. )
  13. // Init init
  14. func Init(c *conf.Config, s *service.Service) {
  15. svr = s
  16. incomeSvr = income.New(conf.Conf)
  17. engine := bm.DefaultServer(c.BM)
  18. initRouter(engine)
  19. if err := engine.Start(); err != nil {
  20. log.Error("engine.Start error(%v)", err)
  21. panic(err)
  22. }
  23. }
  24. func initRouter(r *bm.Engine) {
  25. r.Ping(ping)
  26. // 在up-profit.bilibili.co域名下
  27. b := r.Group("/allowance/api/x/admin/growup")
  28. up := b.Group("/up")
  29. {
  30. up.GET("/list", queryForUps)
  31. up.POST("/add", add)
  32. up.POST("/reject", reject)
  33. up.POST("/pass", pass)
  34. up.POST("/dismiss", dismiss)
  35. up.POST("/forbid", forbid)
  36. up.POST("/recovery", recovery)
  37. up.POST("/delete", deleteUp)
  38. up.POST("/state", updateAccountState)
  39. up.POST("/account/delete", delUpAccount)
  40. up.POST("/account/update", updateUpAccount)
  41. up.GET("/export", exportUps)
  42. up.POST("/white/add", addWhite)
  43. up.GET("/account/state", upState)
  44. credit := up.Group("/credit")
  45. {
  46. credit.GET("/list", creditRecords)
  47. credit.POST("/recover", recoverCredit)
  48. }
  49. }
  50. block := b.Group("/block")
  51. {
  52. block.GET("/list", queryFromBlocked)
  53. block.POST("/add", addToBlocked)
  54. block.POST("/delete", deleteFromBlocked)
  55. }
  56. authority := b.Group("/authority")
  57. {
  58. authority.GET("/user/privileges", getAuthorityUserPrivileges)
  59. authority.GET("/user/groups", getAuthorityUserGroup)
  60. authority.GET("/user/list", listAuthorityUsers)
  61. authority.POST("/user/add", addAuthorityUser)
  62. authority.POST("/user/update/info", updateAuthorityUserInfo)
  63. authority.POST("/user/update/auth", updateAuthorityUserAuth)
  64. authority.POST("/user/delete", deleteAuthorityUser)
  65. authority.GET("/taskgroup/list", listAuthorityTaskGroups)
  66. authority.POST("/taskgroup/add", addAuthorityTaskGroup)
  67. authority.POST("/taskgroup/add/user", addAuthorityTaskGroupUser)
  68. authority.POST("/taskgroup/update/info", updateAuthorityTaskGroupInfo)
  69. authority.POST("/taskgroup/delete", deleteAuthorityTaskGroup)
  70. authority.POST("/taskgroup/delete/user", deleteAuthorityTaskGroupUser)
  71. authority.GET("/taskgroup/list/privilege", listAuthorityGroupPrivilege)
  72. authority.POST("/taskgroup/update/privilege", updateAuthorityGroupPrivilege)
  73. authority.GET("/taskrole/list", listAuthorityTaskRoles)
  74. authority.POST("/taskrole/add", addAuthorityTaskRole)
  75. authority.POST("/taskrole/add/user", addAuthorityTaskRoleUser)
  76. authority.POST("/taskrole/update/info", updateAuthorityTaskRoleInfo)
  77. authority.POST("/taskrole/delete", deleteAuthorityTaskRole)
  78. authority.POST("/taskrole/delete/user", deleteAuthorityTaskRoleUser)
  79. authority.GET("/taskrole/list/privilege", listAuthorityRolePrivilege)
  80. authority.POST("/taskrole/update/privilege", updateAuthorityRolePrivilege)
  81. authority.GET("/list/groupandrole", listAuthorityGroupAndRole) //list task groups and task roles
  82. authority.GET("/privilege/list", listPrivilege)
  83. authority.POST("/privilege/add", addPrivilege)
  84. authority.POST("/privilege/update", updatePrivilege)
  85. // merge business and privilege
  86. authority.GET("/business", busPrivilege)
  87. }
  88. tag := b.Group("/tag")
  89. {
  90. tag.POST("/add", addTagInfo)
  91. tag.POST("/update", updateTagInfo)
  92. tag.POST("/state", modTagState)
  93. tag.POST("/addups", addTagUps)
  94. tag.POST("/release", releaseUp)
  95. tag.GET("/list", listTagInfo)
  96. tag.GET("/listup", listUps)
  97. tag.GET("/listav", listAvs)
  98. tag.GET("/details", tagDetails)
  99. tag.POST("/update/activity", updateActivity)
  100. }
  101. income := b.Group("/income")
  102. {
  103. income.GET("/up/list", upIncomeList)
  104. income.GET("/up/list/export", upIncomeListExport)
  105. income.GET("/up/statis", upIncomeStatis)
  106. income.GET("/archive/detail", archiveDetail)
  107. income.GET("/archive/statis", archiveStatis)
  108. income.GET("/archive/section", archiveSection)
  109. income.GET("/archive/top", archiveTop)
  110. income.GET("/bgm/detail", bgmDetail)
  111. income.POST("/archive/black", archiveBlack)
  112. income.POST("/archive/breach", archiveBreach)
  113. income.GET("/up/withdraw", upWithdraw)
  114. income.GET("/up/withdraw/export", upWithdrawExport)
  115. income.GET("/up/withdraw/statis", upWithdrawStatis)
  116. income.GET("/up/withdraw/detail", upWithdrawDetail)
  117. income.GET("/up/withdraw/detail/export", upWithdrawDetailExport)
  118. income.GET("/breach/list", breachList)
  119. income.GET("/breach/statis", breachStatis)
  120. income.GET("/breach/export", exportBreach)
  121. income.GET("/black/list", queryBlacklist)
  122. income.GET("/black/export", exportBlack)
  123. income.POST("/black/recover", recoverBlacklist)
  124. }
  125. notice := b.Group("/notice")
  126. {
  127. notice.GET("/list", notices)
  128. notice.POST("/add", insertNotice)
  129. notice.POST("/update", updateNotice)
  130. }
  131. cheat := b.Group("/cheat")
  132. {
  133. cheat.GET("/up", cheatUps)
  134. cheat.GET("/av", cheatArchives)
  135. cheat.GET("/export/up", exportCheatUps)
  136. cheat.GET("/export/av", exportCheatAvs)
  137. cheat.GET("/up/fans", queryCheatFans)
  138. cheat.POST("/up/info", cheatFans)
  139. }
  140. charge := b.Group("/charge")
  141. {
  142. charge.GET("/archive/statis", archiveChargeStatis)
  143. charge.GET("/archive/section", archiveChargeSection)
  144. charge.GET("/archive/detail", archiveChargeDetail)
  145. charge.GET("/bgm/detail", bgmChargeDetail)
  146. charge.GET("/up/ratio", upRatio)
  147. }
  148. b.POST("/upload", upload)
  149. budget := b.Group("/budget")
  150. {
  151. budget.GET("/day/info", budgetDayStatistics)
  152. budget.GET("/day/graph", budgetDayGraph)
  153. budget.GET("/month/info", budgetMonthStatistics)
  154. }
  155. banner := b.Group("/banner")
  156. {
  157. banner.GET("/list", banners)
  158. banner.POST("/add", addBanner)
  159. banner.POST("/edit", editBanner)
  160. banner.POST("/off", off)
  161. }
  162. activity := b.Group("/activity")
  163. {
  164. activity.POST("/add", activityAdd)
  165. activity.GET("/list", activityList)
  166. activity.POST("/update", activityUpdate)
  167. activity.GET("/sign_up", activitySignUp)
  168. activity.GET("/winners", activityWinners)
  169. activity.POST("/award", activityAward)
  170. }
  171. auto := b.Group("/auto")
  172. {
  173. auto.POST("/archive/breach", autoBreach)
  174. auto.POST("/up/dismiss", autoDismiss)
  175. auto.POST("/up/forbid", autoForbid)
  176. }
  177. offlineActivity := b.Group("/offlineactivity")
  178. {
  179. offlineActivity.POST("/add", offlineactivityAdd)
  180. offlineActivity.POST("/pre_add", offlineactivityPreAdd)
  181. offlineActivity.POST("/upload", uploadLocal)
  182. offlineActivity.GET("/query/activity", offlineactivityQueryActivity)
  183. offlineActivity.GET("/query/upbonus_summary", offlineactivityQueryUpBonusSummary)
  184. offlineActivity.GET("/query/upbonus_activity", offlineactivityQueryUpBonusActivity)
  185. offlineActivity.GET("/query/month", offlineactivityQueryMonth)
  186. }
  187. // 激励金兑换
  188. trade := b.Group("/trade")
  189. {
  190. // goods query
  191. trade.GET("/goods/list", goodsList)
  192. // goods mng
  193. trade.GET("/goods/sync", goodsSync)
  194. trade.POST("/goods/update", goodsUpdate)
  195. trade.POST("/goods/display_set", goodsDisplay)
  196. // order query
  197. trade.GET("/order/list", orderList)
  198. trade.GET("/order/export", orderExport)
  199. trade.GET("/order/statistics", orderStatistics)
  200. }
  201. // 专项奖
  202. award := b.Group("/special_award")
  203. {
  204. award.POST("/add", awardAdd) //新增专项奖
  205. award.POST("/update", awardUpdate) //编辑专项奖
  206. award.GET("/list", awardList) //专项奖列表
  207. award.GET("/detail", awardDetail) //专项奖详情
  208. award.GET("/winner/list", awardWinnerList) //获奖者列表
  209. award.GET("/winner/export", awardWinnerExport) //获奖者导出
  210. award.POST("/winner/replace", awardWinnerReplace) //获奖者替换
  211. award.GET("/result", awardResult) //评奖信息查询
  212. award.POST("/result/save", awardResultSave) //评奖信息录入
  213. }
  214. // 在api.bilibili.co域名下,建议迁移到service
  215. api := r.Group("/x/internal/growup")
  216. {
  217. api.GET("/offlineactivity/callback", offlineactivityShellCallback)
  218. }
  219. }