795 lines
20 KiB
Go
795 lines
20 KiB
Go
|
|
// Code generated by goctl. DO NOT EDIT.
|
||
|
|
package handler
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
admin_api "in-server/app/main/api/internal/handler/admin_api"
|
||
|
|
admin_auth "in-server/app/main/api/internal/handler/admin_auth"
|
||
|
|
admin_feature "in-server/app/main/api/internal/handler/admin_feature"
|
||
|
|
admin_menu "in-server/app/main/api/internal/handler/admin_menu"
|
||
|
|
admin_notification "in-server/app/main/api/internal/handler/admin_notification"
|
||
|
|
admin_order "in-server/app/main/api/internal/handler/admin_order"
|
||
|
|
admin_platform_user "in-server/app/main/api/internal/handler/admin_platform_user"
|
||
|
|
admin_product "in-server/app/main/api/internal/handler/admin_product"
|
||
|
|
admin_query "in-server/app/main/api/internal/handler/admin_query"
|
||
|
|
admin_role "in-server/app/main/api/internal/handler/admin_role"
|
||
|
|
admin_role_api "in-server/app/main/api/internal/handler/admin_role_api"
|
||
|
|
admin_user "in-server/app/main/api/internal/handler/admin_user"
|
||
|
|
app "in-server/app/main/api/internal/handler/app"
|
||
|
|
auth "in-server/app/main/api/internal/handler/auth"
|
||
|
|
authorization "in-server/app/main/api/internal/handler/authorization"
|
||
|
|
notification "in-server/app/main/api/internal/handler/notification"
|
||
|
|
product "in-server/app/main/api/internal/handler/product"
|
||
|
|
query "in-server/app/main/api/internal/handler/query"
|
||
|
|
user "in-server/app/main/api/internal/handler/user"
|
||
|
|
"in-server/app/main/api/internal/svc"
|
||
|
|
|
||
|
|
"github.com/zeromicro/go-zero/rest"
|
||
|
|
)
|
||
|
|
|
||
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/admin/api/batch-update-status",
|
||
|
|
Handler: admin_api.AdminBatchUpdateApiStatusHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/admin/api/create",
|
||
|
|
Handler: admin_api.AdminCreateApiHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/admin/api/delete/:id",
|
||
|
|
Handler: admin_api.AdminDeleteApiHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/admin/api/detail/:id",
|
||
|
|
Handler: admin_api.AdminGetApiDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/admin/api/list",
|
||
|
|
Handler: admin_api.AdminGetApiListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/admin/api/update/:id",
|
||
|
|
Handler: admin_api.AdminUpdateApiHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 登录
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/login",
|
||
|
|
Handler: admin_auth.AdminLoginHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1/admin/auth"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/config-example",
|
||
|
|
Handler: admin_feature.AdminConfigFeatureExampleHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_feature.AdminCreateFeatureHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_feature.AdminDeleteFeatureHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_feature.AdminGetFeatureDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/example/:feature_id",
|
||
|
|
Handler: admin_feature.AdminGetFeatureExampleHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_feature.AdminGetFeatureListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_feature.AdminUpdateFeatureHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/feature"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 获取所有菜单(树形结构)
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/all",
|
||
|
|
Handler: admin_menu.GetMenuAllHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 创建菜单
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_menu.CreateMenuHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 删除菜单
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_menu.DeleteMenuHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取菜单详情
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_menu.GetMenuDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取菜单列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_menu.GetMenuListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 更新菜单
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_menu.UpdateMenuHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/menu"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_notification.AdminCreateNotificationHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_notification.AdminDeleteNotificationHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_notification.AdminGetNotificationDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_notification.AdminGetNotificationListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_notification.AdminUpdateNotificationHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/notification"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 创建订单
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_order.AdminCreateOrderHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 删除订单
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_order.AdminDeleteOrderHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取订单详情
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_order.AdminGetOrderDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取订单列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_order.AdminGetOrderListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 订单退款
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/refund/:id",
|
||
|
|
Handler: admin_order.AdminRefundOrderHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 重新执行代理处理
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/retry-agent-process/:id",
|
||
|
|
Handler: admin_order.AdminRetryAgentProcessHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 更新订单
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_order.AdminUpdateOrderHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/order"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_platform_user.AdminCreatePlatformUserHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_platform_user.AdminDeletePlatformUserHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_platform_user.AdminGetPlatformUserDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_platform_user.AdminGetPlatformUserListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_platform_user.AdminUpdatePlatformUserHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/platform_user"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_product.AdminCreateProductHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_product.AdminDeleteProductHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_product.AdminGetProductDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/feature/list/:product_id",
|
||
|
|
Handler: admin_product.AdminGetProductFeatureListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/feature/update/:product_id",
|
||
|
|
Handler: admin_product.AdminUpdateProductFeaturesHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_product.AdminGetProductListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_product.AdminUpdateProductHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/product"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 更新清理配置
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/cleanup/config",
|
||
|
|
Handler: admin_query.AdminUpdateQueryCleanupConfigHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取清理配置列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/cleanup/configs",
|
||
|
|
Handler: admin_query.AdminGetQueryCleanupConfigListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取清理详情列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/cleanup/details/:log_id",
|
||
|
|
Handler: admin_query.AdminGetQueryCleanupDetailListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取清理日志列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/cleanup/logs",
|
||
|
|
Handler: admin_query.AdminGetQueryCleanupLogListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取查询详情
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:order_id",
|
||
|
|
Handler: admin_query.AdminGetQueryDetailByOrderIdHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/query"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 创建角色
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_role.CreateRoleHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 删除角色
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_role.DeleteRoleHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取角色详情
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_role.GetRoleDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取角色列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_role.GetRoleListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 更新角色
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_role.UpdateRoleHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/role"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/admin/api/all",
|
||
|
|
Handler: admin_role_api.AdminGetAllApiListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/admin/role/:role_id/api/list",
|
||
|
|
Handler: admin_role_api.AdminGetRoleApiListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/admin/role/api/assign",
|
||
|
|
Handler: admin_role_api.AdminAssignRoleApiHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/admin/role/api/remove",
|
||
|
|
Handler: admin_role_api.AdminRemoveRoleApiHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/admin/role/api/update",
|
||
|
|
Handler: admin_role_api.AdminUpdateRoleApiHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 创建用户
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/create",
|
||
|
|
Handler: admin_user.AdminCreateUserHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 删除用户
|
||
|
|
Method: http.MethodDelete,
|
||
|
|
Path: "/delete/:id",
|
||
|
|
Handler: admin_user.AdminDeleteUserHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取用户详情
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/detail/:id",
|
||
|
|
Handler: admin_user.AdminGetUserDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 用户信息
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/info",
|
||
|
|
Handler: admin_user.AdminUserInfoHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取用户列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/list",
|
||
|
|
Handler: admin_user.AdminGetUserListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 重置管理员密码
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/reset-password/:id",
|
||
|
|
Handler: admin_user.AdminResetPasswordHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 更新用户
|
||
|
|
Method: http.MethodPut,
|
||
|
|
Path: "/update/:id",
|
||
|
|
Handler: admin_user.AdminUpdateUserHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1/admin/user"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/app/config",
|
||
|
|
Handler: app.GetAppConfigHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/app/version",
|
||
|
|
Handler: app.GetAppVersionHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 心跳检测接口
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/health/check",
|
||
|
|
Handler: app.HealthCheckHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// get mobile verify code
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/auth/sendSms",
|
||
|
|
Handler: auth.SendSmsHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/authorization/document/:documentId",
|
||
|
|
Handler: authorization.GetAuthorizationDocumentHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/authorization/document/order/:orderId",
|
||
|
|
Handler: authorization.GetAuthorizationDocumentByOrderHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/authorization/download/:documentId",
|
||
|
|
Handler: authorization.DownloadAuthorizationDocumentHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// get notifications
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/notification/list",
|
||
|
|
Handler: notification.GetNotificationsHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/:id",
|
||
|
|
Handler: product.GetProductByIDHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/en/:product_en",
|
||
|
|
Handler: product.GetProductByEnHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1/product"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/app_en/:product_en",
|
||
|
|
Handler: product.GetProductAppByEnHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1/product"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// query service agent
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/query/service_agent/:product",
|
||
|
|
Handler: query.QueryServiceAgentHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/query/service_app/:product",
|
||
|
|
Handler: query.QueryServiceAppHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// query service
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/query/service/:product",
|
||
|
|
Handler: query.QueryServiceHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 生成分享链接
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/query/generate_share_link",
|
||
|
|
Handler: query.QueryGenerateShareLinkHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 查询列表
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/query/list",
|
||
|
|
Handler: query.QueryListHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 查询详情 按订单号 付款查询时
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/query/orderId/:order_id",
|
||
|
|
Handler: query.QueryDetailByOrderIdHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 查询详情 按订单号
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/query/orderNo/:order_no",
|
||
|
|
Handler: query.QueryDetailByOrderNoHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 获取查询临时订单
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/query/provisional_order/:id",
|
||
|
|
Handler: query.QueryProvisionalOrderHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 重试查询
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/query/retry/:id",
|
||
|
|
Handler: query.QueryRetryHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 更新查询数据
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/query/update_data",
|
||
|
|
Handler: query.UpdateQueryDataHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 查询示例
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/query/example",
|
||
|
|
Handler: query.QueryExampleHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 查询详情
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/query/share/:id",
|
||
|
|
Handler: query.QueryShareDetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/query/single/test",
|
||
|
|
Handler: query.QuerySingleTestHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// 下载报告 PDF
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/report/pdf",
|
||
|
|
Handler: query.DownloadReportPdfHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// PDF 专用:按订单 ID 获取报告详情(免登录)
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/query/orderId/public/:order_id",
|
||
|
|
Handler: query.QueryDetailByOrderIdPublicHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// unified auth
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/user/auth",
|
||
|
|
Handler: user.AuthHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// password login
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/user/passwordLogin",
|
||
|
|
Handler: user.PasswordLoginHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// wechat mini auth
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/user/wxMiniAuth",
|
||
|
|
Handler: user.WxMiniAuthHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// wechat h5 auth
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/user/wxh5Auth",
|
||
|
|
Handler: user.WxH5AuthHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/wechat/getSignature",
|
||
|
|
Handler: user.GetSignatureHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
rest.WithMiddlewares(
|
||
|
|
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
// 绑定手机号
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/user/bindMobile",
|
||
|
|
Handler: user.BindMobileHandler(serverCtx),
|
||
|
|
},
|
||
|
|
}...,
|
||
|
|
),
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
|
||
|
|
server.AddRoutes(
|
||
|
|
[]rest.Route{
|
||
|
|
{
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/user/cancelOut",
|
||
|
|
Handler: user.CancelOutHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// get user info
|
||
|
|
Method: http.MethodGet,
|
||
|
|
Path: "/user/detail",
|
||
|
|
Handler: user.DetailHandler(serverCtx),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// get new token
|
||
|
|
Method: http.MethodPost,
|
||
|
|
Path: "/user/getToken",
|
||
|
|
Handler: user.GetTokenHandler(serverCtx),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||
|
|
rest.WithPrefix("/api/v1"),
|
||
|
|
)
|
||
|
|
}
|