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

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