蛋蛋星球 后台端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

333 行
13 KiB

  1. package router
  2. import (
  3. "applet/app/cfg"
  4. "applet/app/hdl"
  5. "applet/app/hdl/advertising"
  6. "applet/app/hdl/article"
  7. "applet/app/hdl/cloud_bundle"
  8. "applet/app/hdl/comm"
  9. "applet/app/hdl/financial_center"
  10. "applet/app/hdl/im"
  11. "applet/app/hdl/institutional_management/egg_energy"
  12. "applet/app/hdl/institutional_management/module_setting"
  13. "applet/app/hdl/institutional_management/public_platoon"
  14. "applet/app/hdl/marketing_applications/new_user_red_package"
  15. "applet/app/hdl/member_center"
  16. "applet/app/hdl/notice"
  17. "applet/app/hdl/setCenter/oss/aliyun"
  18. "applet/app/hdl/user_feedback"
  19. "applet/app/mw"
  20. _ "applet/docs"
  21. "github.com/gin-gonic/gin"
  22. swaggerFiles "github.com/swaggo/files"
  23. ginSwagger "github.com/swaggo/gin-swagger"
  24. )
  25. // 初始化路由
  26. func Init() *gin.Engine {
  27. // debug, release, test 项目阶段
  28. mode := "release"
  29. if cfg.Debug {
  30. mode = "debug"
  31. }
  32. gin.SetMode(mode)
  33. //创建一个新的启动器
  34. r := gin.New()
  35. r.GET("/api/swagger/*any", func(c *gin.Context) {
  36. // r.Use(mw.SwagAuth())
  37. ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "SWAGGER")(c)
  38. })
  39. // 是否打印访问日志, 在非正式环境都打印
  40. if mode != "release" {
  41. r.Use(gin.Logger())
  42. }
  43. r.Use(gin.Recovery())
  44. r.GET("/favicon.ico", func(c *gin.Context) {
  45. c.Status(204)
  46. })
  47. r.NoRoute(func(c *gin.Context) {
  48. c.JSON(404, gin.H{"code": 404, "msg": "page not found", "data": []struct{}{}})
  49. })
  50. r.NoMethod(func(c *gin.Context) {
  51. c.JSON(405, gin.H{"code": 405, "msg": "method not allowed", "data": []struct{}{}})
  52. })
  53. r.Use(mw.Cors)
  54. route(r.Group("/api"))
  55. return r
  56. }
  57. func route(r *gin.RouterGroup) {
  58. r.GET("/test", hdl.Demo)
  59. r.POST("/login", hdl.Login)
  60. {
  61. //打包机调用,不需要校验
  62. r.GET("/cloudBundle/base", cloud_bundle.Base) //打包基本信息
  63. r.GET("/cloudBundle/update/state", cloud_bundle.UpdateState) //打包更新状态
  64. r.GET("/cloudBundle/upload", cloud_bundle.Upload) //打包 上传apk
  65. }
  66. r.Use(mw.Auth) // 以下接口需要JWT验证
  67. rComm(r.Group("/comm"))
  68. r.GET("/config", hdl.Config)
  69. rIm(r.Group("/im"))
  70. r.Use(mw.CheckPermission) // 检测权限
  71. rInstitutionalManagement(r.Group("/institutionalManagement"))
  72. rMarketingApplications(r.Group("/marketingApplications"))
  73. rMemberCenter(r.Group("/memberCenter"))
  74. rHomePage(r.Group("/homePage"))
  75. rSettCenter(r.Group("/settCenter"))
  76. rFinancialCenter(r.Group("/financialCenter"))
  77. rAdvertising(r.Group("/advertising"))
  78. rNotice(r.Group("/notice"))
  79. rArticle(r.Group("/article"))
  80. rUserFeedback(r.Group("/userFeedback"))
  81. rCloudBundle(r.Group("/cloudBundle")) //云打包
  82. }
  83. func rSettCenter(r *gin.RouterGroup) { //设置中心
  84. rOss := r.Group("/oss") //oss设置
  85. {
  86. rOssAliYun := rOss.Group("/aliYun") //阿里云
  87. {
  88. rOssAliYun.GET("/getBasic", aliyun.GetBasic)
  89. rOssAliYun.POST("/setBasic", aliyun.SetBasic)
  90. }
  91. }
  92. }
  93. func rHomePage(r *gin.RouterGroup) {
  94. r.GET("/totalData", hdl.GetTotalData)
  95. r.GET("/activeData", hdl.GetActiveData)
  96. r.GET("/growData", hdl.GetGrowData)
  97. }
  98. func rAdvertising(r *gin.RouterGroup) {
  99. r.GET("/getBasic", advertising.GetBasic)
  100. r.POST("/setBasic", advertising.SetBasic)
  101. r.POST("/list", advertising.List)
  102. r.POST("/save", advertising.Save)
  103. r.POST("/del", advertising.Del)
  104. r.GET("/getLimit", advertising.GetLimit)
  105. r.POST("/setLimit", advertising.SetLimit)
  106. r.POST("/function/list", advertising.FunctionList)
  107. r.POST("/function/save", advertising.FunctionSave)
  108. r.POST("/function/del", advertising.FunctionDel)
  109. }
  110. func rNotice(r *gin.RouterGroup) {
  111. rBase := r.Group("/base") //极光
  112. {
  113. rBase.POST("/list", notice.List)
  114. rBase.POST("/save", notice.Save)
  115. rBase.POST("/del", notice.Del)
  116. }
  117. rJpush := r.Group("/jPush") //极光
  118. {
  119. rJpush.POST("/push/list", notice.PushList)
  120. rJpush.POST("/push/save", notice.PushSave)
  121. }
  122. rAliyunSms := r.Group("/aliyunSms") //阿里云短信
  123. {
  124. rAliyunSms.POST("/file/phone", notice.AliyunSmsFilePhone)
  125. rAliyunSms.GET("/sale/base", notice.AliyunSmsSaleBase)
  126. rAliyunSms.POST("/sale/save", notice.AliyunSmsSaleSave)
  127. rAliyunSms.POST("/push/list", notice.AliyunSmsPushList)
  128. rAliyunSms.POST("/push/save", notice.AliyunSmsPushSave)
  129. }
  130. }
  131. func rArticle(r *gin.RouterGroup) { //文章
  132. rCate := r.Group("/cate") //
  133. {
  134. rCate.POST("/list", article.CateList)
  135. rCate.POST("/save", article.CateSave)
  136. rCate.POST("/del", article.CateDel)
  137. }
  138. rContent := r.Group("/content") //
  139. {
  140. rContent.POST("/list", article.List)
  141. rContent.POST("/save", article.Save)
  142. rContent.POST("/del", article.Del)
  143. }
  144. }
  145. func rUserFeedback(r *gin.RouterGroup) { //用户反馈
  146. rCate := r.Group("/cate") //
  147. {
  148. rCate.POST("/list", user_feedback.CateList)
  149. rCate.POST("/save", user_feedback.CateSave)
  150. rCate.POST("/del", user_feedback.CateDel)
  151. }
  152. rContent := r.Group("/content") //
  153. {
  154. rContent.POST("/list", user_feedback.List)
  155. rContent.POST("/record/list", user_feedback.RecordList)
  156. rContent.POST("/say", user_feedback.Say)
  157. rContent.POST("/change/state", user_feedback.ChangeState)
  158. rContent.POST("/del", user_feedback.Del)
  159. }
  160. }
  161. func rCloudBundle(r *gin.RouterGroup) { //云打包
  162. r.POST("/list", cloud_bundle.List)
  163. r.POST("/build", cloud_bundle.Build)
  164. r.POST("/del", cloud_bundle.Del)
  165. r.POST("/audit/set", cloud_bundle.AuditSet)
  166. r.POST("/audit/clear", cloud_bundle.AuditClear)
  167. r.GET("/img/base", cloud_bundle.ImgBase)
  168. r.POST("/img/base/save", cloud_bundle.ImgBaseSave)
  169. r.GET("/version/base", cloud_bundle.VersionBase)
  170. r.POST("/version/base/save", cloud_bundle.VersionBaseSave)
  171. }
  172. func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理
  173. rPublicPlatoon := r.Group("/publicPlatoon") //公排设置
  174. {
  175. rPublicPlatoon.GET("/getBasic", public_platoon.GetPublicPlatoonBasic)
  176. rPublicPlatoon.PUT("/updateBasic", public_platoon.UpdatePublicPlatoonBasic)
  177. rPublicPlatoon.GET("/relationshipMap", public_platoon.GetRelationshipMap)
  178. rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap)
  179. rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap)
  180. rPublicPlatoon.POST("/exchangeUserPosition", public_platoon.ExchangeUserPosition)
  181. rPublicPlatoon.POST("/selectMember", public_platoon.SelectMember)
  182. rPublicPlatoonUserFreePunish := rPublicPlatoon.Group("/publicPlatoonUserFreePunish")
  183. {
  184. rPublicPlatoonUserFreePunish.POST("/index", public_platoon.GetFreePublishUser)
  185. rPublicPlatoonUserFreePunish.POST("/save", public_platoon.AddFreePublishUser)
  186. rPublicPlatoonUserFreePunish.DELETE("/delete", public_platoon.DeleteFreePublishUser)
  187. }
  188. rCommunityDividends := rPublicPlatoon.Group("/communityDividends")
  189. {
  190. rCommunityDividends.POST("/communityDividendsList", public_platoon.ListCommunityDividends)
  191. rCommunityDividends.POST("/communityDividendsAdd", public_platoon.AddCommunityDividends)
  192. rCommunityDividends.POST("/communityDividendsWithUserList", public_platoon.ListCommunityDividendsWithUser)
  193. rCommunityDividends.POST("/communityDividendsWithUserAdd", public_platoon.AddCommunityDividendsWithUser)
  194. }
  195. rUserDailyActivityAnalysis := rPublicPlatoon.Group("/userDailyActivityAnalysis")
  196. {
  197. rUserDailyActivityAnalysis.POST("/index", public_platoon.UserDailyActivityAnalysis)
  198. }
  199. }
  200. rEggEnergy := r.Group("/eggEnergy") //蛋蛋能量
  201. {
  202. rEggEnergy.GET("/getVirtualCoinList", egg_energy.GetVirtualCoinList)
  203. rEggEnergy.GET("/getBasic", egg_energy.GetEggEnergyBasic)
  204. rEggEnergy.POST("/updateBasic", egg_energy.UpdateEggEnergyBasic)
  205. rEggEnergy.GET("/getVipSetting", egg_energy.GetEggEnergyVipSetting)
  206. rEggEnergy.POST("/addVipSetting", egg_energy.AddEggEnergyVipSetting)
  207. rEggEnergy.POST("/updateVipSetting", egg_energy.UpdateEggEnergyVipSetting)
  208. rEggEnergyUserCoin := rEggEnergy.Group("/userCoin")
  209. {
  210. rEggEnergyUserCoin.POST("/eggEnergyUserCoinList", egg_energy.GetEggEnergyUserCoinList)
  211. rEggEnergyUserCoin.POST("/eggEnergyUserCoinFlowList", egg_energy.GetEggEnergyUserCoinFlowList)
  212. rEggEnergyUserCoin.POST("/eggPointsUserCoinList", egg_energy.GetEggPointsUserCoinList)
  213. rEggEnergyUserCoin.POST("/getEggPointsUserCoinFlowList", egg_energy.GetEggPointsUserCoinFlowList)
  214. }
  215. rEggEnergyAvailableEnergy := rEggEnergy.Group("/availableEnergy")
  216. {
  217. rEggEnergyAvailableEnergy.POST("/list", egg_energy.DynamicDataFlowList)
  218. }
  219. rEggGlobalData := rEggEnergy.Group("/globalData")
  220. {
  221. rEggGlobalData.GET("/coreDataList", egg_energy.GetEggCoreDataList)
  222. rEggGlobalData.GET("/pointsCenterPriceCurve", egg_energy.GetPriceCurve)
  223. rEggGlobalData.POST("/fundDataList", egg_energy.GetFundDataList)
  224. rEggGlobalData.POST("/fundDataRecordList", egg_energy.GetFundDataRecordList)
  225. rEggGlobalData.POST("/fundDataAdd", egg_energy.AddFundData)
  226. }
  227. rPlatformRevenue := rEggEnergy.Group("/platformRevenue")
  228. {
  229. rPlatformRevenue.POST("/getVideoReward", egg_energy.GetVideoReward)
  230. rPlatformRevenue.POST("/setVideoReward", egg_energy.SetVideoReward)
  231. rPlatformRevenue.POST("/platformRevenueList", egg_energy.ListPlatformRevenue)
  232. rPlatformRevenue.POST("/platformRevenueAdd", egg_energy.AddPlatformRevenue)
  233. }
  234. rEggPoint := rEggEnergy.Group("/eggPoint")
  235. {
  236. rEggPoint.POST("/userEggIndex", egg_energy.UserEggIndex)
  237. rEggPoint.POST("/statisticsUserEggIndex", egg_energy.StatisticsUserEggIndex)
  238. rEggPoint.POST("/userEggFlow", egg_energy.UserEggFlow)
  239. rEggPoint.POST("/manualScore", egg_energy.ManualScore)
  240. }
  241. rContributionValue := rEggEnergy.Group("/contributionValue")
  242. {
  243. rContributionValue.GET("/basic", egg_energy.GetContributionValueBasicSetting)
  244. rContributionValue.POST("/updateBasic", egg_energy.UpdateContributionValueBasicSetting)
  245. }
  246. }
  247. rModuleSetting := r.Group("/moduleSetting")
  248. {
  249. rModuleSetting.GET("/getModuleSetting", module_setting.ModuleSettingGet)
  250. rModuleSetting.POST("/updateModuleSetting", module_setting.ModuleSettingUpdate)
  251. }
  252. }
  253. func rMarketingApplications(r *gin.RouterGroup) { //营销应用
  254. rNewUserRedPackage := r.Group("/newUserRedPackage") //新人红包
  255. {
  256. rNewUserRedPackage.GET("/getBasic", new_user_red_package.NewUserRedPackageGetBasic)
  257. rNewUserRedPackage.PUT("/updateBasic", new_user_red_package.NewUserRedPackageUpdateBasic)
  258. rNewUserRedPackage.POST("/recordList", new_user_red_package.NewUserRedPackageRecordList)
  259. rNewUserRedPackage.POST("/recordFlowList", new_user_red_package.NewUserRedPackageRecordFlowList)
  260. }
  261. }
  262. func rMemberCenter(r *gin.RouterGroup) { // 会员中心
  263. rUserManagement := r.Group("/userManagement")
  264. {
  265. rUserManagement.POST("/getUserList", member_center.UserManagementGetUserList)
  266. rUserManagement.GET("/userData", member_center.UserManagementGetOneBasic)
  267. rUserManagement.POST("/updateUserInfo", member_center.UserManagementUpdateUserInfo)
  268. rUserManagement.GET("/getFans", member_center.UserManagementGetFans)
  269. rUserManagement.GET("/balanceDetail", member_center.UserManagementGetBalanceDetail)
  270. rUserManagement.GET("/getVirtualCoinDetail", member_center.UserManagementGetVirtualCoinDetail)
  271. }
  272. rTagManagement := r.Group("/tagManagement")
  273. {
  274. rTagManagement.GET("/getTagList", member_center.GetTagList)
  275. rTagManagement.POST("/addTag", member_center.AddTag)
  276. rTagManagement.POST("/updateTag", member_center.UpdateTag)
  277. rTagManagement.DELETE("/deleteTag", member_center.DeleteTag)
  278. }
  279. rLevelManagement := r.Group("/levelManagement")
  280. {
  281. rLevelManagement.GET("/getLevelList", member_center.GetLevelList)
  282. rLevelManagement.GET("/getOneLevel", member_center.GetOneLevel)
  283. rLevelManagement.POST("/updateLevel", member_center.UpdateLevel)
  284. rLevelManagement.POST("/addLevel", member_center.AddLevel)
  285. rLevelManagement.DELETE("/deleteLevel", member_center.DeleteLevel)
  286. rLevelManagement.POST("/addLevelTask", member_center.AddLevelTask)
  287. rLevelManagement.POST("/updateLevelTask", member_center.UpdateLevelTask)
  288. rLevelManagement.DELETE("/deleteLevelTask", member_center.DeleteLevelTask)
  289. }
  290. }
  291. func rIm(r *gin.RouterGroup) {
  292. r.GET("/getBasic", im.GetBasic)
  293. r.POST("/setBasic", im.SetBasic)
  294. r.POST("/pageEmoticon", im.PageEmoticon)
  295. r.POST("/addEmoticon", im.AddEmoticon)
  296. r.POST("/setEmoticonState", im.SetEmoticonState)
  297. r.POST("/updateEmoticon", im.UpdateEmoticon)
  298. r.POST("/deleteEmoticon", im.DeleteEmoticon)
  299. r.POST("/pageCustomerService", im.PageCustomerService)
  300. r.POST("/addCustomerService", im.AddCustomerService)
  301. r.POST("/setCustomerServiceState", im.SetCustomerServiceState)
  302. r.POST("/updateCustomerServiceMemo", im.UpdateCustomerServiceMemo)
  303. r.GET("/redPackageRecordsDetail", im.RedPackageRecordsDetail)
  304. r.POST("/pageSendRedPackageOrd", im.PageSendRedPackageOrd)
  305. r.POST("/groupList", im.GroupList)
  306. r.POST("/groupUserList", im.GroupUserList)
  307. r.POST("/batchSendGroupMessage", im.BatchSendGroupMessage)
  308. r.POST("/batchSendUserMessage", im.BatchSendUserMessage)
  309. }
  310. func rFinancialCenter(r *gin.RouterGroup) {
  311. rWithdraw := r.Group("/withdraw")
  312. {
  313. rWithdraw.GET("/setting", financial_center.GetWithdrawSetting)
  314. rWithdraw.POST("/updateWithdrawSetting", financial_center.UpdateWithdrawSetting)
  315. rWithdraw.GET("/applyList", financial_center.GetWithdrawApplyList)
  316. }
  317. }
  318. func rComm(r *gin.RouterGroup) {
  319. r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表
  320. r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL
  321. }