智慧食堂
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

admin_router.go 8.5 KiB

hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
hace 1 año
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. package router
  2. import (
  3. hdl2 "applet/app/admin/hdl"
  4. hdl "applet/app/admin/hdl/enterprise_manage"
  5. "applet/app/admin/mw"
  6. "applet/app/cfg"
  7. "github.com/gin-gonic/gin"
  8. )
  9. // Init 初始化路由
  10. func Init() *gin.Engine {
  11. mode := "release"
  12. if cfg.Debug {
  13. mode = "debug"
  14. }
  15. gin.SetMode(mode)
  16. //创建一个新的启动器
  17. r := gin.New()
  18. // 是否打印访问日志, 在非正式环境都打印
  19. if mode != "release" {
  20. r.Use(gin.Logger())
  21. }
  22. r.Use(gin.Recovery())
  23. r.GET("/favicon.ico", func(c *gin.Context) {
  24. c.Status(204)
  25. })
  26. r.NoRoute(func(c *gin.Context) {
  27. c.JSON(404, gin.H{"code": 404, "msg": "page not found", "data": []struct{}{}})
  28. })
  29. r.NoMethod(func(c *gin.Context) {
  30. c.JSON(405, gin.H{"code": 405, "msg": "method not allowed", "data": []struct{}{}})
  31. })
  32. r.Use(mw.Cors)
  33. AdminRoute(r.Group("/api/admin"))
  34. CustomerInit(r.Group("/api/v1"))
  35. return r
  36. }
  37. func rCompany(r *gin.RouterGroup) {
  38. r.GET("/list", hdl2.CompanyList)
  39. r.POST("/add", hdl2.CompanyAdd)
  40. r.POST("/update", hdl2.CompanyUpdate)
  41. r.DELETE("/delete/:id", hdl2.CompanyDelete)
  42. }
  43. func rNotice(r *gin.RouterGroup) {
  44. r.GET("/list", hdl2.NoticeList)
  45. r.POST("/add", hdl2.NoticeAdd)
  46. r.POST("/sort", hdl2.NoticeSort)
  47. r.POST("/update", hdl2.NoticeUpdate)
  48. r.DELETE("/delete/:id", hdl2.NoticeUpdate)
  49. }
  50. func rBanner(r *gin.RouterGroup) {
  51. r.GET("/list", hdl2.BannerList)
  52. r.POST("/add", hdl2.BannerAdd)
  53. r.POST("/sort", hdl2.BannerSort)
  54. r.POST("/update", hdl2.BannerUpdate)
  55. r.DELETE("/delete/:id", hdl2.BannerDelete)
  56. }
  57. func rComm(r *gin.RouterGroup) {
  58. r.POST("/getMenuList", hdl2.MenuList) // 获取菜单栏列表
  59. }
  60. func rOss(r *gin.RouterGroup) {
  61. r.POST("/upload/token", hdl2.ImgReqUpload) // 文件上传获取七牛云上传token
  62. }
  63. func rSetCenter(r *gin.RouterGroup) {
  64. r.GET("/get", hdl2.GetCenter) // 设置中心-获取
  65. r.POST("/set", hdl2.SetCenter) // 设置中心-设置
  66. }
  67. func rAuditCenter(r *gin.RouterGroup) {
  68. r.POST("/centralKitchenForSchoolOrderRefundList", hdl2.CentralKitchenForSchoolOrderRefundList) //审核中心-央厨-学校-订单退款列表
  69. r.POST("/centralKitchenForSchoolOrderRefundAudit", hdl2.CentralKitchenForSchoolOrderRefundAudit) //审核中心-央厨-学校-订单退款审核
  70. }
  71. func rFinanceManage(r *gin.RouterGroup) {
  72. r.POST("/centralKitchenForSchool/ordList", hdl.CentralKitchenForSchoolOrdList) //财务管理-(央厨-学校)订单列表
  73. r.GET("/centralKitchenForSchool/ordDetail", hdl.CentralKitchenForSchoolOrdDetail) //财务管理-(央厨-学校)订单详情
  74. r.POST("/centralKitchenForSchool/ordRefund", hdl.CentralKitchenForSchoolOrdRefund) //财务管理-(央厨-学校)订单退款
  75. }
  76. func rUser(r *gin.RouterGroup) {
  77. r.POST("/list", hdl2.UserList) //列表
  78. r.POST("/update", hdl2.UserUpdate) //编辑
  79. r.DELETE("/delete/:id", hdl2.UserDelete) //删除
  80. }
  81. func rEnterprise(r *gin.RouterGroup) {
  82. r.POST("/list", hdl2.EnterpriseList)
  83. r.POST("/add", hdl2.EnterpriseAdd)
  84. r.POST("/update", hdl2.EnterpriseUpdate)
  85. r.POST("/delete", hdl2.EnterpriseDelete)
  86. r.POST("/updateState", hdl2.EnterpriseUpdateState)
  87. r.POST("/addGrade", hdl2.EnterpriseAddGrade)
  88. r.GET("/detail", hdl2.Detail)
  89. r.GET("/schoolBelowGrade", hdl2.SchoolBelowGrade) //"学校"下年级
  90. r.GET("/schoolGradeBelowClass", hdl2.SchoolGradeBelowClass) //"学校"年级下班级
  91. }
  92. func rEnterpriseManage(r *gin.RouterGroup) {
  93. r.GET("/info", hdl.EnterpriseManageInfo) //校企管理信息
  94. r.POST("/userIdentityList", hdl.UserIdentityList) //用户列表
  95. r.POST("/centralKitchenForSchool/userUpdate", hdl.CentralKitchenForSchoolUserUpdate) //"央厨-学校"用户编辑
  96. r.POST("/centralKitchenForSchool/userDelete", hdl.CentralKitchenForSchoolUserDelete) //"央厨-学校"用户删除
  97. r.POST("/centralKitchenForSchool/studentList", hdl.CentralKitchenForSchoolStudentList) //"央厨-学校"学生列表
  98. r.POST("/centralKitchenForSchool/studentUpdate", hdl.CentralKitchenForSchoolStudentUpdate) //"央厨-学校"学生编辑
  99. r.POST("/centralKitchenForSchool/studentDelete", hdl.CentralKitchenForSchoolStudentDelete) //"央厨-学校"学生删除
  100. r.POST("/centralKitchenForSchool/studentAdmission", hdl.CentralKitchenForSchoolStudentAdmission) //"央厨-学校"学生升学
  101. r.POST("/centralKitchenForSchool/teacherList", hdl.CentralKitchenForSchoolTeacherList) //"央厨-学校"教师列表
  102. r.POST("/centralKitchenForSchool/teacherUpdate", hdl.CentralKitchenForSchoolTeacherUpdate) //"央厨-学校"教师编辑
  103. r.POST("/centralKitchenForSchool/teacherDelete", hdl.CentralKitchenForSchoolTeacherDelete) //"央厨-学校"教师删除
  104. r.POST("/centralKitchenForSchool/ordList", hdl.CentralKitchenForSchoolOrdList) //"央厨-学校"订单列表
  105. r.GET("/centralKitchenForSchool/ordDetail", hdl.CentralKitchenForSchoolOrdDetail) //"央厨-学校"订单详情
  106. r.POST("/centralKitchenForSchool/ordRefund", hdl.CentralKitchenForSchoolOrdRefund) //"央厨-学校"订单退款
  107. r.POST("/centralKitchenForSchoolOrderRefundList", hdl2.CentralKitchenForSchoolOrderRefundList) //"央厨-学校"订单退款列表
  108. //r.POST("/centralKitchenForSchoolOrderRefundAudit", hdl2.CentralKitchenForSchoolOrderRefundAudit) //"央厨-学校"订单退款审核
  109. r.POST("/setBasicCentralKitchenForSchool", hdl.SetBasicCentralKitchenForSchool) //"央厨-学校"设置基础设置
  110. r.GET("/getBasicCentralKitchenForSchool", hdl.GetBasicCentralKitchenForSchool) //"央厨-学校"获取基础设置
  111. r.POST("/setCentralKitchenForSchoolWithSpec", hdl.SetCentralKitchenForSchoolWithSpec) //设置"央厨-学校-规格"
  112. r.GET("/getCentralKitchenForSchoolWithSpec", hdl.GetCentralKitchenForSchoolWithSpec) //获取"央厨-学校-规格"
  113. r.POST("/listCentralKitchenForSchoolPackage", hdl.ListCentralKitchenForSchoolPackage) //"央厨-学校-套餐" 列表
  114. r.GET("/detailCentralKitchenForSchoolPackage", hdl.DetailCentralKitchenForSchoolPackage) //"央厨-学校-套餐" 详情
  115. r.POST("/saveCentralKitchenForSchoolPackage", hdl.SaveCentralKitchenForSchoolPackage) //新增/编辑 "央厨-学校-套餐"
  116. r.DELETE("/deleteCentralKitchenForSchoolPackage/:id", hdl.DeleteCentralKitchenForSchoolPackage) //删除 "央厨-学校-套餐"
  117. r.POST("/selfSupportForSchool/studentList", hdl.CentralKitchenForSchoolStudentList) //"央厨-学校"学生列表
  118. }
  119. func rRole(r *gin.RouterGroup) {
  120. r.GET("/roleList", hdl2.RoleList) //角色列表
  121. r.POST("/addRole", hdl2.AddRole) //角色添加
  122. r.POST("/roleBindPermissionGroup", hdl2.RoleBindPermissionGroup) //角色绑定权限组
  123. r.POST("/updateRoleState", hdl2.UpdateRoleState) //修改角色状态
  124. r.POST("/updateRole", hdl2.UpdateRole) //修改角色状态
  125. r.DELETE("/deleteRole/:id", hdl2.DeleteRole) //删除角色
  126. r.GET("/permissionGroupList", hdl2.PermissionGroupList) //权限组列表
  127. r.POST("/adminList", hdl2.AdminList) //管理员列表
  128. r.POST("/updateAdminState", hdl2.UpdateAdminState) //修改管理员状态
  129. r.POST("/updateAdmin", hdl2.UpdateAdmin) //修改管理员信息
  130. r.POST("/addAdmin", hdl2.AddAdmin) //新增管理员
  131. r.DELETE("/deleteAdmin/:adm_id", hdl2.DeleteAdmin) //删除管理员
  132. r.GET("/adminInfo", hdl2.AdminInfo) //获取管理员信息
  133. r.POST("/bindAdminRole", hdl2.BindAdminRole) //绑定角色
  134. }
  135. func AdminRoute(r *gin.RouterGroup) {
  136. r.POST("/login", hdl2.Login)
  137. r.Use(mw.Auth) //检测登录状态
  138. r.GET("/demo", hdl2.Demo)
  139. r.GET("/userInfo", hdl2.UserInfo) //用户信息
  140. r.Any("/changePwd", hdl2.Demo) //修改密码
  141. r.GET("/sysCfg", hdl2.GetSysCfg) //基础配置-获取
  142. r.Use(mw.CheckPermission) //检测权限
  143. rOss(r.Group("/oss"))
  144. rComm(r.Group("/comm"))
  145. rCompany(r.Group("/company")) //公司管理
  146. rNotice(r.Group("/notice")) //公告管理
  147. rBanner(r.Group("/banner")) //轮播图管理
  148. rEnterprise(r.Group("/enterprise")) //校企管理
  149. rEnterpriseManage(r.Group("/enterpriseManage")) //校企管理详情
  150. rRole(r.Group("/role")) //权限管理
  151. rSetCenter(r.Group("/setCenter")) //设置中心
  152. rUser(r.Group("/user")) //用户管理
  153. rAuditCenter(r.Group("/auditCenter")) //审核中心
  154. rFinanceManage(r.Group("/financeManage")) //财务管理
  155. }