作者 yangfu

二维码

... ... @@ -14,6 +14,18 @@ info(
group: common
)
service Core {
@doc "日志查询"
@handler commonGetLog
get /log/:module
}
// 通用接口
@server(
prefix: v1
middleware: LogRequest
group: common
)
service Core {
@doc "短信验证码"
@handler commonSmsCode
post /common/sms/code (CommonSmsCodeRequest) returns (CommonSmsCodeResposne)
... ... @@ -22,10 +34,6 @@ service Core {
@handler miniQrcodeInvite
post /mini/qrcode (MiniQrCodeRequest)
@doc "日志查询"
@handler commonGetLog
get /log/:module
@doc "清理缓存"
@handler commonGetClearCache
get /clear
... ... @@ -44,7 +52,6 @@ type(
type(
MiniQrCodeRequest{
Page string `json:"page"` // 微信页面入口
Path string `json:"path"` //
Scene string `json:"scene"` // 参数
}
)
\ No newline at end of file
... ...
... ... @@ -22,25 +22,10 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/common/sms/code",
Handler: common.CommonSmsCodeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/qrcode",
Handler: common.MiniQrcodeInviteHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/log/:module",
Handler: common.CommonGetLogHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/clear",
Handler: common.CommonGetClearCacheHandler(serverCtx),
},
},
rest.WithPrefix("/v1"),
)
... ... @@ -51,6 +36,30 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
[]rest.Route{
{
Method: http.MethodPost,
Path: "/common/sms/code",
Handler: common.CommonSmsCodeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/qrcode",
Handler: common.MiniQrcodeInviteHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/clear",
Handler: common.CommonGetClearCacheHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/article_comment",
Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
},
... ...
... ... @@ -10,7 +10,6 @@ type CommonSmsCodeResposne struct {
type MiniQrCodeRequest struct {
Page string `json:"page"` // 微信页面入口
Path string `json:"path"` //
Scene string `json:"scene"` // 参数
}
... ...