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

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