882 lines
25 KiB
Plaintext
882 lines
25 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"`
|
|
}
|
|
WechatOffiaccountLoginRequest {
|
|
Openid string `json:"openid"`
|
|
ClientId string `json:"client_id"`
|
|
}
|
|
// 登录响应参数
|
|
LoginResponse {
|
|
AccessToken string `json:"access_token"`
|
|
ExpireAt int64 `json:"expire_at"`
|
|
UID string `json:"uid"`
|
|
Username string `json:"username,omitempty"`
|
|
Nickname string `json:"nickname"`
|
|
Avatar string `json:"avatar"`
|
|
Status int64 `json:"status"`
|
|
}
|
|
)
|
|
|
|
// OAuth请求参数
|
|
type (
|
|
// OAuth请求参数
|
|
OAuthRequest {
|
|
state string `form:"state"`
|
|
}
|
|
// OAuth回调请求参数
|
|
OAuthCallbackRequest {
|
|
Code string `form:"code"`
|
|
}
|
|
OAuthWechatRequest {
|
|
clientId string `json:"client_id"`
|
|
}
|
|
)
|
|
|
|
// 短信发送请求参数
|
|
type (
|
|
SmsSendRequest {
|
|
Phone string `json:"phone"`
|
|
Angle int64 `json:"angle"`
|
|
Key string `json:"key"`
|
|
}
|
|
)
|
|
|
|
// 刷新token响应参数
|
|
type (
|
|
RefreshTokenResponse {
|
|
AccessToken string `json:"access_token"`
|
|
ExpireAt int64 `json:"expire_at"`
|
|
}
|
|
)
|
|
|
|
// 验证码响应参数
|
|
type (
|
|
RotateCaptchaResponse {
|
|
Key string `json:"key"`
|
|
Image string `json:"image"`
|
|
Thumb string `json:"thumb"`
|
|
}
|
|
SlideCaptchaResponse {
|
|
Key string `json:"key"`
|
|
Image string `json:"image"`
|
|
Thumb string `json:"thumb"`
|
|
ThumbWidth int64 `json:"thumb_width"`
|
|
ThumbHeight int64 `json:"thumb_height"`
|
|
ThumbX int64 `json:"thumb_x"`
|
|
ThumbY int64 `json:"thumb_y"`
|
|
}
|
|
)
|
|
|
|
// 用户服务
|
|
@server (
|
|
group: user // 微服务分组
|
|
prefix: /api/user // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: true // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service auth {
|
|
// 账户登录
|
|
@handler accountLogin
|
|
post /login (AccountLoginRequest) returns (LoginResponse)
|
|
|
|
// 手机号登录
|
|
@handler phoneLogin
|
|
post /phone/login (PhoneLoginRequest) returns (LoginResponse)
|
|
|
|
// 重置密码
|
|
@handler resetPassword
|
|
post /reset/password (ResetPasswordRequest)
|
|
|
|
// 微信公众号登录
|
|
@handler wechatOffiaccountLogin
|
|
post /wechat/offiaccount/login (WechatOffiaccountLoginRequest) returns (LoginResponse)
|
|
|
|
// 获取微信公众号二维码
|
|
@handler getWechatOffiaccountQrcode
|
|
post /wechat/offiaccount/qrcode (OAuthWechatRequest) returns (string)
|
|
}
|
|
|
|
@server (
|
|
group: token // 微服务分组
|
|
prefix: /api/auth // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: true // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service auth {
|
|
@handler refreshToken
|
|
post /token/refresh returns (RefreshTokenResponse)
|
|
}
|
|
|
|
// 客户端服务
|
|
@server (
|
|
group: client // 微服务分组
|
|
prefix: /api/client // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service auth {
|
|
@handler generateClientId
|
|
get /generate returns (string)
|
|
}
|
|
|
|
@server (
|
|
group: websocket // 微服务分组
|
|
prefix: /api/ws // 微服务前缀
|
|
)
|
|
service auth {
|
|
@handler qrcodeWebsocket
|
|
get /qrcode
|
|
|
|
@handler messageWebsocket
|
|
get /message
|
|
|
|
@handler fileWebsocket
|
|
get /file
|
|
}
|
|
|
|
@server (
|
|
group: oauth // 微服务分组
|
|
prefix: /api/oauth // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service auth {
|
|
@handler getGiteeOauthUrl
|
|
get /gitee/url returns (string)
|
|
|
|
@handler getGithubOauthUrl
|
|
get /github/url (OAuthRequest) returns (string)
|
|
|
|
@handler getQqOauthUrl
|
|
get /qq/url (OAuthRequest) returns (string)
|
|
|
|
@handler giteeCallback
|
|
get /gitee/callback (OAuthCallbackRequest) returns (string)
|
|
|
|
@handler githubCallback
|
|
get /github/callback (OAuthCallbackRequest) returns (string)
|
|
|
|
@handler qqCallback
|
|
get /qq/callback (OAuthCallbackRequest) returns (string)
|
|
|
|
@handler wechatOffiaccountCallback
|
|
post /wechat/offiaccount/callback
|
|
|
|
// important!
|
|
@handler wechatOffiaccountCallbackVerify
|
|
get /wechat/offiaccount/callback
|
|
}
|
|
|
|
@server (
|
|
group: sms // 微服务分组
|
|
prefix: /api/sms // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service auth {
|
|
@handler sendSmsByAliyun
|
|
post /ali/send (SmsSendRequest)
|
|
|
|
@handler sendSmsBySmsbao
|
|
post /smsbao/send (SmsSendRequest)
|
|
|
|
@handler sendSmsByTest
|
|
post /test/send (SmsSendRequest) returns (string)
|
|
}
|
|
|
|
@server (
|
|
group: captcha // 微服务分组
|
|
prefix: /api/captcha // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service auth {
|
|
@handler generateRotateCaptcha
|
|
get /rotate/generate returns (RotateCaptchaResponse)
|
|
|
|
@handler generateSlideBasicCaptcha
|
|
get /slide/generate returns (SlideCaptchaResponse)
|
|
}
|
|
|
|
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 (
|
|
// CommentContent 评论内容
|
|
CommentContent {
|
|
NickName string `json:"nickname"`
|
|
Avatar string `json:"avatar"`
|
|
Level int64 `json:"level,omitempty" default:"0"`
|
|
Id int64 `json:"id"`
|
|
UserId string `json:"user_id"`
|
|
TopicId string `json:"topic_id"`
|
|
Content string `json:"content"`
|
|
ReplyTo int64 `json:"reply_to,omitempty"`
|
|
ReplyId int64 `json:"reply_id,omitempty"`
|
|
ReplyUser string `json:"reply_user,omitempty"`
|
|
ReplyNickname string `json:"reply_nickname,omitempty"`
|
|
IsAuthor int64 `json:"is_author"`
|
|
Likes int64 `json:"likes"`
|
|
ReplyCount int64 `json:"reply_count"`
|
|
CreatedTime string `json:"created_time"`
|
|
Location string `json:"location"`
|
|
Browser string `json:"browser"`
|
|
OperatingSystem string `json:"operating_system"`
|
|
IsLiked bool `json:"is_liked" default:"false"`
|
|
Images string `json:"images,omitempty"`
|
|
}
|
|
// CommentListPageResponse 评论返回值
|
|
CommentListPageResponse {
|
|
Size int `json:"size"`
|
|
Total int64 `json:"total"`
|
|
Current int `json:"current"`
|
|
Comments []CommentContent `json:"comments"`
|
|
}
|
|
// CommentResponse 提交评论响应
|
|
CommentResponse {
|
|
Id int64 `json:"id"`
|
|
Content string `json:"content"`
|
|
UserId string `json:"user_id"`
|
|
TopicId string `json:"topic_id"`
|
|
Author int64 `json:"author"`
|
|
Location string `json:"location"`
|
|
Browser string `json:"browser"`
|
|
OperatingSystem string `json:"operating_system"`
|
|
CreatedTime string `json:"created_time"`
|
|
ReplyId int64 `json:"reply_id,omitempty"`
|
|
ReplyUser string `json:"reply_user,omitempty"`
|
|
ReplyTo int64 `json:"reply_to,omitempty"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
group: comment // 微服务分组
|
|
prefix: /api/auth/comment // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 1048576 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
jwt: Auth // 是否开启jwt验证
|
|
)
|
|
service auth {
|
|
@handler getCommentList
|
|
post /list (CommentListRequest) returns (CommentListPageResponse)
|
|
|
|
@handler getReplyList
|
|
post /reply/list (ReplyListRequest) returns (CommentListPageResponse)
|
|
|
|
@handler submitComment
|
|
post /submit (CommentRequest) returns (CommentResponse)
|
|
|
|
@handler submitReplyComment
|
|
post /reply/submit (ReplyCommentRequest) returns (CommentResponse)
|
|
|
|
@handler submitReplyReply
|
|
post /reply/reply/submit (ReplyReplyRequest) returns (CommentResponse)
|
|
|
|
@handler likeComment
|
|
post /like (CommentLikeRequest)
|
|
|
|
@handler dislikeComment
|
|
post /dislike (CommentDisLikeRequest)
|
|
}
|
|
|
|
// 上传图片请求参数
|
|
type (
|
|
UploadRequest {
|
|
Image string `json:"image"`
|
|
AccessToken string `json:"access_token"`
|
|
userId string `json:"user_id"`
|
|
}
|
|
SharePhoneUploadRequest {
|
|
OriginFileObj string `json:"origin_file_obj"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Size int64 `json:"size"`
|
|
AccessToken string `json:"access_token"`
|
|
userId string `json:"user_id"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
group: phone // 微服务分组
|
|
prefix: /api/auth/phone // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 10485760 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
)
|
|
service auth {
|
|
@handler uploadImage
|
|
post /upload (UploadRequest)
|
|
|
|
@handler sharePhoneUpload
|
|
post /share/upload (SharePhoneUploadRequest)
|
|
}
|
|
|
|
// 文件上传配置请求参数
|
|
type (
|
|
StorageConfigRequest {
|
|
Type string `json:"type"`
|
|
AccessKey string `json:"access_key"`
|
|
SecretKey string `json:"secret_key"`
|
|
Endpoint string `json:"endpoint"`
|
|
Bucket string `json:"bucket"`
|
|
Region string `json:"region"`
|
|
Capacity int64 `json:"capacity"`
|
|
}
|
|
FaceSampleLibrary {
|
|
ID int64 `json:"id"`
|
|
FaceName string `json:"face_name"`
|
|
FaceImage string `json:"face_image"`
|
|
}
|
|
FaceSampleLibraryListRequest {
|
|
Type int64 `json:"type"`
|
|
}
|
|
FaceSampleLibraryListResponse {
|
|
faces []FaceSampleLibrary `json:"faces"`
|
|
}
|
|
ModifyFaceNameRequestAndResponse {
|
|
ID int64 `json:"id"`
|
|
FaceName string `json:"face_name"`
|
|
}
|
|
ModifyFaceTypeRequest {
|
|
IDs []int64 `json:"ids"`
|
|
FaceType int64 `json:"face_type"`
|
|
}
|
|
ModifyFaceTypeResponse {
|
|
result string `json:"result"`
|
|
}
|
|
FaceDetailListRequest {
|
|
FaceID int64 `json:"face_id"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
FaceDetailListResponse {
|
|
records []AllImageDetail `json:"records"`
|
|
}
|
|
// 创建相册请求参数
|
|
AlbumCreateRequest {
|
|
Name string `json:"name"`
|
|
}
|
|
// 创建相册响应参数
|
|
AlbumCreateResponse {
|
|
ID int64 `json:"id"`
|
|
}
|
|
// 相册列表请求参数
|
|
AlbumListRequest {
|
|
Type int64 `json:"type,omitempty"`
|
|
Sort bool `json:"sort"`
|
|
}
|
|
// 相册列表响应参数
|
|
Album {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
CreatedAt string `json:"created_at"`
|
|
Type int64 `json:"type"`
|
|
CoverImage string `json:"cover_image"`
|
|
}
|
|
AlbumListResponse {
|
|
Albums []Album `json:"albums"`
|
|
}
|
|
// 相册详情请求参数
|
|
AlbumDetailListRequest {
|
|
ID int64 `json:"id"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
Type int64 `json:"type"`
|
|
}
|
|
// 相册详情响应参数
|
|
AlbumDetailListResponse {
|
|
records []AllImageDetail `json:"records"`
|
|
}
|
|
// 重命名相册请求参数
|
|
AlbumRenameRequest {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
// 重命名相册响应参数
|
|
AlbumRenameResponse {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
// 删除相册请求参数
|
|
AlbumDeleteRequest {
|
|
ID int64 `json:"id"`
|
|
}
|
|
// 所有图片列表请求参数
|
|
AllImageListRequest {
|
|
Type string `json:"type"`
|
|
Sort bool `json:"sort"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
// 所有图片列表响应参数
|
|
ImageMeta {
|
|
ID int64 `json:"id"`
|
|
fileName string `json:"file_name"`
|
|
URL string `json:"url"`
|
|
Width float64 `json:"width"`
|
|
Height float64 `json:"height"`
|
|
CreatedAt string `json:"created_at"`
|
|
Thumbnail string `json:"thumbnail"`
|
|
}
|
|
AllImageDetail {
|
|
Date string `json:"date"`
|
|
list []ImageMeta `json:"list"`
|
|
}
|
|
AllImageListResponse {
|
|
records []AllImageDetail `json:"records"`
|
|
}
|
|
RecentListRequest {
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
// 最近上传图片列表请求参数
|
|
RecentListResponse {
|
|
records []AllImageDetail `json:"records"`
|
|
}
|
|
LocationMeta {
|
|
ID int64 `json:"id"`
|
|
City string `json:"city"`
|
|
Total int64 `json:"total"`
|
|
CoverImage string `json:"cover_image"`
|
|
}
|
|
LocationListData {
|
|
location string `json:"location"` // 中国 新疆维吾尔自治区
|
|
list []LocationMeta `json:"list"` // 图片列表
|
|
}
|
|
LocationListRequest {
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
// 地点相册列表响应参数
|
|
LocationListResponse {
|
|
records []LocationListData `json:"records"`
|
|
}
|
|
// 地点详情列表请求参数
|
|
LocationDetailListRequest {
|
|
ID int64 `json:"id"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
// 地点详情列表响应参数
|
|
LocationDetailListResponse {
|
|
records []AllImageDetail `json:"records"`
|
|
}
|
|
ThingMeta {
|
|
TagName string `json:"tag_name"`
|
|
CreatedAt string `json:"created_at"`
|
|
TagCount int64 `json:"tag_count"`
|
|
CoverImage string `json:"cover_image"`
|
|
}
|
|
ThingListData {
|
|
Category string `json:"category"` // 分类
|
|
list []ThingMeta `json:"list"` // 图片列表
|
|
}
|
|
ThingListRequest {
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
// 事物相册列表响应参数
|
|
ThingListResponse {
|
|
records []ThingListData `json:"records"`
|
|
}
|
|
// 事物详情列表请求参数
|
|
ThingDetailListRequest {
|
|
TagName string `json:"tag_name"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
// 事物详情列表响应参数
|
|
ThingDetailListResponse {
|
|
records []AllImageDetail `json:"records"`
|
|
}
|
|
// 单张图片请求参数
|
|
SingleImageRequest {
|
|
ID int64 `json:"id"`
|
|
}
|
|
DeleteImageRequest {
|
|
IDS []int64 `json:"ids"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
StorageMeta {
|
|
Name string `json:"name"`
|
|
Value string `json:"value"`
|
|
}
|
|
StroageNode {
|
|
Value string `json:"value"`
|
|
Name string `json:"name"`
|
|
Children []StorageMeta `json:"children"`
|
|
}
|
|
StorageListResponse {
|
|
Records []StroageNode `json:"records"`
|
|
}
|
|
QueryDeleteRecordRequest {
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
DeleteRecordListResponse {
|
|
Records []AllImageDetail `json:"records"`
|
|
}
|
|
BucketCapacityRequest {
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
BucketCapacityResponse {
|
|
Capacity string `json:"capacity"`
|
|
Used string `json:"used"`
|
|
Percentage float64 `json:"percentage"`
|
|
}
|
|
ShareAlbumRequest {
|
|
ID int64 `json:"id"`
|
|
ExpireDate string `json:"expire_date"`
|
|
AccessLimit int64 `json:"access_limit,omitempty"`
|
|
AccessPassword string `json:"access_password,omitempty"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
DownloadAlbumRequest {
|
|
ID int64 `json:"id"`
|
|
Provider string `json:"provider"`
|
|
Bucket string `json:"bucket"`
|
|
}
|
|
)
|
|
|
|
// 文件上传
|
|
@server (
|
|
group: storage // 微服务分组
|
|
prefix: /api/auth/storage // 微服务前缀
|
|
timeout: 20s // 超时时间
|
|
maxBytes: 104857600 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
jwt: Auth // 是否开启jwt验证
|
|
)
|
|
service auth {
|
|
// 上传文件
|
|
@handler uploadFile
|
|
post /uploads returns (string)
|
|
|
|
// 设置存储配置
|
|
@handler setStorageConfig
|
|
post /config (StorageConfigRequest) returns (string)
|
|
|
|
// 获取人脸样本库列表
|
|
@handler getFaceSampleLibraryList
|
|
post /face/sample/list (FaceSampleLibraryListRequest) returns (FaceSampleLibraryListResponse)
|
|
|
|
// 修改人脸样本名称
|
|
@handler modifyFaceLibraryName
|
|
post /face/sample/modify/name (ModifyFaceNameRequestAndResponse) returns (ModifyFaceNameRequestAndResponse)
|
|
|
|
// 修改人脸样本类型
|
|
@handler modifyFaceLibraryType
|
|
post /face/sample/modify/type (ModifyFaceTypeRequest) returns (ModifyFaceTypeResponse)
|
|
|
|
// 获取人脸详情列表
|
|
@handler getFaceDetailList
|
|
post /face/detail/list (FaceDetailListRequest) returns (FaceDetailListResponse)
|
|
|
|
// 创建相册
|
|
@handler createAlbum
|
|
post /album/create (AlbumCreateRequest) returns (AlbumCreateResponse)
|
|
|
|
// 获取相册列表
|
|
@handler getAlbumList
|
|
post /album/list (AlbumListRequest) returns (AlbumListResponse)
|
|
|
|
// 获取相册详情
|
|
@handler getAlbumDetail
|
|
post /album/detail/list (AlbumDetailListRequest) returns (AlbumDetailListResponse)
|
|
|
|
// 重命名相册
|
|
@handler renameAlbum
|
|
post /album/rename (AlbumRenameRequest) returns (AlbumRenameResponse)
|
|
|
|
// 删除相册
|
|
@handler deleteAlbum
|
|
post /album/delete (AlbumDeleteRequest) returns (string)
|
|
|
|
// 获取所有图片列表
|
|
@handler queryAllImageList
|
|
post /image/all/list (AllImageListRequest) returns (AllImageListResponse)
|
|
|
|
// 获取最近上传图片列表
|
|
@handler queryRecentImageList
|
|
post /image/recent/list (RecentListRequest) returns (RecentListResponse)
|
|
|
|
// 获取地点相册列表
|
|
@handler queryLocationImageList
|
|
post /image/location/list (LocationListRequest) returns (LocationListResponse)
|
|
|
|
// 获取地点详情列表
|
|
@handler queryLocationDetailList
|
|
post /image/location/detail/list (LocationDetailListRequest) returns (LocationDetailListResponse)
|
|
|
|
// 获取事物相册列表
|
|
@handler queryThingImageList
|
|
post /image/thing/list (ThingListRequest) returns (ThingListResponse)
|
|
|
|
// 获取事物详情列表
|
|
@handler queryThingDetailList
|
|
post /image/thing/detail/list (ThingDetailListRequest) returns (ThingDetailListResponse)
|
|
|
|
// 获取单张图片连接
|
|
@handler getImageUrl
|
|
post /image/url/single (SingleImageRequest) returns (string)
|
|
|
|
// 获取用户存储配置列表
|
|
@handler getUserStorageList
|
|
post /user/config/list returns (StorageListResponse)
|
|
|
|
// 删除图片
|
|
@handler deleteImage
|
|
post /image/delete (DeleteImageRequest) returns (string)
|
|
|
|
// 获取删除记录
|
|
@handler getDeleteRecord
|
|
post /delete/record (QueryDeleteRecordRequest) returns (DeleteRecordListResponse)
|
|
|
|
// 获取存储桶的容量信息
|
|
@handler getBucketCapacity
|
|
post /bucket/capacity (BucketCapacityRequest) returns (BucketCapacityResponse)
|
|
|
|
// 分享相册
|
|
@handler shareAlbum
|
|
post /album/share (ShareAlbumRequest) returns (string)
|
|
|
|
// 下载相册
|
|
@handler downloadAlbum
|
|
post /album/download (DownloadAlbumRequest) returns (string)
|
|
}
|
|
|
|
type (
|
|
ShareImageMeta {
|
|
FileName string `json:"file_name"`
|
|
OriginImage string `json:"origin_image"`
|
|
FileType string `json:"file_type"`
|
|
Thumbnail string `json:"thumbnail"`
|
|
ThumbW float64 `json:"thumb_w"`
|
|
ThumbH float64 `json:"thumb_h"`
|
|
ThumbSize int64 `json:"thumb_size"`
|
|
}
|
|
ShareImageRequest {
|
|
Title string `json:"title,omitempty"`
|
|
ExpireDate string `json:"expire_date"`
|
|
AccessLimit int64 `json:"access_limit,omitempty"`
|
|
AccessPassword string `json:"access_password,omitempty"`
|
|
Images []ShareImageMeta `json:"images"`
|
|
}
|
|
QueryShareImageRequest {
|
|
InviteCode string `json:"invite_code"`
|
|
AccessPassword string `json:"access_password,omitempty"`
|
|
}
|
|
QueryShareImageResponse {
|
|
Records []AllImageDetail `json:"records"`
|
|
}
|
|
ShareRecordListRequest {
|
|
DateRange []string `json:"date_range"`
|
|
}
|
|
// 分享记录列表响应参数
|
|
ShareRecord {
|
|
ID int64 `json:"id"`
|
|
CoverImage string `json:"cover_image"`
|
|
CreatedAt string `json:"created_at"`
|
|
InviteCode string `json:"invite_code"`
|
|
VisitLimit int64 `json:"visit_limit"`
|
|
AccessPassword string `json:"access_password"`
|
|
ValidityPeriod int64 `json:"validity_period"`
|
|
AlbumID int64 `json:"album_id"`
|
|
}
|
|
ShareRecordListResponse {
|
|
records []ShareRecord `json:"records"`
|
|
}
|
|
QueryShareInfoRequest {
|
|
InviteCode string `json:"invite_code"`
|
|
}
|
|
ShareInfoResponse {
|
|
ID int64 `json:"id"`
|
|
CoverImage string `json:"cover_image"`
|
|
CreatedAt string `json:"created_at"`
|
|
VisitLimit int64 `json:"visit_limit"`
|
|
ExpireTime string `json:"expire_time"`
|
|
ImageCount int64 `json:"image_count"`
|
|
VisitCount int64 `json:"visit_count"`
|
|
ViewerCount int64 `json:"viewer_count"`
|
|
SharerAvatar string `json:"sharer_avatar"`
|
|
SharerName string `json:"sharer_name"`
|
|
AlbumName string `json:"album_name"`
|
|
}
|
|
// 分享数据概览响应参数
|
|
ShareOverviewResponse {
|
|
VisitCount int64 `json:"visit_count"`
|
|
VisitCountToday int64 `json:"visit_count_today"`
|
|
ViewerCount int64 `json:"viewer_count"`
|
|
ViewerCountToday int64 `json:"viewer_count_today"`
|
|
PublishCount int64 `json:"publish_count"`
|
|
PublishCountToday int64 `json:"publish_count_today"`
|
|
}
|
|
// 删除分享记录请求参数
|
|
DeleteShareRecordRequest {
|
|
ID int64 `json:"id"`
|
|
InviteCode string `json:"invite_code"`
|
|
AlbumID int64 `json:"album_id"`
|
|
}
|
|
)
|
|
|
|
// 分享服务
|
|
@server (
|
|
group: share // 微服务分组
|
|
prefix: /api/auth/share // 微服务前缀
|
|
timeout: 10s // 超时时间
|
|
maxBytes: 104857600 // 最大请求大小
|
|
signature: false // 是否开启签名验证
|
|
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,NonceMiddleware // 注册中间件
|
|
MaxConns: true // 是否开启最大连接数限制
|
|
Recover: true // 是否开启自动恢复
|
|
jwt: Auth // 是否开启jwt验证
|
|
)
|
|
service auth {
|
|
@handler uploadShareImage
|
|
post /upload (ShareImageRequest) returns (string)
|
|
|
|
//查看分享图片
|
|
@handler queryShareImage
|
|
post /image/list (QueryShareImageRequest) returns (QueryShareImageResponse)
|
|
|
|
// 列出分享记录
|
|
@handler listShareRecord
|
|
post /record/list (ShareRecordListRequest) returns (ShareRecordListResponse)
|
|
|
|
// 查看分享信息
|
|
@handler queryShareInfo
|
|
post /info (QueryShareInfoRequest) returns (ShareInfoResponse)
|
|
|
|
// 查询浏览数据概览
|
|
@handler queryShareOverview
|
|
post /overview returns (ShareOverviewResponse)
|
|
|
|
// 删除分享记录
|
|
@handler deleteShareRecord
|
|
post /record/delete (DeleteShareRecordRequest) returns (string)
|
|
}
|
|
|