蛋蛋星球 后台端
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

router.go 6.7 KiB

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