蛋蛋星球 后台端
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

router.go 6.3 KiB

hace 4 semanas
hace 2 semanas
hace 1 semana
hace 2 semanas
hace 1 semana
hace 5 días
hace 1 semana
hace 4 semanas
hace 3 semanas
hace 4 semanas
hace 3 semanas
hace 4 semanas
hace 3 semanas
hace 4 semanas
hace 2 semanas
hace 1 semana
hace 2 semanas
hace 1 semana
hace 2 semanas
hace 1 semana
hace 5 días
hace 1 semana
hace 1 semana
hace 1 semana
hace 2 semanas
hace 2 semanas
hace 2 semanas
hace 1 semana
hace 1 semana
hace 1 semana
hace 4 semanas
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 1 semana
hace 5 días
hace 1 semana
hace 1 semana
hace 4 semanas
hace 5 días
hace 2 semanas
hace 1 semana
hace 2 semanas
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. rPublicPlatoonUserFreePunish := rPublicPlatoon.Group("/publicPlatoonUserFreePunish")
  80. {
  81. rPublicPlatoonUserFreePunish.POST("/index", public_platoon.GetFreePublishUser)
  82. rPublicPlatoonUserFreePunish.POST("/save", public_platoon.AddFreePublishUser)
  83. }
  84. rCommunityDividends := rPublicPlatoon.Group("/communityDividends")
  85. {
  86. rCommunityDividends.POST("/communityDividendsList", public_platoon.ListCommunityDividends)
  87. rCommunityDividends.POST("/communityDividendsAdd", public_platoon.AddCommunityDividends)
  88. rCommunityDividends.POST("/communityDividendsWithUserList", public_platoon.ListCommunityDividendsWithUser)
  89. rCommunityDividends.POST("/communityDividendsWithUserAdd", public_platoon.AddCommunityDividendsWithUser)
  90. }
  91. rUserDailyActivityAnalysis := rPublicPlatoon.Group("/userDailyActivityAnalysis")
  92. {
  93. rUserDailyActivityAnalysis.POST("/index", public_platoon.UserDailyActivityAnalysis)
  94. }
  95. }
  96. rEggEnergy := r.Group("/eggEnergy") //蛋蛋能量
  97. {
  98. rEggEnergy.GET("/getVirtualCoinList", egg_energy.GetVirtualCoinList)
  99. rEggEnergy.GET("/getBasic", egg_energy.GetEggEnergyBasic)
  100. rEggEnergy.POST("/updateBasic", egg_energy.UpdateEggEnergyBasic)
  101. rEggEnergyUserCoin := rEggEnergy.Group("/userCoin")
  102. {
  103. rEggEnergyUserCoin.POST("/activePointsUserCoinList", egg_energy.GetActivePointsUserCoinList)
  104. rEggEnergyUserCoin.POST("/activePointsUserCoinFlowList", egg_energy.GetActivePointsUserCoinFlowList)
  105. rEggEnergyUserCoin.POST("/greenEnergyUserCoinList", egg_energy.GetGreenEnergyUserCoinList)
  106. rEggEnergyUserCoin.POST("/greenEnergyUserCoinFlowList", egg_energy.GetGreenEnergyUserCoinFlowList)
  107. }
  108. rEggEnergyAvailableEnergy := rEggEnergy.Group("/availableEnergy")
  109. {
  110. rEggEnergyAvailableEnergy.POST("/list", egg_energy.DynamicDataFlowList)
  111. }
  112. rEggGlobalData := rEggEnergy.Group("/globalData")
  113. {
  114. rEggGlobalData.GET("/coreDataList", egg_energy.GetEggCoreDataList)
  115. rEggGlobalData.GET("/pointsCenterPriceCurve", egg_energy.GetPriceCurve)
  116. rEggGlobalData.POST("/fundDataList", egg_energy.GetFundDataList)
  117. rEggGlobalData.POST("/fundDataRecordList", egg_energy.GetFundDataRecordList)
  118. rEggGlobalData.POST("/fundDataAdd", egg_energy.AddFundData)
  119. }
  120. rPlatformRevenue := rEggEnergy.Group("/platformRevenue")
  121. {
  122. rPlatformRevenue.POST("/setVideoReward", egg_energy.SetVideoReward)
  123. rPlatformRevenue.POST("/platformRevenueList", egg_energy.ListPlatformRevenue)
  124. rPlatformRevenue.POST("/platformRevenueAdd", egg_energy.AddPlatformRevenue)
  125. }
  126. rEggPoint := rEggEnergy.Group("/eggPoint")
  127. {
  128. rEggPoint.POST("/userEggIndex", egg_energy.UserEggIndex)
  129. rEggPoint.POST("/statisticsUserEggIndex", egg_energy.StatisticsUserEggIndex)
  130. rEggPoint.POST("/userEggFlow", egg_energy.UserEggFlow)
  131. rEggPoint.POST("/manualScore", egg_energy.ManualScore)
  132. }
  133. }
  134. }
  135. func rMarketingApplications(r *gin.RouterGroup) { //营销应用
  136. rNewUserRedPackage := r.Group("/newUserRedPackage") //新人红包
  137. {
  138. rNewUserRedPackage.GET("/getBasic", new_user_red_package.NewUserRedPackageGetBasic)
  139. rNewUserRedPackage.PUT("/updateBasic", new_user_red_package.NewUserRedPackageUpdateBasic)
  140. rNewUserRedPackage.POST("/recordList", new_user_red_package.NewUserRedPackageRecordList)
  141. rNewUserRedPackage.POST("/recordFlowList", new_user_red_package.NewUserRedPackageRecordFlowList)
  142. }
  143. }
  144. func rMemberCenter(r *gin.RouterGroup) { // 会员中心
  145. rUserManagement := r.Group("/userManagement")
  146. {
  147. rUserManagement.POST("/getUserList", member_center.UserManagementGetUserList)
  148. //rUserManagement.GET("/userData", member_center.UserManagementGetOneBasic)
  149. rUserManagement.POST("/updateUserInfo", member_center.UserManagementUpdateUserInfo)
  150. }
  151. }
  152. func rComm(r *gin.RouterGroup) {
  153. r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表
  154. r.GET("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL
  155. }