正在显示
3 个修改的文件
包含
36 行增加
和
21 行删除
@@ -14,6 +14,18 @@ info( | @@ -14,6 +14,18 @@ info( | ||
14 | group: common | 14 | group: common |
15 | ) | 15 | ) |
16 | service Core { | 16 | service Core { |
17 | + @doc "日志查询" | ||
18 | + @handler commonGetLog | ||
19 | + get /log/:module | ||
20 | +} | ||
21 | + | ||
22 | +// 通用接口 | ||
23 | +@server( | ||
24 | + prefix: v1 | ||
25 | + middleware: LogRequest | ||
26 | + group: common | ||
27 | +) | ||
28 | +service Core { | ||
17 | @doc "短信验证码" | 29 | @doc "短信验证码" |
18 | @handler commonSmsCode | 30 | @handler commonSmsCode |
19 | post /common/sms/code (CommonSmsCodeRequest) returns (CommonSmsCodeResposne) | 31 | post /common/sms/code (CommonSmsCodeRequest) returns (CommonSmsCodeResposne) |
@@ -22,10 +34,6 @@ service Core { | @@ -22,10 +34,6 @@ service Core { | ||
22 | @handler miniQrcodeInvite | 34 | @handler miniQrcodeInvite |
23 | post /mini/qrcode (MiniQrCodeRequest) | 35 | post /mini/qrcode (MiniQrCodeRequest) |
24 | 36 | ||
25 | - @doc "日志查询" | ||
26 | - @handler commonGetLog | ||
27 | - get /log/:module | ||
28 | - | ||
29 | @doc "清理缓存" | 37 | @doc "清理缓存" |
30 | @handler commonGetClearCache | 38 | @handler commonGetClearCache |
31 | get /clear | 39 | get /clear |
@@ -44,7 +52,6 @@ type( | @@ -44,7 +52,6 @@ type( | ||
44 | type( | 52 | type( |
45 | MiniQrCodeRequest{ | 53 | MiniQrCodeRequest{ |
46 | Page string `json:"page"` // 微信页面入口 | 54 | Page string `json:"page"` // 微信页面入口 |
47 | - Path string `json:"path"` // | ||
48 | Scene string `json:"scene"` // 参数 | 55 | Scene string `json:"scene"` // 参数 |
49 | } | 56 | } |
50 | ) | 57 | ) |
@@ -22,25 +22,10 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -22,25 +22,10 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
22 | server.AddRoutes( | 22 | server.AddRoutes( |
23 | []rest.Route{ | 23 | []rest.Route{ |
24 | { | 24 | { |
25 | - Method: http.MethodPost, | ||
26 | - Path: "/common/sms/code", | ||
27 | - Handler: common.CommonSmsCodeHandler(serverCtx), | ||
28 | - }, | ||
29 | - { | ||
30 | - Method: http.MethodPost, | ||
31 | - Path: "/mini/qrcode", | ||
32 | - Handler: common.MiniQrcodeInviteHandler(serverCtx), | ||
33 | - }, | ||
34 | - { | ||
35 | Method: http.MethodGet, | 25 | Method: http.MethodGet, |
36 | Path: "/log/:module", | 26 | Path: "/log/:module", |
37 | Handler: common.CommonGetLogHandler(serverCtx), | 27 | Handler: common.CommonGetLogHandler(serverCtx), |
38 | }, | 28 | }, |
39 | - { | ||
40 | - Method: http.MethodGet, | ||
41 | - Path: "/clear", | ||
42 | - Handler: common.CommonGetClearCacheHandler(serverCtx), | ||
43 | - }, | ||
44 | }, | 29 | }, |
45 | rest.WithPrefix("/v1"), | 30 | rest.WithPrefix("/v1"), |
46 | ) | 31 | ) |
@@ -51,6 +36,30 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -51,6 +36,30 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
51 | []rest.Route{ | 36 | []rest.Route{ |
52 | { | 37 | { |
53 | Method: http.MethodPost, | 38 | Method: http.MethodPost, |
39 | + Path: "/common/sms/code", | ||
40 | + Handler: common.CommonSmsCodeHandler(serverCtx), | ||
41 | + }, | ||
42 | + { | ||
43 | + Method: http.MethodPost, | ||
44 | + Path: "/mini/qrcode", | ||
45 | + Handler: common.MiniQrcodeInviteHandler(serverCtx), | ||
46 | + }, | ||
47 | + { | ||
48 | + Method: http.MethodGet, | ||
49 | + Path: "/clear", | ||
50 | + Handler: common.CommonGetClearCacheHandler(serverCtx), | ||
51 | + }, | ||
52 | + }..., | ||
53 | + ), | ||
54 | + rest.WithPrefix("/v1"), | ||
55 | + ) | ||
56 | + | ||
57 | + server.AddRoutes( | ||
58 | + rest.WithMiddlewares( | ||
59 | + []rest.Middleware{serverCtx.LogRequest}, | ||
60 | + []rest.Route{ | ||
61 | + { | ||
62 | + Method: http.MethodPost, | ||
54 | Path: "/article_comment", | 63 | Path: "/article_comment", |
55 | Handler: comment.MiniCreateArticleCommentHandler(serverCtx), | 64 | Handler: comment.MiniCreateArticleCommentHandler(serverCtx), |
56 | }, | 65 | }, |
@@ -10,7 +10,6 @@ type CommonSmsCodeResposne struct { | @@ -10,7 +10,6 @@ type CommonSmsCodeResposne struct { | ||
10 | 10 | ||
11 | type MiniQrCodeRequest struct { | 11 | type MiniQrCodeRequest struct { |
12 | Page string `json:"page"` // 微信页面入口 | 12 | Page string `json:"page"` // 微信页面入口 |
13 | - Path string `json:"path"` // | ||
14 | Scene string `json:"scene"` // 参数 | 13 | Scene string `json:"scene"` // 参数 |
15 | } | 14 | } |
16 | 15 |
-
请 注册 或 登录 后发表评论