You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
Go
28 lines
1.1 KiB
Go
package router
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"insure/api/manage"
|
|
"insure/router/middleware"
|
|
"insure/utils/result"
|
|
)
|
|
|
|
func adminRouteInit(r *gin.Engine) {
|
|
manageGroup := r.Group("/manage")
|
|
manageGroup.Use(middleware.CorsMiddleware("manage"))
|
|
manageGroup.Match([]string{"POST", "OPTIONS"}, "/login", result.Json(manage.Login))
|
|
|
|
authGroup := manageGroup.Group("")
|
|
authGroup.Use(middleware.JwtMiddleware("admin"))
|
|
{
|
|
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-admin-info", result.Json(manage.GetAdminInfo))
|
|
authGroup.Match([]string{"POST", "OPTIONS"}, "/logout", result.Json(manage.Logout))
|
|
authGroup.Match([]string{"POST", "OPTIONS"}, "/add-admin", result.Json(manage.AddAdmin))
|
|
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-orders", result.Json(manage.GetOrders))
|
|
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-order", result.Json(manage.GetOrder))
|
|
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-orders", manage.DownloadOrders)
|
|
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-infos", result.Json(manage.GetInfos))
|
|
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-infos", manage.DownloadInfos)
|
|
}
|
|
}
|