Files
bj_power/bj_power_mes/internal/handler/routes.go
T

78 lines
1.8 KiB
Go
Raw Normal View History

// 最小骨架版 MES:仅保留 登录 + 当前用户 + 产品类型 + 工单 + PLC 传工序号。
package handler
import (
"net/http"
login "bj_power_mes/internal/handler/login"
product_type "bj_power_mes/internal/handler/product_type"
user "bj_power_mes/internal/handler/user"
workorder "bj_power_mes/internal/handler/workorder"
"bj_power_mes/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
// 登录
Method: http.MethodPost,
Path: "/login",
Handler: login.LoginHandler(serverCtx),
},
{
// 刷新token
Method: http.MethodPost,
Path: "/refreshToken",
Handler: login.RefreshTokenHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// 退出登录
Method: http.MethodPost,
Path: "/logout",
Handler: login.LogoutHandler(serverCtx),
},
{
// 获取当前登录用户信息
Method: http.MethodGet,
Path: "/userinfo",
Handler: user.UserinfoHandler(serverCtx),
},
{
// 查询工单分页列表
Method: http.MethodGet,
Path: "/work-orders",
Handler: workorder.QueryWorkOrdersHandler(serverCtx),
},
{
// 获取工单详情
Method: http.MethodGet,
Path: "/work-orders/:id",
Handler: workorder.GetWorkOrderHandler(serverCtx),
},
{
// 创建工单
Method: http.MethodPost,
Path: "/work-orders",
Handler: workorder.CreateWorkOrderHandler(serverCtx),
},
{
// 获取产品类型列表
Method: http.MethodGet,
Path: "/product-types/list",
Handler: product_type.ListProductTypesHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/api/v1"),
)
}