蛋蛋星球 后台端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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