蛋蛋星球 后台端
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

router.go 7.9 KiB

1 mês atrás
2 semanas atrás
1 semana atrás
2 semanas atrás
1 semana atrás
6 dias atrás
1 semana atrás
1 mês atrás
3 semanas atrás
1 mês atrás
3 semanas atrás
1 mês atrás
3 semanas atrás
1 mês atrás
2 semanas atrás
5 dias atrás
2 semanas atrás
5 dias atrás
2 semanas atrás
1 semana atrás
6 dias atrás
1 semana atrás
1 semana atrás
1 semana atrás
2 semanas atrás
2 semanas atrás
2 semanas atrás
2 semanas atrás
5 dias atrás
1 semana atrás
1 semana atrás
1 semana atrás
1 mês atrás
1 semana atrás
1 semana atrás
1 semana atrás
1 semana atrás
1 semana atrás
4 dias atrás
1 semana atrás
1 semana atrás
1 semana atrás
1 semana atrás
1 semana atrás
5 dias atrás
1 semana atrás
1 semana atrás
6 dias atrás
1 semana atrás
1 semana atrás
1 mês atrás
6 dias atrás
6 dias atrás
6 dias atrás
5 dias atrás
5 dias atrás
5 dias atrás
5 dias atrás
5 dias atrás
5 dias atrás
5 dias atrás
5 dias atrás
6 dias atrás
2 semanas atrás
1 semana atrás
2 semanas atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. package router
  2. import (
  3. "applet/app/cfg"
  4. "applet/app/hdl"
  5. "applet/app/hdl/comm"
  6. "applet/app/hdl/institutional_management/egg_energy"
  7. "applet/app/hdl/institutional_management/public_platoon"
  8. "applet/app/hdl/marketing_applications/new_user_red_package"
  9. "applet/app/hdl/member_center"
  10. "applet/app/hdl/setCenter/oss/aliyun"
  11. "applet/app/mw"
  12. _ "applet/docs"
  13. "github.com/gin-gonic/gin"
  14. swaggerFiles "github.com/swaggo/files"
  15. ginSwagger "github.com/swaggo/gin-swagger"
  16. )
  17. // 初始化路由
  18. func Init() *gin.Engine {
  19. // debug, release, test 项目阶段
  20. mode := "release"
  21. if cfg.Debug {
  22. mode = "debug"
  23. }
  24. gin.SetMode(mode)
  25. //创建一个新的启动器
  26. r := gin.New()
  27. r.GET("/api/swagger/*any", func(c *gin.Context) {
  28. // r.Use(mw.SwagAuth())
  29. ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "SWAGGER")(c)
  30. })
  31. // 是否打印访问日志, 在非正式环境都打印
  32. if mode != "release" {
  33. r.Use(gin.Logger())
  34. }
  35. r.Use(gin.Recovery())
  36. r.GET("/favicon.ico", func(c *gin.Context) {
  37. c.Status(204)
  38. })
  39. r.NoRoute(func(c *gin.Context) {
  40. c.JSON(404, gin.H{"code": 404, "msg": "page not found", "data": []struct{}{}})
  41. })
  42. r.NoMethod(func(c *gin.Context) {
  43. c.JSON(405, gin.H{"code": 405, "msg": "method not allowed", "data": []struct{}{}})
  44. })
  45. r.Use(mw.Cors)
  46. route(r.Group("/api"))
  47. return r
  48. }
  49. func route(r *gin.RouterGroup) {
  50. r.GET("/test", hdl.Demo)
  51. r.POST("/login", hdl.Login)
  52. r.Use(mw.Auth) // 以下接口需要JWT验证
  53. rComm(r.Group("/comm"))
  54. r.Use(mw.CheckPermission) // 检测权限
  55. rInstitutionalManagement(r.Group("/institutionalManagement"))
  56. rMarketingApplications(r.Group("/marketingApplications"))
  57. rMemberCenter(r.Group("/memberCenter"))
  58. rSettCenter(r.Group("/settCenter"))
  59. }
  60. func rSettCenter(r *gin.RouterGroup) { //设置中心
  61. rOss := r.Group("/oss") //oss设置
  62. {
  63. rOssAliYun := rOss.Group("/aliYun") //阿里云
  64. {
  65. rOssAliYun.GET("/getBasic", aliyun.GetBasic)
  66. rOssAliYun.POST("/setBasic", aliyun.SetBasic)
  67. }
  68. }
  69. }
  70. func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理
  71. rPublicPlatoon := r.Group("/publicPlatoon") //公排设置
  72. {
  73. rPublicPlatoon.GET("/getBasic", public_platoon.GetPublicPlatoonBasic)
  74. rPublicPlatoon.PUT("/updateBasic", public_platoon.UpdatePublicPlatoonBasic)
  75. rPublicPlatoon.GET("/relationshipMap", public_platoon.GetRelationshipMap)
  76. rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap)
  77. rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap)
  78. rPublicPlatoon.POST("/exchangeUserPosition", public_platoon.ExchangeUserPosition)
  79. rPublicPlatoon.POST("/selectMember", public_platoon.SelectMember)
  80. rPublicPlatoonUserFreePunish := rPublicPlatoon.Group("/publicPlatoonUserFreePunish")
  81. {
  82. rPublicPlatoonUserFreePunish.POST("/index", public_platoon.GetFreePublishUser)
  83. rPublicPlatoonUserFreePunish.POST("/save", public_platoon.AddFreePublishUser)
  84. rPublicPlatoonUserFreePunish.DELETE("/delete", public_platoon.DeleteFreePublishUser)
  85. }
  86. rCommunityDividends := rPublicPlatoon.Group("/communityDividends")
  87. {
  88. rCommunityDividends.POST("/communityDividendsList", public_platoon.ListCommunityDividends)
  89. rCommunityDividends.POST("/communityDividendsAdd", public_platoon.AddCommunityDividends)
  90. rCommunityDividends.POST("/communityDividendsWithUserList", public_platoon.ListCommunityDividendsWithUser)
  91. rCommunityDividends.POST("/communityDividendsWithUserAdd", public_platoon.AddCommunityDividendsWithUser)
  92. }
  93. rUserDailyActivityAnalysis := rPublicPlatoon.Group("/userDailyActivityAnalysis")
  94. {
  95. rUserDailyActivityAnalysis.POST("/index", public_platoon.UserDailyActivityAnalysis)
  96. }
  97. }
  98. rEggEnergy := r.Group("/eggEnergy") //蛋蛋能量
  99. {
  100. rEggEnergy.GET("/getVirtualCoinList", egg_energy.GetVirtualCoinList)
  101. rEggEnergy.GET("/getBasic", egg_energy.GetEggEnergyBasic)
  102. rEggEnergy.POST("/updateBasic", egg_energy.UpdateEggEnergyBasic)
  103. rEggEnergy.GET("/getVipSetting", egg_energy.GetEggEnergyVipSetting)
  104. rEggEnergy.POST("/addVipSetting", egg_energy.AddEggEnergyVipSetting)
  105. rEggEnergy.POST("/updateVipSetting", egg_energy.UpdateEggEnergyVipSetting)
  106. rEggEnergyUserCoin := rEggEnergy.Group("/userCoin")
  107. {
  108. rEggEnergyUserCoin.POST("/eggEnergyUserCoinList", egg_energy.GetEggEnergyUserCoinList)
  109. rEggEnergyUserCoin.POST("/eggEnergyUserCoinFlowList", egg_energy.GetEggEnergyUserCoinFlowList)
  110. rEggEnergyUserCoin.POST("/eggPointsUserCoinList", egg_energy.GetEggPointsUserCoinList)
  111. rEggEnergyUserCoin.POST("/getEggPointsUserCoinFlowList", egg_energy.GetEggPointsUserCoinFlowList)
  112. }
  113. rEggEnergyAvailableEnergy := rEggEnergy.Group("/availableEnergy")
  114. {
  115. rEggEnergyAvailableEnergy.POST("/list", egg_energy.DynamicDataFlowList)
  116. }
  117. rEggGlobalData := rEggEnergy.Group("/globalData")
  118. {
  119. rEggGlobalData.GET("/coreDataList", egg_energy.GetEggCoreDataList)
  120. rEggGlobalData.GET("/pointsCenterPriceCurve", egg_energy.GetPriceCurve)
  121. rEggGlobalData.POST("/fundDataList", egg_energy.GetFundDataList)
  122. rEggGlobalData.POST("/fundDataRecordList", egg_energy.GetFundDataRecordList)
  123. rEggGlobalData.POST("/fundDataAdd", egg_energy.AddFundData)
  124. }
  125. rPlatformRevenue := rEggEnergy.Group("/platformRevenue")
  126. {
  127. rPlatformRevenue.POST("/getVideoReward", egg_energy.GetVideoReward)
  128. rPlatformRevenue.POST("/setVideoReward", egg_energy.SetVideoReward)
  129. rPlatformRevenue.POST("/platformRevenueList", egg_energy.ListPlatformRevenue)
  130. rPlatformRevenue.POST("/platformRevenueAdd", egg_energy.AddPlatformRevenue)
  131. }
  132. rEggPoint := rEggEnergy.Group("/eggPoint")
  133. {
  134. rEggPoint.POST("/userEggIndex", egg_energy.UserEggIndex)
  135. rEggPoint.POST("/statisticsUserEggIndex", egg_energy.StatisticsUserEggIndex)
  136. rEggPoint.POST("/userEggFlow", egg_energy.UserEggFlow)
  137. rEggPoint.POST("/manualScore", egg_energy.ManualScore)
  138. }
  139. }
  140. }
  141. func rMarketingApplications(r *gin.RouterGroup) { //营销应用
  142. rNewUserRedPackage := r.Group("/newUserRedPackage") //新人红包
  143. {
  144. rNewUserRedPackage.GET("/getBasic", new_user_red_package.NewUserRedPackageGetBasic)
  145. rNewUserRedPackage.PUT("/updateBasic", new_user_red_package.NewUserRedPackageUpdateBasic)
  146. rNewUserRedPackage.POST("/recordList", new_user_red_package.NewUserRedPackageRecordList)
  147. rNewUserRedPackage.POST("/recordFlowList", new_user_red_package.NewUserRedPackageRecordFlowList)
  148. }
  149. }
  150. func rMemberCenter(r *gin.RouterGroup) { // 会员中心
  151. rUserManagement := r.Group("/userManagement")
  152. {
  153. rUserManagement.POST("/getUserList", member_center.UserManagementGetUserList)
  154. rUserManagement.GET("/userData", member_center.UserManagementGetOneBasic)
  155. rUserManagement.POST("/updateUserInfo", member_center.UserManagementUpdateUserInfo)
  156. rUserManagement.GET("/getFans", member_center.UserManagementGetFans)
  157. rUserManagement.GET("/balanceDetail", member_center.UserManagementGetBalanceDetail)
  158. rUserManagement.GET("/getVirtualCoinDetail", member_center.UserManagementGetVirtualCoinDetail)
  159. }
  160. rTagManagement := r.Group("/tagManagement")
  161. {
  162. rTagManagement.GET("/getTagList", member_center.GetTagList)
  163. rTagManagement.POST("/addTag", member_center.AddTag)
  164. rTagManagement.POST("/updateTag", member_center.UpdateTag)
  165. rTagManagement.DELETE("/deleteTag", member_center.DeleteTag)
  166. }
  167. rLevelManagement := r.Group("/levelManagement")
  168. {
  169. rLevelManagement.GET("/getLevelList", member_center.GetLevelList)
  170. rLevelManagement.GET("/getOneLevel", member_center.GetOneLevel)
  171. rLevelManagement.POST("/updateLevel", member_center.UpdateLevel)
  172. rLevelManagement.POST("/addLevel", member_center.AddLevel)
  173. rLevelManagement.DELETE("/deleteLevel", member_center.DeleteLevel)
  174. rLevelManagement.POST("/addLevelTask", member_center.AddLevelTask)
  175. rLevelManagement.POST("/updateLevelTask", member_center.UpdateLevelTask)
  176. rLevelManagement.DELETE("/deleteLevelTask", member_center.DeleteLevelTask)
  177. }
  178. }
  179. func rComm(r *gin.RouterGroup) {
  180. r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表
  181. r.GET("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL
  182. }