305 lines
7.9 KiB
Plaintext
305 lines
7.9 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "核心服务"
|
|
desc: "核心服务"
|
|
author: "landaiqing"
|
|
email: "landaiqing@126.com"
|
|
version: "v1.0.0"
|
|
)
|
|
|
|
// 登录请求参数
|
|
type (
|
|
// 账户登录请求参数
|
|
AccountLoginRequest {
|
|
Account string `json:"account"`
|
|
Password string `json:"password"`
|
|
AutoLogin bool `json:"auto_login"`
|
|
Angle int64 `json:"angle"`
|
|
Key string `json:"key"`
|
|
}
|
|
// 手机号登录请求参数
|
|
PhoneLoginRequest {
|
|
Phone string `json:"phone"`
|
|
Captcha string `json:"captcha"`
|
|
AutoLogin bool `json:"auto_login"`
|
|
}
|
|
// 重置密码请求参数
|
|
ResetPasswordRequest {
|
|
Phone string `json:"phone"`
|
|
Captcha string `json:"captcha"`
|
|
Password string `json:"password"`
|
|
Repassword string `json:"repassword"`
|
|
}
|
|
// 登录响应参数
|
|
LoginResponse {
|
|
AccessToken string `json:"access_token"`
|
|
UID string `json:"uid"`
|
|
Username string `json:"username,omitempty"`
|
|
Nickname string `json:"nickname"`
|
|
Avatar string `json:"avatar"`
|
|
Status int8 `json:"status"`
|
|
}
|
|
)
|
|
|
|
// OAuth请求参数
|
|
type (
|
|
// OAuth请求参数
|
|
OAuthRequest {
|
|
state string `form:"state"`
|
|
}
|
|
// OAuth回调请求参数
|
|
OAuthCallbackRequest {
|
|
Code string `form:"code"`
|
|
}
|
|
OAuthWechatRequest {
|
|
client_id string `form:"client_id"`
|
|
}
|
|
)
|
|
|
|
// 短信发送请求参数
|
|
type (
|
|
SmsSendRequest {
|
|
Phone string `json:"phone"`
|
|
Angle int64 `json:"angle"`
|
|
Key string `json:"key"`
|
|
}
|
|
)
|
|
|
|
// 评论请求参数
|
|
type (
|
|
// 评论提交请求参数
|
|
CommentRequest {
|
|
Content string `json:"content"`
|
|
Images []string `json:"images,optional"`
|
|
TopicId string `json:"topic_id"`
|
|
Author string `json:"author"`
|
|
Key string `json:"key"`
|
|
Point []int64 `json:"point"`
|
|
}
|
|
// 回复评论提交请求参数
|
|
ReplyCommentRequest {
|
|
Content string `json:"content"`
|
|
Images []string `json:"images,optional"`
|
|
TopicId string `json:"topic_id" `
|
|
ReplyId int64 `json:"reply_id" `
|
|
ReplyUser string `json:"reply_user" `
|
|
Author string `json:"author"`
|
|
Key string `json:"key"`
|
|
Point []int64 `json:"point"`
|
|
}
|
|
// 回复回复请求参数
|
|
ReplyReplyRequest {
|
|
Content string `json:"content"`
|
|
Images []string `json:"images,optional"`
|
|
TopicId string `json:"topic_id"`
|
|
ReplyTo int64 `json:"reply_to"`
|
|
ReplyId int64 `json:"reply_id"`
|
|
ReplyUser string `json:"reply_user" `
|
|
Author string `json:"author"`
|
|
Key string `json:"key"`
|
|
Point []int64 `json:"point"`
|
|
}
|
|
// 评论列表请求参数
|
|
CommentListRequest {
|
|
TopicId string `json:"topic_id"`
|
|
Page int `json:"page,default=1,optional"`
|
|
Size int `json:"size,default=5,optional"`
|
|
IsHot bool `json:"is_hot,default=true,optional"`
|
|
}
|
|
// 回复列表请求参数
|
|
ReplyListRequest {
|
|
TopicId string `json:"topic_id"`
|
|
CommentId int64 `json:"comment_id"`
|
|
Page int `json:"page,default=1,optional"`
|
|
Size int `json:"size,default=5,optional"`
|
|
}
|
|
// 点赞评论的请求参数
|
|
CommentLikeRequest {
|
|
TopicId string `json:"topic_id"`
|
|
CommentId int64 `json:"comment_id"`
|
|
}
|
|
CommentDisLikeRequest {
|
|
TopicId string `json:"topic_id"`
|
|
CommentId int64 `json:"comment_id"`
|
|
}
|
|
)
|
|
|
|
// 统一响应参数
|
|
type (
|
|
Response {
|
|
Code int64 `json:"code"`
|
|
Message string `json:"message"`
|
|
Data interface{} `json:"data,optional"`
|
|
}
|
|
)
|
|
|
|
// 用户服务
|
|
@server (
|
|
group: user // 微服务分组
|
|
prefix: /api/user // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: true // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service core {
|
|
// 账户登录
|
|
@handler accountLogin
|
|
post /login (AccountLoginRequest) returns (Response)
|
|
|
|
// 手机号登录
|
|
@handler phoneLogin
|
|
post /phone/login (PhoneLoginRequest) returns (Response)
|
|
|
|
// 重置密码
|
|
@handler resetPassword
|
|
post /reset/password (ResetPasswordRequest) returns (Response)
|
|
|
|
@handler refreshToken
|
|
post /token/refresh returns (Response)
|
|
|
|
@handler getUserDevice
|
|
get /device
|
|
}
|
|
|
|
// 客户端服务
|
|
@server (
|
|
group: client // 微服务分组
|
|
prefix: /api/client // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service core {
|
|
@handler generateClientId
|
|
get /generate returns (Response)
|
|
}
|
|
|
|
@server (
|
|
group: websocket // 微服务分组
|
|
prefix: /api/ws // 微服务前缀
|
|
)
|
|
service core {
|
|
@handler qrcodeWebsocket
|
|
get /qrcode
|
|
|
|
@handler messageWebsocket
|
|
get /message
|
|
}
|
|
|
|
@server (
|
|
group: oauth // 微服务分组
|
|
prefix: /api/oauth // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service core {
|
|
@handler getGiteeOauthUrl
|
|
get /gitee/url returns (Response)
|
|
|
|
@handler getGithubOauthUrl
|
|
get /github/url (OAuthRequest) returns (Response)
|
|
|
|
@handler getQqOauthUrl
|
|
get /qq/url (OAuthRequest) returns (Response)
|
|
|
|
@handler giteeCallback
|
|
get /gitee/callback (OAuthCallbackRequest)
|
|
|
|
@handler githubCallback
|
|
get /github/callback (OAuthCallbackRequest)
|
|
|
|
@handler qqCallback
|
|
get /qq/callback (OAuthCallbackRequest)
|
|
|
|
@handler wechatCallback
|
|
get /wechat/callback
|
|
|
|
@handler getWechatQrcode
|
|
get /wechat/qrcode (OAuthWechatRequest) returns (Response)
|
|
}
|
|
|
|
@server (
|
|
group: sms // 微服务分组
|
|
prefix: /api/sms // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service core {
|
|
@handler sendSmsByAliyun
|
|
post /ali/send (SmsSendRequest) returns (Response)
|
|
|
|
@handler sendSmsBySmsbao
|
|
post /smsbao/send (SmsSendRequest) returns (Response)
|
|
|
|
@handler sendSmsByTest
|
|
post /test/send (SmsSendRequest) returns (Response)
|
|
}
|
|
|
|
@server (
|
|
group: captcha // 微服务分组
|
|
prefix: /api/captcha // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service core {
|
|
@handler generateRotateCaptcha
|
|
get /rotate/generate returns (Response)
|
|
|
|
@handler generateSlideBasicCaptcha
|
|
get /slide/generate returns (Response)
|
|
}
|
|
|
|
@server (
|
|
group: comment // 微服务分组
|
|
prefix: /api/auth/comment // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: true // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
jwt: Auth // 是否开启jwt验证
|
|
)
|
|
service core {
|
|
@handler getCommentList
|
|
post /list (CommentListRequest) returns (Response)
|
|
|
|
@handler getReplyList
|
|
post /reply/list (ReplyListRequest) returns (Response)
|
|
|
|
@handler submitComment
|
|
post /submit (CommentRequest) returns (Response)
|
|
|
|
@handler submitReplyComment
|
|
post /reply/submit (ReplyCommentRequest) returns (Response)
|
|
|
|
@handler submitReplyReply
|
|
post /reply/reply/submit (ReplyReplyRequest) returns (Response)
|
|
|
|
@handler likeComment
|
|
post /like (CommentLikeRequest) returns (Response)
|
|
|
|
@handler dislikeComment
|
|
post /dislike (CommentDisLikeRequest) returns (Response)
|
|
}
|
|
|