面包店
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.

admin_router.go 7.2 KiB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
6 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. package router
  2. import (
  3. "applet/app/admin/hdl"
  4. categoryHdl "applet/app/admin/hdl/category"
  5. goodsHdl "applet/app/admin/hdl/goods"
  6. orderHdl "applet/app/admin/hdl/order"
  7. "applet/app/admin/mw"
  8. "applet/app/cfg"
  9. "github.com/gin-gonic/gin"
  10. )
  11. // Init 初始化路由
  12. func Init() *gin.Engine {
  13. mode := "release"
  14. if cfg.Debug {
  15. mode = "debug"
  16. }
  17. gin.SetMode(mode)
  18. //创建一个新的启动器
  19. r := gin.New()
  20. // 是否打印访问日志, 在非正式环境都打印
  21. if mode != "release" {
  22. r.Use(gin.Logger())
  23. }
  24. r.Use(gin.Recovery())
  25. r.GET("/favicon.ico", func(c *gin.Context) {
  26. c.Status(204)
  27. })
  28. r.NoRoute(func(c *gin.Context) {
  29. c.JSON(404, gin.H{"code": 404, "msg": "page not found", "data": []struct{}{}})
  30. })
  31. r.NoMethod(func(c *gin.Context) {
  32. c.JSON(405, gin.H{"code": 405, "msg": "method not allowed", "data": []struct{}{}})
  33. })
  34. r.Use(mw.Cors)
  35. AdminRoute(r.Group("/api/admin"))
  36. IpadInit(r.Group("/api/ipad"))
  37. BigDataInit(r.Group("/api/bigData"))
  38. return r
  39. }
  40. func rCompany(r *gin.RouterGroup) {
  41. r.GET("/list", hdl.CompanyList)
  42. r.POST("/add", hdl.CompanyAdd)
  43. r.POST("/update", hdl.CompanyUpdate)
  44. r.DELETE("/delete/:id", hdl.CompanyDelete)
  45. }
  46. func rHomePage(r *gin.RouterGroup) {
  47. r.GET("/index", hdl.HomeIndex)
  48. r.GET("/operationalDataStatistics", hdl.OperationalDataStatistics)
  49. r.GET("/repayBehaviorAnalysis", hdl.RepayBehaviorAnalysis)
  50. }
  51. func rScheme(r *gin.RouterGroup) {
  52. r.GET("/list", hdl.SchemeList)
  53. r.POST("/add", hdl.AddScheme)
  54. r.POST("/update", hdl.UpdateScheme)
  55. r.POST("/bindEnterprise", hdl.SchemeBindEnterprise)
  56. r.POST("/updateSchemeState", hdl.UpdateSchemeState)
  57. r.DELETE("/delete/:id", hdl.DeleteScheme)
  58. r.GET("/goodsList", goodsHdl.GetMallGoodsList)
  59. r.GET("/goodsDetail", hdl.SchemeGoodsDetail)
  60. r.POST("/saveSchemeGoods", hdl.SaveSchemeGoods)
  61. }
  62. func rComm(r *gin.RouterGroup) {
  63. r.POST("/getMenuList", hdl.MenuList) // 获取菜单栏列表
  64. }
  65. func rOss(r *gin.RouterGroup) {
  66. r.POST("/upload/token", hdl.ImgReqUpload) // 文件上传获取七牛云上传token
  67. }
  68. func rSetCenter(r *gin.RouterGroup) {
  69. r.GET("/get", hdl.GetCenter) // 设置中心-获取
  70. r.POST("/set", hdl.SetCenter) // 设置中心-设置
  71. }
  72. func rStaff(r *gin.RouterGroup) {
  73. r.POST("/list", hdl.StaffList)
  74. r.POST("/delete", hdl.StaffDelete)
  75. r.POST("/add", hdl.StaffAdd)
  76. r.POST("/update", hdl.StaffUpdate)
  77. }
  78. func rEnterprise(r *gin.RouterGroup) {
  79. r.POST("/list", hdl.EnterpriseList)
  80. r.POST("/add", hdl.EnterpriseAdd)
  81. r.POST("/update", hdl.EnterpriseUpdate)
  82. r.POST("/updateState", hdl.EnterpriseUpdateState)
  83. r.POST("/delete", hdl.EnterpriseDelete)
  84. }
  85. func rCategory(r *gin.RouterGroup) {
  86. r.GET("/list", categoryHdl.List)
  87. r.GET("/add", categoryHdl.Add)
  88. r.GET("/del", categoryHdl.Del)
  89. r.POST("/sort", categoryHdl.Sort)
  90. r.POST("/save", categoryHdl.Save)
  91. }
  92. func rGoods(r *gin.RouterGroup) {
  93. r.POST("/del", goodsHdl.DelMallGoods)
  94. r.POST("/add", goodsHdl.AddMallGoods)
  95. r.GET("/detail", goodsHdl.GetGoodsDetail)
  96. r.GET("/list", goodsHdl.GetMallGoodsList)
  97. r.GET("/checkSkuCode", goodsHdl.CheckSkuCode)
  98. r.POST("/change-sale-state", goodsHdl.ChangeSaleState)
  99. }
  100. func rRole(r *gin.RouterGroup) {
  101. r.GET("/roleList", hdl.RoleList) //角色列表
  102. r.POST("/addRole", hdl.AddRole) //角色添加
  103. r.POST("/roleBindPermissionGroup", hdl.RoleBindPermissionGroup) //角色绑定权限组
  104. r.POST("/updateRoleState", hdl.UpdateRoleState) //修改角色状态
  105. r.POST("/updateRole", hdl.UpdateRole) //修改角色
  106. r.DELETE("/deleteRole/:id", hdl.DeleteRole) //删除角色
  107. r.GET("/permissionGroupList", hdl.PermissionGroupList) //权限组列表
  108. r.POST("/adminList", hdl.AdminList) //管理员列表
  109. r.POST("/updateAdminState", hdl.UpdateAdminState) //修改管理员状态
  110. r.POST("/updateAdmin", hdl.UpdateAdmin) //修改管理员信息
  111. r.POST("/addAdmin", hdl.AddAdmin) //新增管理员
  112. r.DELETE("/deleteAdmin/:adm_id", hdl.DeleteAdmin) //删除管理员
  113. r.GET("/adminInfo", hdl.AdminInfo) //获取管理员信息
  114. r.POST("/bindAdminRole", hdl.BindAdminRole) //绑定角色
  115. }
  116. func rGoodsPay(r *gin.RouterGroup) {
  117. r.POST("/enterpriseList", hdl.EnterpriseList) //校企列表
  118. r.GET("/goodsList", goodsHdl.GetMallGoodsListByPay) //商品列表
  119. r.POST("/calcAmount", orderHdl.GoodsPayCalcAmount) //商品下单计算价格
  120. r.POST("/create", orderHdl.GoodsPayCreate) //商品下单
  121. }
  122. func rOrder(r *gin.RouterGroup) {
  123. r.POST("/list", orderHdl.OrderList) //用户订单
  124. r.POST("/total", orderHdl.OrderTotal) //用户订单统计
  125. r.POST("/cancel", orderHdl.OrderCancel) //用户订单取消
  126. r.POST("/detail", orderHdl.OrderDetail) //用户订单详情
  127. r.POST("/output", orderHdl.OrderOutput) //用户订单导出
  128. r.POST("/goods/output", orderHdl.OrderGoodsOutput) //用户订单导出
  129. r.POST("/del", orderHdl.OrderDel) //用户订单商品删除
  130. r.POST("/edit", orderHdl.OrderEdit) //用户订单修改购买人信息
  131. r.POST("/editNum", orderHdl.OrderEditNum) //用户订单修改订单数
  132. r.POST("/addSku", orderHdl.OrderAddSku) //用户订单修改订单数
  133. r.POST("/addNum", orderHdl.OrderAddNum) //用户订单增加数量
  134. r.POST("/deductNum", orderHdl.OrderDeductNum) //用户订单减少数量
  135. r.POST("/makeRecord", orderHdl.MarkRecord) //制作记录
  136. r.POST("/notice", orderHdl.NoticeList) //公告
  137. r.POST("/notice_save", orderHdl.NoticeSave) //公告
  138. r.POST("/notice_del", orderHdl.NoticeDel) //公告
  139. }
  140. func rDataStatistics(r *gin.RouterGroup) {
  141. r.POST("/list", hdl.DataStatisticsList) //列表
  142. r.POST("/export", hdl.DataStatisticsExport) //导出
  143. r.POST("/delete", hdl.DataStatisticsDelete) //删除
  144. }
  145. func rFinanceManage(r *gin.RouterGroup) {
  146. r.POST("/list", orderHdl.OrderList) //用户订单
  147. r.POST("/export", orderHdl.OrderExport) //用户订单导出
  148. r.POST("/total", orderHdl.OrderTotal) //用户订单统计
  149. }
  150. func AdminRoute(r *gin.RouterGroup) {
  151. r.GET("/demo", hdl.Demo)
  152. r.POST("/login", hdl.Login)
  153. r.Use(mw.Auth) //检测登录状态
  154. r.GET("/userInfo", hdl.UserInfo) //用户信息
  155. r.GET("/sysCfg", hdl.GetSysCfg) //基础配置-获取
  156. rOss(r.Group("/oss"))
  157. rComm(r.Group("/comm"))
  158. r.Use(mw.CheckPermission) //检测权限
  159. rHomePage(r.Group("/homePage")) //首页
  160. rCompany(r.Group("/company")) //公司管理
  161. rScheme(r.Group("/scheme")) //方案管理
  162. rEnterprise(r.Group("/enterprise")) //校企
  163. rCategory(r.Group("/category")) //商品类目
  164. rGoods(r.Group("/goods")) //商品
  165. rRole(r.Group("/role")) //权限管理
  166. rSetCenter(r.Group("/setCenter")) //设置中心
  167. rStaff(r.Group("/staff")) //员工管理
  168. rGoodsPay(r.Group("/goodsPay")) //商品下单
  169. rOrder(r.Group("/order")) //用户订单
  170. rFinanceManage(r.Group("/financeManage")) //财务管理
  171. rDataStatistics(r.Group("/dataStatistics")) //数据统计
  172. }