蛋蛋星球 后台端
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.
 
 
 

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