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

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