蛋蛋星球 后台端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

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