From 982dc2bfad3087d7c5ed4338f4707dfcf5df0035 Mon Sep 17 00:00:00 2001 From: truthhun <1272881215@qq.com> Date: Tue, 14 Mar 2023 15:32:46 +0800 Subject: [PATCH] =?UTF-8?q?API=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 8 + api/v1/attachment.proto | 23 +- api/v1/config.proto | 3 +- api/v1/document.pb.go | 23 + api/v1/document.proto | 51 +- api/v1/favorite.pb.go | 5 + api/v1/favorite.proto | 99 +- api/v1/friendlink.pb.go | 15 + api/v1/friendlink.proto | 111 +- api/v1/group.pb.go | 12 +- api/v1/group.proto | 35 +- api/v1/permission.pb.go | 319 +--- api/v1/permission.proto | 38 +- api/v1/report.pb.go | 13 +- api/v1/report.proto | 33 +- api/v1/user.pb.go | 20 + api/v1/user.proto | 171 +- docs/api/apis.md | 2481 ++++++++++++++++++++++++ docs/api/attachment.md | 6 +- docs/api/config.md | 6 +- docs/api/document.md | 60 +- docs/api/favorite.md | 10 +- docs/api/friendlink.md | 38 +- docs/api/group.md | 40 +- docs/api/permission.md | 48 +- docs/api/report.md | 38 +- docs/api/user.md | 176 +- docs/openapi.yaml | 4039 +++++++++++++++++++++++++++++++++++++-- 28 files changed, 7031 insertions(+), 890 deletions(-) create mode 100644 docs/api/apis.md diff --git a/Makefile b/Makefile index 1686268..d035429 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,14 @@ doc: --openapi_out==paths=source_relative:docs \ $$file; \ done + # 整合到单文件 + protoc --proto_path=. \ + --proto_path=./third_party \ + --proto_path=./api \ + --doc_out=docs/api \ + --doc_opt=markdown,apis.md \ + --openapi_out==paths=source_relative:docs \ + $(API_PROTO_FILES) .PHONY: clean-api-go # clean api go file diff --git a/api/v1/attachment.proto b/api/v1/attachment.proto index 0e97976..1fd7840 100644 --- a/api/v1/attachment.proto +++ b/api/v1/attachment.proto @@ -18,18 +18,17 @@ message Attachment { string hash = 2; // 附件哈希值,MD5 int64 user_id = 3; // 上传用户ID int64 type_id = 4; // 附件类型ID,如果是文档类型,则为文档ID - int32 type = 5; // 附件类型,0: 未知,1: 头像,2: 文档,3: 文章,4: 评论,5: - // 横幅,6: 分类封面,7: 配置 - bool enable = 6; // 是否启用 - string path = 7; // 附件路径 - string name = 8; // 附件名称 - int64 size = 9; // 附件大小,单位:字节 - int64 width = 10; // 附件宽度,单位:像素。针对图片附件 - int64 height = 11; // 附件高度,单位:像素。针对图片附件 - string ext = 12; // 扩展名,如:.docx - string ip = 13; // 上传IP地址 - string username = 16; // 用户名称 - string type_name = 17; // 附件类型名称 + int32 type = 5; // 附件类型,见 web/utils/enum.js + bool enable = 6; // 是否启用 + string path = 7; // 附件路径 + string name = 8; // 附件名称 + int64 size = 9; // 附件大小,单位:字节 + int64 width = 10; // 附件宽度,单位:像素。针对图片附件 + int64 height = 11; // 附件高度,单位:像素。针对图片附件 + string ext = 12; // 扩展名,如:.docx + string ip = 13; // 上传IP地址 + string username = 16; // 用户名称 + string type_name = 17; // 附件类型名称 string description = 18; // 附件描述、备注 google.protobuf.Timestamp created_at = 14 [ (gogoproto.stdtime) = true ]; // 创建时间 diff --git a/api/v1/config.proto b/api/v1/config.proto index f436aa7..3bd25ee 100644 --- a/api/v1/config.proto +++ b/api/v1/config.proto @@ -19,8 +19,7 @@ message Config { string name = 3; // 配置名称 string value = 4; // 配置值 string placeholder = 5; // 配置占位符 - string input_type = 6; // 输入类型,如:textarea、number、switch等,为 - // element-ui 的 el-input 的 type 属性 + string input_type = 6; // 输入类型,如:textarea、number、switch等 string category = 7; // 配置分类,如:system、footer、security等,见 web/utils/enum.js int32 sort = 8; // 排序,越小越靠前 diff --git a/api/v1/document.pb.go b/api/v1/document.pb.go index eb0385d..17d68bc 100644 --- a/api/v1/document.pb.go +++ b/api/v1/document.pb.go @@ -981,6 +981,7 @@ func (m *ListDocumentForHomeResponse) GetDocument() []*ListDocumentForHomeItem { return nil } +// 文档搜索 type SearchDocumentRequest struct { Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size_ int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` @@ -1150,6 +1151,7 @@ func (m *DocumentScore) GetUpdatedAt() *time.Time { return nil } +// 文档搜索响应 type SearchDocumentReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Spend string `protobuf:"bytes,2,opt,name=spend,proto3" json:"spend,omitempty"` @@ -1210,6 +1212,7 @@ func (m *SearchDocumentReply) GetDocument() []*Document { return nil } +// 文档下载 type DownloadDocumentReply struct { Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` } @@ -1394,15 +1397,25 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type DocumentAPIClient interface { + // 针对首页的文档查询 ListDocumentForHome(ctx context.Context, in *ListDocumentForHomeRequest, opts ...grpc.CallOption) (*ListDocumentForHomeResponse, error) + // 设置文档推荐 SetDocumentRecommend(ctx context.Context, in *SetDocumentRecommendRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 创建文档 CreateDocument(ctx context.Context, in *CreateDocumentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 更新文档 UpdateDocument(ctx context.Context, in *Document, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 删除文档 DeleteDocument(ctx context.Context, in *DeleteDocumentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 查询文档 GetDocument(ctx context.Context, in *GetDocumentRequest, opts ...grpc.CallOption) (*Document, error) + // 根据文档ID查询当前文档的相关文档 GetRelatedDocuments(ctx context.Context, in *Document, opts ...grpc.CallOption) (*ListDocumentReply, error) + // 根据文档ID,获取文档下载链接 DownloadDocument(ctx context.Context, in *Document, opts ...grpc.CallOption) (*DownloadDocumentReply, error) + // 文档列表查询 ListDocument(ctx context.Context, in *ListDocumentRequest, opts ...grpc.CallOption) (*ListDocumentReply, error) + // 文档搜索 SearchDocument(ctx context.Context, in *SearchDocumentRequest, opts ...grpc.CallOption) (*SearchDocumentReply, error) // 设置文档评分 SetDocumentScore(ctx context.Context, in *DocumentScore, opts ...grpc.CallOption) (*emptypb.Empty, error) @@ -1539,15 +1552,25 @@ func (c *documentAPIClient) SetDocumentReconvert(ctx context.Context, in *emptyp // DocumentAPIServer is the server API for DocumentAPI service. type DocumentAPIServer interface { + // 针对首页的文档查询 ListDocumentForHome(context.Context, *ListDocumentForHomeRequest) (*ListDocumentForHomeResponse, error) + // 设置文档推荐 SetDocumentRecommend(context.Context, *SetDocumentRecommendRequest) (*emptypb.Empty, error) + // 创建文档 CreateDocument(context.Context, *CreateDocumentRequest) (*emptypb.Empty, error) + // 更新文档 UpdateDocument(context.Context, *Document) (*emptypb.Empty, error) + // 删除文档 DeleteDocument(context.Context, *DeleteDocumentRequest) (*emptypb.Empty, error) + // 查询文档 GetDocument(context.Context, *GetDocumentRequest) (*Document, error) + // 根据文档ID查询当前文档的相关文档 GetRelatedDocuments(context.Context, *Document) (*ListDocumentReply, error) + // 根据文档ID,获取文档下载链接 DownloadDocument(context.Context, *Document) (*DownloadDocumentReply, error) + // 文档列表查询 ListDocument(context.Context, *ListDocumentRequest) (*ListDocumentReply, error) + // 文档搜索 SearchDocument(context.Context, *SearchDocumentRequest) (*SearchDocumentReply, error) // 设置文档评分 SetDocumentScore(context.Context, *DocumentScore) (*emptypb.Empty, error) diff --git a/api/v1/document.proto b/api/v1/document.proto index 65ad8c8..a75217b 100644 --- a/api/v1/document.proto +++ b/api/v1/document.proto @@ -112,21 +112,22 @@ message ListDocumentForHomeRequest { int64 limit = 1; } // 首页文档查询返回项 message ListDocumentForHomeItem { - int64 category_id = 1; - string category_cover = 2; - string category_name = 3; - repeated Document document = 4; + int64 category_id = 1; // 分类ID + string category_cover = 2; // 分类封面 + string category_name = 3; // 分类名称 + repeated Document document = 4; // 文档列表 } // 查询文档(针对首页的查询) message ListDocumentForHomeResponse { - repeated ListDocumentForHomeItem document = 1; + repeated ListDocumentForHomeItem document = 1; // 文档列表 } +// 文档搜索 message SearchDocumentRequest { - int32 page = 1; - int32 size = 2; - string wd = 3; + int32 page = 1; // 页码 + int32 size = 2; // 每页数量 + string wd = 3; // 搜索关键字 repeated int64 category_id = 4; // 分类 string sort = 5; // 排序 string ext = 7; // 类型 @@ -134,23 +135,30 @@ message SearchDocumentRequest { // 文档评分 message DocumentScore { - int64 id = 1; - int64 document_id = 2; - int64 user_id = 3; - int32 score = 4; // 评分 - google.protobuf.Timestamp created_at = 5 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 6 [ (gogoproto.stdtime) = true ]; + int64 id = 1; // 评分ID + int64 document_id = 2; // 文档ID + int64 user_id = 3; // 用户ID + int32 score = 4; // 评分,100~500,100为1分,500为5分 + google.protobuf.Timestamp created_at = 5 + [ (gogoproto.stdtime) = true ]; // 评分时间 + google.protobuf.Timestamp updated_at = 6 + [ (gogoproto.stdtime) = true ]; // 更新时间 } +// 文档搜索响应 message SearchDocumentReply { - int64 total = 1; - string spend = 2; // 搜索耗时 - repeated Document document = 3; + int64 total = 1; // 文档总数 + string spend = 2; // 搜索耗时 + repeated Document document = 3; // 文档列表 } +// 文档下载 message DownloadDocumentReply { string url = 1; } +// 文档服务 service DocumentAPI { + + // 针对首页的文档查询 rpc ListDocumentForHome(ListDocumentForHomeRequest) returns (ListDocumentForHomeResponse) { option (google.api.http) = { @@ -158,6 +166,7 @@ service DocumentAPI { }; } + // 设置文档推荐 rpc SetDocumentRecommend(SetDocumentRecommendRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -166,6 +175,7 @@ service DocumentAPI { }; } + // 创建文档 rpc CreateDocument(CreateDocumentRequest) returns (google.protobuf.Empty) { option (google.api.http) = { post : '/api/v1/document', @@ -173,6 +183,7 @@ service DocumentAPI { }; } + // 更新文档 rpc UpdateDocument(Document) returns (google.protobuf.Empty) { option (google.api.http) = { put : '/api/v1/document', @@ -180,36 +191,42 @@ service DocumentAPI { }; } + // 删除文档 rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete : '/api/v1/document', }; } + // 查询文档 rpc GetDocument(GetDocumentRequest) returns (Document) { option (google.api.http) = { get : '/api/v1/document', }; } + // 根据文档ID查询当前文档的相关文档 rpc GetRelatedDocuments(Document) returns (ListDocumentReply) { option (google.api.http) = { get : '/api/v1/document/related', }; } + // 根据文档ID,获取文档下载链接 rpc DownloadDocument(Document) returns (DownloadDocumentReply) { option (google.api.http) = { get : '/api/v1/document/download', }; } + // 文档列表查询 rpc ListDocument(ListDocumentRequest) returns (ListDocumentReply) { option (google.api.http) = { get : '/api/v1/document/list', }; } + // 文档搜索 rpc SearchDocument(SearchDocumentRequest) returns (SearchDocumentReply) { option (google.api.http) = { get : '/api/v1/document/search', diff --git a/api/v1/favorite.pb.go b/api/v1/favorite.pb.go index 2e3dce7..e33f5f8 100644 --- a/api/v1/favorite.pb.go +++ b/api/v1/favorite.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 文档收藏 type Favorite struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` @@ -149,6 +150,7 @@ func (m *Favorite) GetUpdatedAt() *time.Time { return nil } +// 取消收藏 type DeleteFavoriteRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -193,6 +195,7 @@ func (m *DeleteFavoriteRequest) GetId() []int64 { return nil } +// 查询用户的收藏 type ListFavoriteRequest struct { Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size_ int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` @@ -253,6 +256,7 @@ func (m *ListFavoriteRequest) GetUserId() int64 { return 0 } +// 查询用户的收藏 type ListFavoriteReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Favorite []*Favorite `protobuf:"bytes,2,rep,name=favorite,proto3" json:"favorite,omitempty"` @@ -305,6 +309,7 @@ func (m *ListFavoriteReply) GetFavorite() []*Favorite { return nil } +// 根据文章id,查询用户是否有收藏某篇文档 type GetFavoriteRequest struct { DocumentId int64 `protobuf:"varint,1,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty"` } diff --git a/api/v1/favorite.proto b/api/v1/favorite.proto index c770e91..04a72c6 100644 --- a/api/v1/favorite.proto +++ b/api/v1/favorite.proto @@ -1,4 +1,4 @@ -syntax="proto3"; +syntax = "proto3"; import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; @@ -12,65 +12,66 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; -message Favorite{ - int64 id = 1; - int64 user_id = 2; - int64 document_id = 3; - string title = 6; - string ext = 7; - int32 score = 8; - int64 size = 9; - int32 pages = 10; - google.protobuf.Timestamp created_at = 4 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 5 [ (gogoproto.stdtime) = true ]; +// 文档收藏 +message Favorite { + int64 id = 1; + int64 user_id = 2; + int64 document_id = 3; + string title = 6; + string ext = 7; + int32 score = 8; + int64 size = 9; + int32 pages = 10; + google.protobuf.Timestamp created_at = 4 [ (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp updated_at = 5 [ (gogoproto.stdtime) = true ]; } -message DeleteFavoriteRequest { - repeated int64 id = 1; -} +// 取消收藏 +message DeleteFavoriteRequest { repeated int64 id = 1; } +// 查询用户的收藏 message ListFavoriteRequest { - int64 page = 1; - int64 size = 2; - int64 user_id = 3; + int64 page = 1; + int64 size = 2; + int64 user_id = 3; } +// 查询用户的收藏 message ListFavoriteReply { - int64 total = 1; - repeated Favorite favorite = 2; + int64 total = 1; + repeated Favorite favorite = 2; } -message GetFavoriteRequest{ - int64 document_id = 1; -} +// 根据文章id,查询用户是否有收藏某篇文档 +message GetFavoriteRequest { int64 document_id = 1; } -service FavoriteAPI{ - // 添加收藏 - rpc CreateFavorite (Favorite) returns (Favorite){ - option (google.api.http) = { - post: '/api/v1/favorite', - body: '*', - }; - } +service FavoriteAPI { + // 添加收藏 + rpc CreateFavorite(Favorite) returns (Favorite) { + option (google.api.http) = { + post : '/api/v1/favorite', + body : '*', + }; + } - // 取消收藏 - rpc DeleteFavorite (DeleteFavoriteRequest) returns (google.protobuf.Empty){ - option (google.api.http) = { - delete: '/api/v1/favorite', - }; - } + // 取消收藏 + rpc DeleteFavorite(DeleteFavoriteRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete : '/api/v1/favorite', + }; + } - // 根据文章id,查询用户是否有收藏某篇文档 - rpc GetFavorite (GetFavoriteRequest) returns (Favorite){ - option (google.api.http) = { - get: '/api/v1/favorite', - }; - } + // 根据文章id,查询用户是否有收藏某篇文档 + rpc GetFavorite(GetFavoriteRequest) returns (Favorite) { + option (google.api.http) = { + get : '/api/v1/favorite', + }; + } - // 查询用户的收藏 - rpc ListFavorite (ListFavoriteRequest) returns (ListFavoriteReply){ - option (google.api.http) = { - get: '/api/v1/favorite/list', - }; - } + // 查询用户的收藏 + rpc ListFavorite(ListFavoriteRequest) returns (ListFavoriteReply) { + option (google.api.http) = { + get : '/api/v1/favorite/list', + }; + } } \ No newline at end of file diff --git a/api/v1/friendlink.pb.go b/api/v1/friendlink.pb.go index 2c752f4..bdfc3b1 100644 --- a/api/v1/friendlink.pb.go +++ b/api/v1/friendlink.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 友情链接 type Friendlink struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` @@ -133,6 +134,7 @@ func (m *Friendlink) GetUpdatedAt() *time.Time { return nil } +// 删除友情链接 type DeleteFriendlinkRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -177,6 +179,7 @@ func (m *DeleteFriendlinkRequest) GetId() []int64 { return nil } +// 获取友情链接 type GetFriendlinkRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -221,6 +224,7 @@ func (m *GetFriendlinkRequest) GetId() int64 { return 0 } +// 友情链接列表 type ListFriendlinkRequest struct { Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size_ int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` @@ -297,6 +301,7 @@ func (m *ListFriendlinkRequest) GetField() []string { return nil } +// 友情链接列表 type ListFriendlinkReply struct { Friendlink []*Friendlink `protobuf:"bytes,1,rep,name=friendlink,proto3" json:"friendlink,omitempty"` Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` @@ -413,10 +418,15 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type FriendlinkAPIClient interface { + // 创建友情链接 CreateFriendlink(ctx context.Context, in *Friendlink, opts ...grpc.CallOption) (*Friendlink, error) + // 更新友情链接 UpdateFriendlink(ctx context.Context, in *Friendlink, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 删除友情链接 DeleteFriendlink(ctx context.Context, in *DeleteFriendlinkRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 获取友情链接 GetFriendlink(ctx context.Context, in *GetFriendlinkRequest, opts ...grpc.CallOption) (*Friendlink, error) + // 获取友情链接 ListFriendlink(ctx context.Context, in *ListFriendlinkRequest, opts ...grpc.CallOption) (*ListFriendlinkReply, error) } @@ -475,10 +485,15 @@ func (c *friendlinkAPIClient) ListFriendlink(ctx context.Context, in *ListFriend // FriendlinkAPIServer is the server API for FriendlinkAPI service. type FriendlinkAPIServer interface { + // 创建友情链接 CreateFriendlink(context.Context, *Friendlink) (*Friendlink, error) + // 更新友情链接 UpdateFriendlink(context.Context, *Friendlink) (*emptypb.Empty, error) + // 删除友情链接 DeleteFriendlink(context.Context, *DeleteFriendlinkRequest) (*emptypb.Empty, error) + // 获取友情链接 GetFriendlink(context.Context, *GetFriendlinkRequest) (*Friendlink, error) + // 获取友情链接 ListFriendlink(context.Context, *ListFriendlinkRequest) (*ListFriendlinkReply, error) } diff --git a/api/v1/friendlink.proto b/api/v1/friendlink.proto index 94db35a..5425308 100644 --- a/api/v1/friendlink.proto +++ b/api/v1/friendlink.proto @@ -1,4 +1,4 @@ -syntax="proto3"; +syntax = "proto3"; import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; @@ -12,68 +12,79 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; +// 友情链接 message Friendlink { - int32 id = 1; - string title = 2; - string link = 3; - string description = 4; - int32 sort = 5; - bool enable = 6; - google.protobuf.Timestamp created_at = 7 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 8 [ (gogoproto.stdtime) = true ]; + int32 id = 1; // 主键 + string title = 2; // 标题 + string link = 3; // 链接 + string description = 4; // 描述 + int32 sort = 5; // 排序 + bool enable = 6; // 是否启用 + google.protobuf.Timestamp created_at = 7 + [ (gogoproto.stdtime) = true ]; // 创建时间 + google.protobuf.Timestamp updated_at = 8 + [ (gogoproto.stdtime) = true ]; // 更新时间 } -message DeleteFriendlinkRequest { - repeated int64 id = 1; -} +// 删除友情链接 +message DeleteFriendlinkRequest { repeated int64 id = 1; } -message GetFriendlinkRequest { - int64 id = 1; -} +// 获取友情链接 +message GetFriendlinkRequest { int64 id = 1; } +// 友情链接列表 message ListFriendlinkRequest { - int32 page = 1; - int32 size = 2; - string wd = 3; - repeated bool enable = 4; - repeated string field = 5; + int32 page = 1; + int32 size = 2; + string wd = 3; + repeated bool enable = 4; + repeated string field = 5; } +// 友情链接列表 message ListFriendlinkReply { - repeated Friendlink friendlink = 1; - int64 total = 2; + repeated Friendlink friendlink = 1; + int64 total = 2; } -service FriendlinkAPI{ - rpc CreateFriendlink (Friendlink) returns (Friendlink){ - option (google.api.http) = { - post: '/api/v1/friendlink', - body: '*', - }; - } +// 友情链接服务 +service FriendlinkAPI { + + // 创建友情链接 + rpc CreateFriendlink(Friendlink) returns (Friendlink) { + option (google.api.http) = { + post : '/api/v1/friendlink', + body : '*', + }; + } - rpc UpdateFriendlink (Friendlink) returns (google.protobuf.Empty) { - option (google.api.http) = { - put: '/api/v1/friendlink', - body: '*', - }; - } + // 更新友情链接 + rpc UpdateFriendlink(Friendlink) returns (google.protobuf.Empty) { + option (google.api.http) = { + put : '/api/v1/friendlink', + body : '*', + }; + } - rpc DeleteFriendlink (DeleteFriendlinkRequest) returns (google.protobuf.Empty){ - option (google.api.http) = { - delete: '/api/v1/friendlink', - }; - } + // 删除友情链接 + rpc DeleteFriendlink(DeleteFriendlinkRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete : '/api/v1/friendlink', + }; + } - rpc GetFriendlink (GetFriendlinkRequest) returns (Friendlink){ - option (google.api.http) = { - get: '/api/v1/friendlink', - }; - } + // 获取友情链接 + rpc GetFriendlink(GetFriendlinkRequest) returns (Friendlink) { + option (google.api.http) = { + get : '/api/v1/friendlink', + }; + } - rpc ListFriendlink (ListFriendlinkRequest) returns (ListFriendlinkReply){ - option (google.api.http) = { - get: '/api/v1/friendlink/list', - }; - } + // 获取友情链接 + rpc ListFriendlink(ListFriendlinkRequest) returns (ListFriendlinkReply) { + option (google.api.http) = { + get : '/api/v1/friendlink/list', + }; + } } \ No newline at end of file diff --git a/api/v1/group.pb.go b/api/v1/group.pb.go index 61ebb44..8104192 100644 --- a/api/v1/group.pb.go +++ b/api/v1/group.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 用户组,角色 type Group struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` @@ -165,6 +166,7 @@ func (m *Group) GetUpdatedAt() *time.Time { return nil } +// 删除用户组,可以批量删除 type DeleteGroupRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -339,6 +341,7 @@ func (m *ListGroupRequest) GetField() []string { return nil } +// 用户组列表 type ListGroupReply struct { Group []*Group `protobuf:"bytes,1,rep,name=group,proto3" json:"group,omitempty"` Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` @@ -391,6 +394,7 @@ func (m *ListGroupReply) GetTotal() int64 { return 0 } +// 获取用户组权限 type GetGroupPermissionRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -435,6 +439,7 @@ func (m *GetGroupPermissionRequest) GetId() int64 { return 0 } +// 更新用户组权限 type UpdateGroupPermissionRequest struct { GroupId int64 `protobuf:"varint,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` PermissionId []int64 `protobuf:"varint,2,rep,packed,name=permission_id,json=permissionId,proto3" json:"permission_id,omitempty"` @@ -487,6 +492,7 @@ func (m *UpdateGroupPermissionRequest) GetPermissionId() []int64 { return nil } +// 用户组权限 type GroupPermissions struct { PermissionId []int64 `protobuf:"varint,1,rep,packed,name=permission_id,json=permissionId,proto3" json:"permission_id,omitempty"` } @@ -615,8 +621,9 @@ type GroupAPIClient interface { UpdateGroup(ctx context.Context, in *Group, opts ...grpc.CallOption) (*emptypb.Empty, error) // 删除用户组 DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // 获取用户组列表 + // 获取用户组 GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*Group, error) + // 获取用户组列表 ListGroup(ctx context.Context, in *ListGroupRequest, opts ...grpc.CallOption) (*ListGroupReply, error) // 获取用户组权限列表 GetGroupPermission(ctx context.Context, in *GetGroupPermissionRequest, opts ...grpc.CallOption) (*GroupPermissions, error) @@ -703,8 +710,9 @@ type GroupAPIServer interface { UpdateGroup(context.Context, *Group) (*emptypb.Empty, error) // 删除用户组 DeleteGroup(context.Context, *DeleteGroupRequest) (*emptypb.Empty, error) - // 获取用户组列表 + // 获取用户组 GetGroup(context.Context, *GetGroupRequest) (*Group, error) + // 获取用户组列表 ListGroup(context.Context, *ListGroupRequest) (*ListGroupReply, error) // 获取用户组权限列表 GetGroupPermission(context.Context, *GetGroupPermissionRequest) (*GroupPermissions, error) diff --git a/api/v1/group.proto b/api/v1/group.proto index bb27d55..281b7e1 100644 --- a/api/v1/group.proto +++ b/api/v1/group.proto @@ -12,21 +12,25 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; +// 用户组,角色 message Group { - int64 id = 1; - string title = 2; - string color = 3; - bool is_default = 4; - bool is_display = 5; - string description = 6; - int32 user_count = 7; - int32 sort = 8; - bool enable_upload = 11; - bool enable_comment_approval = 12; - google.protobuf.Timestamp created_at = 9 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 10 [ (gogoproto.stdtime) = true ]; + int64 id = 1; // 用户组ID + string title = 2; // 用户组名称 + string color = 3; // 用户组颜色 + bool is_default = 4; // 是否是默认用户组 + bool is_display = 5; // 是否显示 + string description = 6; // 用户组描述 + int32 user_count = 7; // 用户组下的用户数量 + int32 sort = 8; // 排序 + bool enable_upload = 11; // 是否允许上传文档 + bool enable_comment_approval = 12; // 是否需要审核评论 + google.protobuf.Timestamp created_at = 9 + [ (gogoproto.stdtime) = true ]; // 创建时间 + google.protobuf.Timestamp updated_at = 10 + [ (gogoproto.stdtime) = true ]; // 更新时间 } +// 删除用户组,可以批量删除 message DeleteGroupRequest { repeated int64 id = 1; } // 根据组名或者ID获取用户组 @@ -44,18 +48,22 @@ message ListGroupRequest { repeated string field = 5; } +// 用户组列表 message ListGroupReply { repeated Group group = 1; int64 total = 2; } +// 获取用户组权限 message GetGroupPermissionRequest { int64 id = 1; } +// 更新用户组权限 message UpdateGroupPermissionRequest { int64 group_id = 1; repeated int64 permission_id = 2; } +// 用户组权限 message GroupPermissions { repeated int64 permission_id = 1; } service GroupAPI { @@ -82,13 +90,14 @@ service GroupAPI { }; } - // 获取用户组列表 + // 获取用户组 rpc GetGroup(GetGroupRequest) returns (Group) { option (google.api.http) = { get : '/api/v1/group', }; } + // 获取用户组列表 rpc ListGroup(ListGroupRequest) returns (ListGroupReply) { option (google.api.http) = { get : '/api/v1/group/list', diff --git a/api/v1/permission.pb.go b/api/v1/permission.pb.go index 91b64d7..4065eca 100644 --- a/api/v1/permission.pb.go +++ b/api/v1/permission.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 权限 type Permission struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` @@ -125,50 +126,7 @@ func (m *Permission) GetUpdatedAt() *time.Time { return nil } -type DeletePermissionRequest struct { - Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` -} - -func (m *DeletePermissionRequest) Reset() { *m = DeletePermissionRequest{} } -func (m *DeletePermissionRequest) String() string { return proto.CompactTextString(m) } -func (*DeletePermissionRequest) ProtoMessage() {} -func (*DeletePermissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f5311b1c95edab2, []int{1} -} -func (m *DeletePermissionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeletePermissionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeletePermissionRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeletePermissionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeletePermissionRequest.Merge(m, src) -} -func (m *DeletePermissionRequest) XXX_Size() int { - return m.Size() -} -func (m *DeletePermissionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeletePermissionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeletePermissionRequest proto.InternalMessageInfo - -func (m *DeletePermissionRequest) GetId() []int64 { - if m != nil { - return m.Id - } - return nil -} - +// 权限请求 type GetPermissionRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -177,7 +135,7 @@ func (m *GetPermissionRequest) Reset() { *m = GetPermissionRequest{} } func (m *GetPermissionRequest) String() string { return proto.CompactTextString(m) } func (*GetPermissionRequest) ProtoMessage() {} func (*GetPermissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f5311b1c95edab2, []int{2} + return fileDescriptor_6f5311b1c95edab2, []int{1} } func (m *GetPermissionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -213,6 +171,7 @@ func (m *GetPermissionRequest) GetId() int64 { return 0 } +// 权限响应 type GetPermissionReply struct { Permission *Permission `protobuf:"bytes,1,opt,name=permission,proto3" json:"permission,omitempty"` } @@ -221,7 +180,7 @@ func (m *GetPermissionReply) Reset() { *m = GetPermissionReply{} } func (m *GetPermissionReply) String() string { return proto.CompactTextString(m) } func (*GetPermissionReply) ProtoMessage() {} func (*GetPermissionReply) Descriptor() ([]byte, []int) { - return fileDescriptor_6f5311b1c95edab2, []int{3} + return fileDescriptor_6f5311b1c95edab2, []int{2} } func (m *GetPermissionReply) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -257,6 +216,7 @@ func (m *GetPermissionReply) GetPermission() *Permission { return nil } +// 权限列表请求 type ListPermissionRequest struct { Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size_ int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` @@ -269,7 +229,7 @@ func (m *ListPermissionRequest) Reset() { *m = ListPermissionRequest{} } func (m *ListPermissionRequest) String() string { return proto.CompactTextString(m) } func (*ListPermissionRequest) ProtoMessage() {} func (*ListPermissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f5311b1c95edab2, []int{4} + return fileDescriptor_6f5311b1c95edab2, []int{3} } func (m *ListPermissionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -333,6 +293,7 @@ func (m *ListPermissionRequest) GetPath() string { return "" } +// 权限列表响应 type ListPermissionReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Permission []*Permission `protobuf:"bytes,2,rep,name=permission,proto3" json:"permission,omitempty"` @@ -342,7 +303,7 @@ func (m *ListPermissionReply) Reset() { *m = ListPermissionReply{} } func (m *ListPermissionReply) String() string { return proto.CompactTextString(m) } func (*ListPermissionReply) ProtoMessage() {} func (*ListPermissionReply) Descriptor() ([]byte, []int) { - return fileDescriptor_6f5311b1c95edab2, []int{5} + return fileDescriptor_6f5311b1c95edab2, []int{4} } func (m *ListPermissionReply) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -387,7 +348,6 @@ func (m *ListPermissionReply) GetPermission() []*Permission { func init() { proto.RegisterType((*Permission)(nil), "api.v1.Permission") - proto.RegisterType((*DeletePermissionRequest)(nil), "api.v1.DeletePermissionRequest") proto.RegisterType((*GetPermissionRequest)(nil), "api.v1.GetPermissionRequest") proto.RegisterType((*GetPermissionReply)(nil), "api.v1.GetPermissionReply") proto.RegisterType((*ListPermissionRequest)(nil), "api.v1.ListPermissionRequest") @@ -397,42 +357,41 @@ func init() { func init() { proto.RegisterFile("api/v1/permission.proto", fileDescriptor_6f5311b1c95edab2) } var fileDescriptor_6f5311b1c95edab2 = []byte{ - // 549 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xb3, 0x76, 0x12, 0xd4, 0x89, 0x5a, 0xc1, 0x12, 0x1a, 0xe3, 0xb6, 0x8e, 0xe5, 0x03, - 0x0a, 0x1c, 0x6c, 0x25, 0x88, 0x0b, 0x1c, 0x50, 0x2a, 0x10, 0x20, 0x71, 0x88, 0x22, 0xb8, 0x20, - 0x55, 0x95, 0x1b, 0x2f, 0xe9, 0x4a, 0x76, 0x76, 0xb1, 0x37, 0xa9, 0x02, 0xb7, 0x3e, 0x41, 0x25, - 0x5e, 0x87, 0x07, 0xe0, 0x58, 0x89, 0x0b, 0x37, 0x50, 0xc2, 0x83, 0x20, 0xaf, 0xd7, 0x8d, 0x9b, - 0xb8, 0x82, 0xdb, 0xec, 0xcc, 0xec, 0xff, 0xcf, 0xce, 0xe7, 0x04, 0x5a, 0x3e, 0xa7, 0xde, 0xac, - 0xeb, 0x71, 0x12, 0x47, 0x34, 0x49, 0x28, 0x9b, 0xb8, 0x3c, 0x66, 0x82, 0xe1, 0xba, 0xcf, 0xa9, - 0x3b, 0xeb, 0x9a, 0xed, 0x31, 0x63, 0xe3, 0x90, 0x78, 0x32, 0x7b, 0x32, 0xfd, 0xe8, 0x09, 0x1a, - 0x91, 0x44, 0xf8, 0x11, 0xcf, 0x1a, 0xcd, 0xe6, 0x98, 0x8d, 0x99, 0x0c, 0xbd, 0x34, 0x52, 0xd9, - 0x7d, 0x75, 0x2d, 0x95, 0xf7, 0x27, 0x13, 0x26, 0x7c, 0x41, 0xd9, 0x24, 0x51, 0xd5, 0xbd, 0x75, - 0x51, 0x12, 0x71, 0x31, 0xcf, 0x8a, 0xce, 0xb9, 0x06, 0x30, 0xb8, 0x1a, 0x07, 0xef, 0x80, 0x46, - 0x03, 0x03, 0xd9, 0xa8, 0xa3, 0x0f, 0x35, 0x1a, 0xe0, 0x5d, 0xa8, 0x47, 0x44, 0x9c, 0xb2, 0xc0, - 0xd0, 0x6c, 0xd4, 0xd9, 0x1a, 0xaa, 0x13, 0xc6, 0x50, 0xe5, 0xbe, 0x38, 0x35, 0x74, 0x99, 0x95, - 0x31, 0x6e, 0x42, 0x4d, 0x50, 0x11, 0x12, 0xa3, 0x2a, 0x93, 0xd9, 0x01, 0xdb, 0xd0, 0x08, 0x48, - 0x32, 0x8a, 0x29, 0x4f, 0x67, 0x32, 0x6a, 0xb2, 0x56, 0x4c, 0xe1, 0xe7, 0x00, 0xa3, 0x98, 0xf8, - 0x82, 0x04, 0xc7, 0xbe, 0x30, 0xea, 0x36, 0xea, 0x34, 0x7a, 0xa6, 0x9b, 0x0d, 0xed, 0xe6, 0x43, - 0xbb, 0xef, 0xf2, 0x4d, 0x1c, 0x56, 0x2f, 0x7e, 0xb5, 0xd1, 0x70, 0x4b, 0xdd, 0xe9, 0x8b, 0x54, - 0x60, 0xca, 0x83, 0x5c, 0xe0, 0xd6, 0xff, 0x0a, 0xa8, 0x3b, 0x7d, 0xe1, 0x3c, 0x84, 0xd6, 0x0b, - 0x12, 0x12, 0x41, 0x56, 0x9b, 0x18, 0x92, 0x4f, 0x53, 0x92, 0x88, 0xab, 0x85, 0xe8, 0xd9, 0x42, - 0x9c, 0x07, 0xd0, 0x7c, 0x45, 0xc4, 0xcd, 0x7d, 0x6a, 0x71, 0xce, 0x6b, 0xc0, 0x6b, 0x7d, 0x3c, - 0x9c, 0xe3, 0x1e, 0xc0, 0x8a, 0xbd, 0xec, 0x6e, 0xf4, 0xb0, 0x9b, 0xc1, 0x77, 0x0b, 0xcd, 0x85, - 0x2e, 0xe7, 0x0b, 0xdc, 0x7b, 0x4b, 0x93, 0x12, 0x4b, 0xc9, 0x60, 0x4c, 0x94, 0xa9, 0x8c, 0xd3, - 0x5c, 0x42, 0x3f, 0x13, 0x49, 0x4b, 0x1f, 0xca, 0x38, 0x1d, 0xed, 0x2c, 0x50, 0xa4, 0xb4, 0xb3, - 0x22, 0xd3, 0xaa, 0xad, 0x97, 0x30, 0xad, 0xad, 0x98, 0x3a, 0xc7, 0x70, 0x77, 0xdd, 0x3c, 0x7d, - 0x47, 0x8a, 0x9a, 0x09, 0x3f, 0x54, 0xde, 0xd9, 0x61, 0xed, 0x75, 0x9a, 0xad, 0xff, 0xfb, 0x75, - 0xbd, 0x6f, 0x1a, 0x6c, 0xaf, 0x4a, 0xfd, 0xc1, 0x1b, 0x7c, 0x04, 0xb7, 0xdf, 0x4b, 0x32, 0x85, - 0xcf, 0xb2, 0x44, 0xc5, 0xdc, 0xdd, 0x20, 0xfc, 0x32, 0xfd, 0xae, 0x9d, 0x83, 0xf3, 0x1f, 0x7f, - 0xbe, 0x6a, 0x2d, 0x13, 0x7b, 0x1b, 0xbf, 0xb6, 0xa7, 0xe8, 0x11, 0x3e, 0x82, 0xed, 0x6b, 0x60, - 0xf0, 0x7e, 0xae, 0x5d, 0xc6, 0xd5, 0x2c, 0x71, 0x76, 0x4c, 0xe9, 0xd0, 0xc4, 0x25, 0x0e, 0x38, - 0x82, 0x9d, 0xeb, 0x0b, 0xc3, 0x07, 0xb9, 0x42, 0x29, 0x45, 0x73, 0xef, 0xa6, 0x32, 0x0f, 0xe7, - 0x4e, 0x5b, 0x3a, 0xdd, 0xc7, 0xad, 0x4d, 0x27, 0x2f, 0xa4, 0x89, 0x38, 0x7c, 0xf2, 0x7d, 0x61, - 0xa1, 0xcb, 0x85, 0x85, 0x7e, 0x2f, 0x2c, 0x74, 0xb1, 0xb4, 0x2a, 0x97, 0x4b, 0xab, 0xf2, 0x73, - 0x69, 0x55, 0x40, 0xfd, 0xa5, 0x0c, 0xd0, 0x87, 0x3b, 0x11, 0x8b, 0x49, 0xc0, 0x46, 0x4a, 0xe3, - 0xd9, 0xac, 0x7b, 0x52, 0x97, 0x3b, 0x7b, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xc9, 0x53, - 0xe7, 0x91, 0x04, 0x00, 0x00, + // 534 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xce, 0x3a, 0x3f, 0xa8, 0x13, 0xb5, 0x82, 0x25, 0x34, 0xc6, 0x6d, 0x1d, 0xcb, 0x07, 0x14, + 0x71, 0xb0, 0x95, 0x20, 0x2e, 0x70, 0x40, 0xa9, 0x84, 0x00, 0x89, 0x43, 0x14, 0xc1, 0x05, 0xa9, + 0xaa, 0xdc, 0x78, 0x71, 0x57, 0xb2, 0xb3, 0x8b, 0xbd, 0x49, 0x15, 0xb8, 0xf5, 0x09, 0x2a, 0xf1, + 0x3a, 0x3c, 0x00, 0xc7, 0x4a, 0x5c, 0xb8, 0x81, 0x12, 0x1e, 0x04, 0x79, 0xbd, 0x26, 0xae, 0x63, + 0x04, 0xb7, 0xd9, 0x99, 0xd9, 0xef, 0x9b, 0xf9, 0xbe, 0xb5, 0xa1, 0xeb, 0x71, 0xea, 0x2e, 0x06, + 0x2e, 0x27, 0x71, 0x44, 0x93, 0x84, 0xb2, 0x99, 0xc3, 0x63, 0x26, 0x18, 0x6e, 0x79, 0x9c, 0x3a, + 0x8b, 0x81, 0xd1, 0x0b, 0x18, 0x0b, 0x42, 0xe2, 0xca, 0xec, 0xd9, 0xfc, 0xbd, 0x2b, 0x68, 0x44, + 0x12, 0xe1, 0x45, 0x3c, 0x6b, 0x34, 0x3a, 0x01, 0x0b, 0x98, 0x0c, 0xdd, 0x34, 0x52, 0xd9, 0x43, + 0x75, 0x2d, 0x85, 0xf7, 0x66, 0x33, 0x26, 0x3c, 0x41, 0xd9, 0x2c, 0x51, 0xd5, 0x83, 0x32, 0x28, + 0x89, 0xb8, 0x58, 0x66, 0x45, 0xfb, 0x52, 0x03, 0x18, 0xff, 0x19, 0x07, 0xef, 0x81, 0x46, 0x7d, + 0x1d, 0x59, 0xa8, 0x5f, 0x9f, 0x68, 0xd4, 0xc7, 0xfb, 0xd0, 0x8a, 0x88, 0x38, 0x67, 0xbe, 0xae, + 0x59, 0xa8, 0xbf, 0x33, 0x51, 0x27, 0x8c, 0xa1, 0xc1, 0x3d, 0x71, 0xae, 0xd7, 0x65, 0x56, 0xc6, + 0xb8, 0x03, 0x4d, 0x41, 0x45, 0x48, 0xf4, 0x86, 0x4c, 0x66, 0x07, 0x6c, 0x41, 0xdb, 0x27, 0xc9, + 0x34, 0xa6, 0x3c, 0x9d, 0x49, 0x6f, 0xca, 0x5a, 0x31, 0x85, 0x9f, 0x01, 0x4c, 0x63, 0xe2, 0x09, + 0xe2, 0x9f, 0x7a, 0x42, 0x6f, 0x59, 0xa8, 0xdf, 0x1e, 0x1a, 0x4e, 0x36, 0xb4, 0x93, 0x0f, 0xed, + 0xbc, 0xc9, 0x95, 0x38, 0x6e, 0x5c, 0xfd, 0xe8, 0xa1, 0xc9, 0x8e, 0xba, 0x33, 0x12, 0x29, 0xc0, + 0x9c, 0xfb, 0x39, 0xc0, 0xad, 0xff, 0x05, 0x50, 0x77, 0x46, 0xc2, 0x7e, 0x00, 0x9d, 0x17, 0x44, + 0x6c, 0x64, 0x98, 0x90, 0x0f, 0x73, 0x92, 0x88, 0xb2, 0x1a, 0xf6, 0x4b, 0xc0, 0xa5, 0x3e, 0x1e, + 0x2e, 0xf1, 0x10, 0x60, 0x63, 0xa8, 0xec, 0x6e, 0x0f, 0xb1, 0x93, 0x39, 0xea, 0x14, 0x9a, 0x0b, + 0x5d, 0xf6, 0x27, 0xb8, 0xf7, 0x9a, 0x26, 0x15, 0x94, 0x52, 0xd8, 0x80, 0x28, 0x52, 0x19, 0xa7, + 0xb9, 0x84, 0x7e, 0x24, 0xd2, 0x82, 0xfa, 0x44, 0xc6, 0xe9, 0x68, 0x17, 0xbe, 0x92, 0x5f, 0xbb, + 0x28, 0x1a, 0xd5, 0xb0, 0xea, 0x15, 0x46, 0x35, 0x37, 0x46, 0xd9, 0xa7, 0x70, 0xb7, 0x4c, 0x9e, + 0xee, 0x91, 0xfa, 0xc7, 0x84, 0x17, 0x2a, 0xee, 0xec, 0x50, 0xda, 0x4e, 0xb3, 0xea, 0xff, 0xde, + 0x6e, 0xf8, 0x45, 0x83, 0xdd, 0x4d, 0x69, 0x34, 0x7e, 0x85, 0x4f, 0xe0, 0xf6, 0x5b, 0x29, 0x77, + 0xe1, 0xad, 0x55, 0xa0, 0x18, 0xfb, 0x5b, 0xb6, 0x3d, 0x4f, 0x1f, 0xab, 0x7d, 0x74, 0xf9, 0xed, + 0xd7, 0x67, 0xad, 0x6b, 0x60, 0x77, 0xeb, 0x13, 0x7a, 0x82, 0x1e, 0xe2, 0x13, 0xd8, 0xbd, 0x61, + 0x0c, 0x3e, 0xcc, 0xb1, 0xab, 0x7c, 0x35, 0x2a, 0x98, 0x6d, 0x43, 0x32, 0x74, 0x70, 0x05, 0x03, + 0x8e, 0x60, 0xef, 0xa6, 0x60, 0xf8, 0x28, 0x47, 0xa8, 0x74, 0xd1, 0x38, 0xf8, 0x5b, 0x99, 0x87, + 0x4b, 0xbb, 0x27, 0x99, 0xee, 0xe3, 0xee, 0x36, 0x93, 0x1b, 0xd2, 0x44, 0x1c, 0x3f, 0xfe, 0xba, + 0x32, 0xd1, 0xf5, 0xca, 0x44, 0x3f, 0x57, 0x26, 0xba, 0x5a, 0x9b, 0xb5, 0xeb, 0xb5, 0x59, 0xfb, + 0xbe, 0x36, 0x6b, 0xa0, 0xfe, 0x13, 0x63, 0xf4, 0xee, 0x4e, 0xc4, 0x62, 0xe2, 0xb3, 0xa9, 0xc2, + 0x78, 0xba, 0x18, 0x9c, 0xb5, 0xa4, 0x66, 0x8f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x20, 0x3d, + 0xbf, 0x9e, 0x66, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -447,8 +406,11 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type PermissionAPIClient interface { + // 更新权限信息。这里只能操作title和description UpdatePermission(ctx context.Context, in *Permission, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 查询权限信息 GetPermission(ctx context.Context, in *GetPermissionRequest, opts ...grpc.CallOption) (*Permission, error) + // 查询权限列表 ListPermission(ctx context.Context, in *ListPermissionRequest, opts ...grpc.CallOption) (*ListPermissionReply, error) } @@ -489,8 +451,11 @@ func (c *permissionAPIClient) ListPermission(ctx context.Context, in *ListPermis // PermissionAPIServer is the server API for PermissionAPI service. type PermissionAPIServer interface { + // 更新权限信息。这里只能操作title和description UpdatePermission(context.Context, *Permission) (*emptypb.Empty, error) + // 查询权限信息 GetPermission(context.Context, *GetPermissionRequest) (*Permission, error) + // 查询权限列表 ListPermission(context.Context, *ListPermissionRequest) (*ListPermissionReply, error) } @@ -663,48 +628,6 @@ func (m *Permission) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DeletePermissionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeletePermissionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeletePermissionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Id) > 0 { - dAtA4 := make([]byte, len(m.Id)*10) - var j3 int - for _, num1 := range m.Id { - num := uint64(num1) - for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j3++ - } - dAtA4[j3] = uint8(num) - j3++ - } - i -= j3 - copy(dAtA[i:], dAtA4[:j3]) - i = encodeVarintPermission(dAtA, i, uint64(j3)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *GetPermissionRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -913,22 +836,6 @@ func (m *Permission) Size() (n int) { return n } -func (m *DeletePermissionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Id) > 0 { - l = 0 - for _, e := range m.Id { - l += sovPermission(uint64(e)) - } - n += 1 + sovPermission(uint64(l)) + l - } - return n -} - func (m *GetPermissionRequest) Size() (n int) { if m == nil { return 0 @@ -1276,132 +1183,6 @@ func (m *Permission) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeletePermissionRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPermission - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeletePermissionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeletePermissionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPermission - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Id = append(m.Id, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPermission - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthPermission - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthPermission - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.Id) == 0 { - m.Id = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPermission - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Id = append(m.Id, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipPermission(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPermission - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *GetPermissionRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/api/v1/permission.proto b/api/v1/permission.proto index e18e773..bf73cdc 100644 --- a/api/v1/permission.proto +++ b/api/v1/permission.proto @@ -12,22 +12,26 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; +// 权限 message Permission { - int64 id = 1; - string method = 2; - string path = 3; - string title = 4; - string description = 5; - google.protobuf.Timestamp created_at = 6 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 7 [ (gogoproto.stdtime) = true ]; + int64 id = 1; // 权限ID + string method = 2; // 请求方法 + string path = 3; // 请求路径 + string title = 4; // 权限名称 + string description = 5; // 权限描述 + google.protobuf.Timestamp created_at = 6 + [ (gogoproto.stdtime) = true ]; // 创建时间 + google.protobuf.Timestamp updated_at = 7 + [ (gogoproto.stdtime) = true ]; // 更新时间 } -message DeletePermissionRequest { repeated int64 id = 1; } - +// 权限请求 message GetPermissionRequest { int64 id = 1; } +// 权限响应 message GetPermissionReply { Permission permission = 1; } +// 权限列表请求 message ListPermissionRequest { int64 page = 1; int64 size = 2; @@ -36,17 +40,15 @@ message ListPermissionRequest { string path = 5; } +// 权限列表响应 message ListPermissionReply { int64 total = 1; repeated Permission permission = 2; } -// message PermissionTree { -// Permission permission = 1; -// repeated PermissionTree children = 2; -// } - +// 权限API服务 service PermissionAPI { + // 更新权限信息。这里只能操作title和description rpc UpdatePermission(Permission) returns (google.protobuf.Empty) { option (google.api.http) = { put : '/api/v1/permission', @@ -54,21 +56,17 @@ service PermissionAPI { }; } + // 查询权限信息 rpc GetPermission(GetPermissionRequest) returns (Permission) { option (google.api.http) = { get : '/api/v1/permission', }; } + // 查询权限列表 rpc ListPermission(ListPermissionRequest) returns (ListPermissionReply) { option (google.api.http) = { get : '/api/v1/permission/list', }; } - -// rpc ListPermissionTree(google.protobuf.Empty) returns (PermissionTree) { -// option (google.api.http) = { -// get : '/api/v1/permission/tree', -// }; -// } } \ No newline at end of file diff --git a/api/v1/report.pb.go b/api/v1/report.pb.go index c4418b1..eff5b66 100644 --- a/api/v1/report.pb.go +++ b/api/v1/report.pb.go @@ -33,7 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// 这里是proto文件中的结构体,可以根据需要删除或者调整 +// 举报 type Report struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` DocumentId int64 `protobuf:"varint,2,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty"` @@ -150,6 +150,7 @@ func (m *Report) GetUsername() string { return "" } +// 删除举报请求 type DeleteReportRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -194,6 +195,7 @@ func (m *DeleteReportRequest) GetId() []int64 { return nil } +// 举报列表请求 type ListReportRequest struct { Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size_ int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` @@ -278,6 +280,7 @@ func (m *ListReportRequest) GetStatus() []bool { return nil } +// 举报列表响应 type ListReportReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Report []*Report `protobuf:"bytes,2,rep,name=report,proto3" json:"report,omitempty"` @@ -393,9 +396,13 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ReportAPIClient interface { + // 创建举报 CreateReport(ctx context.Context, in *Report, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 更新举报,审核举报内容 UpdateReport(ctx context.Context, in *Report, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 删除举报 DeleteReport(ctx context.Context, in *DeleteReportRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 获取举报列表 ListReport(ctx context.Context, in *ListReportRequest, opts ...grpc.CallOption) (*ListReportReply, error) } @@ -445,9 +452,13 @@ func (c *reportAPIClient) ListReport(ctx context.Context, in *ListReportRequest, // ReportAPIServer is the server API for ReportAPI service. type ReportAPIServer interface { + // 创建举报 CreateReport(context.Context, *Report) (*emptypb.Empty, error) + // 更新举报,审核举报内容 UpdateReport(context.Context, *Report) (*emptypb.Empty, error) + // 删除举报 DeleteReport(context.Context, *DeleteReportRequest) (*emptypb.Empty, error) + // 获取举报列表 ListReport(context.Context, *ListReportRequest) (*ListReportReply, error) } diff --git a/api/v1/report.proto b/api/v1/report.proto index 0dff240..c0d86cf 100644 --- a/api/v1/report.proto +++ b/api/v1/report.proto @@ -12,22 +12,26 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; -// 这里是proto文件中的结构体,可以根据需要删除或者调整 +// 举报 message Report { - int64 id = 1; - int64 document_id = 2; - int64 user_id = 3; - int32 reason = 4; - bool status = 5; - google.protobuf.Timestamp created_at = 6 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 7 [ (gogoproto.stdtime) = true ]; - string document_title = 8; - string remark = 9; - string username = 10; + int64 id = 1; // 举报ID + int64 document_id = 2; // 文档ID + int64 user_id = 3; // 举报人ID + int32 reason = 4; // 举报原因 + bool status = 5; // 举报处理状态 + google.protobuf.Timestamp created_at = 6 + [ (gogoproto.stdtime) = true ]; // 举报时间 + google.protobuf.Timestamp updated_at = 7 + [ (gogoproto.stdtime) = true ]; // 处理时间 + string document_title = 8; // 文档标题 + string remark = 9; // 处理备注 + string username = 10; // 举报人 } +// 删除举报请求 message DeleteReportRequest { repeated int64 id = 1; } +// 举报列表请求 message ListReportRequest { int64 page = 1; int64 size = 2; @@ -37,12 +41,16 @@ message ListReportRequest { repeated bool status = 6; } +// 举报列表响应 message ListReportReply { int64 total = 1; repeated Report report = 2; } +// 举报服务 service ReportAPI { + + // 创建举报 rpc CreateReport(Report) returns (google.protobuf.Empty) { option (google.api.http) = { post : '/api/v1/report', @@ -50,6 +58,7 @@ service ReportAPI { }; } + // 更新举报,审核举报内容 rpc UpdateReport(Report) returns (google.protobuf.Empty) { option (google.api.http) = { put : '/api/v1/report', @@ -57,12 +66,14 @@ service ReportAPI { }; } + // 删除举报 rpc DeleteReport(DeleteReportRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete : '/api/v1/report', }; } + // 获取举报列表 rpc ListReport(ListReportRequest) returns (ListReportReply) { option (google.api.http) = { get : '/api/v1/report/list', diff --git a/api/v1/user.pb.go b/api/v1/user.pb.go index 4e90c7c..6a6be25 100644 --- a/api/v1/user.pb.go +++ b/api/v1/user.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 用户信息 type User struct { LoginAt *time.Time `protobuf:"bytes,19,opt,name=login_at,json=loginAt,proto3,stdtime" json:"login_at,omitempty"` CreatedAt *time.Time `protobuf:"bytes,20,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` @@ -245,6 +246,7 @@ func (m *User) GetCreditCount() int32 { return 0 } +// 用户注册登录请求 type RegisterAndLoginRequest struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty" validate:"min=3,max=32"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" validate:"min=6"` @@ -321,6 +323,7 @@ func (m *RegisterAndLoginRequest) GetEmail() string { return "" } +// 查询验证码请求 type GetUserCaptchaRequest struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` } @@ -365,6 +368,7 @@ func (m *GetUserCaptchaRequest) GetType() string { return "" } +// 用户登录响应 type LoginReply struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` User *User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` @@ -417,6 +421,7 @@ func (m *LoginReply) GetUser() *User { return nil } +// 删除用户 type DeleteUserRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -461,6 +466,7 @@ func (m *DeleteUserRequest) GetId() []int64 { return nil } +// 获取用户信息 type GetUserRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -505,6 +511,7 @@ func (m *GetUserRequest) GetId() int64 { return 0 } +// 找回密码 type FindPasswordRequest struct { Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` @@ -581,6 +588,7 @@ func (m *FindPasswordRequest) GetCaptchaId() string { return "" } +// 用户列表请求 type ListUserRequest struct { Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size_ int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` @@ -681,6 +689,7 @@ func (m *ListUserRequest) GetLimit() int64 { return 0 } +// 用户列表响应 type ListUserReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` User []*User `protobuf:"bytes,2,rep,name=user,proto3" json:"user,omitempty"` @@ -733,6 +742,7 @@ func (m *ListUserReply) GetUser() []*User { return nil } +// 验证码响应 type GetUserCaptchaReply struct { Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` @@ -862,6 +872,7 @@ func (m *UpdateUserPasswordRequest) GetNewPassword() string { return "" } +// 用户权限信息查询 type GetUserPermissionsReply struct { Permission []*Permission `protobuf:"bytes,1,rep,name=permission,proto3" json:"permission,omitempty"` } @@ -906,6 +917,7 @@ func (m *GetUserPermissionsReply) GetPermission() []*Permission { return nil } +// 管理后台设置用户信息 type SetUserRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty" validate:"min=3,max=32"` @@ -982,6 +994,7 @@ func (m *SetUserRequest) GetEmail() string { return "" } +// 用户动态 type Dynamic struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` @@ -1074,6 +1087,7 @@ func (m *Dynamic) GetUpdatedAt() *time.Time { return nil } +// 用户动态列表请求 type ListUserDynamicRequest struct { Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size_ int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` @@ -1134,6 +1148,7 @@ func (m *ListUserDynamicRequest) GetId() int64 { return 0 } +// 用户动态列表响应 type ListUserDynamicReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Dynamic []*Dynamic `protobuf:"bytes,2,rep,name=dynamic,proto3" json:"dynamic,omitempty"` @@ -1186,6 +1201,7 @@ func (m *ListUserDynamicReply) GetDynamic() []*Dynamic { return nil } +// 用户签到 type Sign struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` @@ -1444,7 +1460,9 @@ type UserAPIClient interface { SignToday(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Sign, error) // 获取今日已签到记录 GetSignedToday(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Sign, error) + // 找回密码:第一步,发送验证码 FindPasswordStepOne(ctx context.Context, in *FindPasswordRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 找回密码:第二步,修改密码 FindPasswordStepTwo(ctx context.Context, in *FindPasswordRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } @@ -1655,7 +1673,9 @@ type UserAPIServer interface { SignToday(context.Context, *emptypb.Empty) (*Sign, error) // 获取今日已签到记录 GetSignedToday(context.Context, *emptypb.Empty) (*Sign, error) + // 找回密码:第一步,发送验证码 FindPasswordStepOne(context.Context, *FindPasswordRequest) (*emptypb.Empty, error) + // 找回密码:第二步,修改密码 FindPasswordStepTwo(context.Context, *FindPasswordRequest) (*emptypb.Empty, error) } diff --git a/api/v1/user.proto b/api/v1/user.proto index a1adb34..e37836f 100644 --- a/api/v1/user.proto +++ b/api/v1/user.proto @@ -13,129 +13,154 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; +// 用户信息 message User { - google.protobuf.Timestamp login_at = 19 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp created_at = 20 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 21 [ (gogoproto.stdtime) = true ]; - int64 id = 1; - string username = 2; - string mobile = 3; - string email = 4; - string address = 5; - string signature = 6; - string last_login_ip = 7; - string register_ip = 8; - int32 doc_count = 9; - int32 follow_count = 10; - int32 fans_count = 11; - int32 favorite_count = 12; - int32 comment_count = 13; - int32 status = 14; - string avatar = 15; - string identity = 16; - string realname = 17; - repeated int64 group_id = 18; - int32 credit_count = 22; + google.protobuf.Timestamp login_at = 19 + [ (gogoproto.stdtime) = true ]; // 最后登录时间 + google.protobuf.Timestamp created_at = 20 + [ (gogoproto.stdtime) = true ]; // 注册时间 + google.protobuf.Timestamp updated_at = 21 + [ (gogoproto.stdtime) = true ]; // 更新时间 + int64 id = 1; // 用户ID + string username = 2; // 用户名 + string mobile = 3; // 手机号 + string email = 4; // 邮箱,唯一 + string address = 5; // 地址 + string signature = 6; // 个性签名 + string last_login_ip = 7; // 最后登录IP + string register_ip = 8; // 注册IP + int32 doc_count = 9; // 文档数量 + int32 follow_count = 10; // 关注数量 + int32 fans_count = 11; // 粉丝数量 + int32 favorite_count = 12; // 收藏数量 + int32 comment_count = 13; // 评论数量 + int32 status = 14; // 用户状态,见 web/utils/enum.js,当前没有使用 + string avatar = 15; // 头像 + string identity = 16; // 身份证 + string realname = 17; // 真实姓名 + repeated int64 group_id = 18; // 用户组ID + int32 credit_count = 22; // 积分 } +// 用户注册登录请求 message RegisterAndLoginRequest { - string username = 1 [ (gogoproto.moretags) = "validate:\"min=3,max=32\"" ]; - string password = 2 [ (gogoproto.moretags) = "validate:\"min=6\"" ]; - string captcha = 3; - string captcha_id = 4; - string email = 5; + string username = 1 + [ (gogoproto.moretags) = "validate:\"min=3,max=32\"" ]; // 用户名 + string password = 2 [ (gogoproto.moretags) = "validate:\"min=6\"" ]; // 密码 + string captcha = 3; // 验证码 + string captcha_id = 4; // 验证码ID + string email = 5; // 邮箱 } +// 查询验证码请求 message GetUserCaptchaRequest { string type = 1; // 验证码类型:register、login、comment、find_password、upload } +// 用户登录响应 message LoginReply { string token = 1; User user = 2; } +// 删除用户 message DeleteUserRequest { repeated int64 id = 1; } +// 获取用户信息 message GetUserRequest { int64 id = 1; } +// 找回密码 message FindPasswordRequest { - string email = 1; - string token = 2; - string password = 3 [ (gogoproto.moretags) = "validate:\"min=6\"" ]; - string captcha = 4; - string captcha_id = 5; + string email = 1; // 邮箱 + string token = 2; // 签名token + string password = 3 [ (gogoproto.moretags) = "validate:\"min=6\"" ]; // 新密码 + string captcha = 4; // 验证码 + string captcha_id = 5; // 验证码ID } +// 用户列表请求 message ListUserRequest { - int64 page = 1; - int64 size = 2; - string wd = 3; - string sort = 4; - repeated int64 id = 5; - repeated int64 group_id = 6; - repeated int32 status = 7; - int64 limit = 8; + int64 page = 1; // 页码 + int64 size = 2; // 每页数量 + string wd = 3; // 搜索关键词 + string sort = 4; // 排序字段 + repeated int64 id = 5; // 用户ID + repeated int64 group_id = 6; // 用户组ID + repeated int32 status = 7; // 用户状态 + int64 limit = 8; // 请求数量限制,大于0时,page和size无效 } +// 用户列表响应 message ListUserReply { - int64 total = 1; - repeated User user = 2; + int64 total = 1; // 总数 + repeated User user = 2; // 用户列表 } +// 验证码响应 message GetUserCaptchaReply { - bool enable = 1; - string id = 2; - string captcha = 3; - string type = 4; + bool enable = 1; // 是否启用验证码 + string id = 2; // 验证码ID + string captcha = 3; // 验证码 + string type = 4; // 验证码类型 } // 修改用户密码 message UpdateUserPasswordRequest { - int64 id = 1; - string old_password = 2; - string new_password = 3 [ (gogoproto.moretags) = "validate:\"min=6\"" ]; + int64 id = 1; // 用户ID + string old_password = 2; // 旧密码 + string new_password = 3 + [ (gogoproto.moretags) = "validate:\"min=6\"" ]; // 新密码 } +// 用户权限信息查询 message GetUserPermissionsReply { repeated Permission permission = 1; } +// 管理后台设置用户信息 message SetUserRequest { - int64 id = 1; - string username = 2 [ (gogoproto.moretags) = "validate:\"min=3,max=32\"" ]; - string password = 3 [ (gogoproto.moretags) = "validate:\"min=6\"" ]; - repeated int64 group_id = 4; - string email = 5; + int64 id = 1; // 用户ID + string username = 2 + [ (gogoproto.moretags) = "validate:\"min=3,max=32\"" ]; // 用户名 + string password = 3 [ (gogoproto.moretags) = "validate:\"min=6\"" ]; // 密码 + repeated int64 group_id = 4; // 用户组ID + string email = 5; // 邮箱 } +// 用户动态 message Dynamic { - int64 id = 1; - int64 user_id = 2; - string content = 3; - int32 type = 4; // 类型 - string username = 7; - google.protobuf.Timestamp created_at = 5 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 6 [ (gogoproto.stdtime) = true ]; + int64 id = 1; // 动态ID + int64 user_id = 2; // 用户ID + string content = 3; // 内容 + int32 type = 4; // 类型 + string username = 7; // 用户名 + google.protobuf.Timestamp created_at = 5 + [ (gogoproto.stdtime) = true ]; // 创建时间 + google.protobuf.Timestamp updated_at = 6 + [ (gogoproto.stdtime) = true ]; // 更新时间 } +// 用户动态列表请求 message ListUserDynamicRequest { - int64 page = 1; - int64 size = 2; - int64 id = 3; + int64 page = 1; // 页码 + int64 size = 2; // 每页数量 + int64 id = 3; // 用户ID } +// 用户动态列表响应 message ListUserDynamicReply { - int64 total = 1; - repeated Dynamic dynamic = 2; + int64 total = 1; // 总数 + repeated Dynamic dynamic = 2; // 动态列表 } +// 用户签到 message Sign { - int64 id = 1; - int64 user_id = 2; - int32 sign_at = 3; - string ip = 4; - google.protobuf.Timestamp created_at = 5 [ (gogoproto.stdtime) = true ]; - int32 award = 6; // 签到积分奖励 + int64 id = 1; // 签到ID + int64 user_id = 2; // 用户ID + int32 sign_at = 3; // 签到日期 + string ip = 4; // 签到IP + google.protobuf.Timestamp created_at = 5 + [ (gogoproto.stdtime) = true ]; // 创建时间 + int32 award = 6; // 签到积分奖励 } service UserAPI { @@ -263,6 +288,7 @@ service UserAPI { }; } + // 找回密码:第一步,发送验证码 rpc FindPasswordStepOne(FindPasswordRequest) returns (google.protobuf.Empty) { option (google.api.http) = { post : '/api/v1/user/findpassword/stepone', @@ -270,6 +296,7 @@ service UserAPI { }; } + // 找回密码:第二步,修改密码 rpc FindPasswordStepTwo(FindPasswordRequest) returns (google.protobuf.Empty) { option (google.api.http) = { put : '/api/v1/user/findpassword/steptwo', diff --git a/docs/api/apis.md b/docs/api/apis.md new file mode 100644 index 0000000..1b077e5 --- /dev/null +++ b/docs/api/apis.md @@ -0,0 +1,2481 @@ +# Protocol Documentation + + +## Table of Contents + +- [api/v1/article.proto](#api_v1_article-proto) + - [Article](#api-v1-Article) + - [DeleteArticleRequest](#api-v1-DeleteArticleRequest) + - [GetArticleRequest](#api-v1-GetArticleRequest) + - [ListArticleReply](#api-v1-ListArticleReply) + - [ListArticleRequest](#api-v1-ListArticleRequest) + + - [ArticleAPI](#api-v1-ArticleAPI) + +- [api/v1/attachment.proto](#api_v1_attachment-proto) + - [Attachment](#api-v1-Attachment) + - [DeleteAttachmentRequest](#api-v1-DeleteAttachmentRequest) + - [GetAttachmentRequest](#api-v1-GetAttachmentRequest) + - [ListAttachmentReply](#api-v1-ListAttachmentReply) + - [ListAttachmentRequest](#api-v1-ListAttachmentRequest) + + - [AttachmentAPI](#api-v1-AttachmentAPI) + +- [api/v1/banner.proto](#api_v1_banner-proto) + - [Banner](#api-v1-Banner) + - [DeleteBannerRequest](#api-v1-DeleteBannerRequest) + - [GetBannerRequest](#api-v1-GetBannerRequest) + - [ListBannerReply](#api-v1-ListBannerReply) + - [ListBannerRequest](#api-v1-ListBannerRequest) + + - [BannerAPI](#api-v1-BannerAPI) + +- [api/v1/category.proto](#api_v1_category-proto) + - [Category](#api-v1-Category) + - [DeleteCategoryRequest](#api-v1-DeleteCategoryRequest) + - [GetCategoryRequest](#api-v1-GetCategoryRequest) + - [ListCategoryReply](#api-v1-ListCategoryReply) + - [ListCategoryRequest](#api-v1-ListCategoryRequest) + + - [CategoryAPI](#api-v1-CategoryAPI) + +- [api/v1/comment.proto](#api_v1_comment-proto) + - [CheckCommentRequest](#api-v1-CheckCommentRequest) + - [Comment](#api-v1-Comment) + - [CreateCommentRequest](#api-v1-CreateCommentRequest) + - [DeleteCommentRequest](#api-v1-DeleteCommentRequest) + - [GetCommentRequest](#api-v1-GetCommentRequest) + - [ListCommentReply](#api-v1-ListCommentReply) + - [ListCommentRequest](#api-v1-ListCommentRequest) + + - [CommentAPI](#api-v1-CommentAPI) + +- [api/v1/config.proto](#api_v1_config-proto) + - [Config](#api-v1-Config) + - [ConfigCaptcha](#api-v1-ConfigCaptcha) + - [ConfigFooter](#api-v1-ConfigFooter) + - [ConfigSecurity](#api-v1-ConfigSecurity) + - [ConfigSystem](#api-v1-ConfigSystem) + - [Configs](#api-v1-Configs) + - [EnvDependent](#api-v1-EnvDependent) + - [Envs](#api-v1-Envs) + - [ListConfigRequest](#api-v1-ListConfigRequest) + - [Settings](#api-v1-Settings) + - [Stats](#api-v1-Stats) + + - [ConfigAPI](#api-v1-ConfigAPI) + +- [api/v1/document.proto](#api_v1_document-proto) + - [CreateDocumentItem](#api-v1-CreateDocumentItem) + - [CreateDocumentRequest](#api-v1-CreateDocumentRequest) + - [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest) + - [Document](#api-v1-Document) + - [DocumentScore](#api-v1-DocumentScore) + - [DownloadDocumentReply](#api-v1-DownloadDocumentReply) + - [GetDocumentRequest](#api-v1-GetDocumentRequest) + - [ListDocumentForHomeItem](#api-v1-ListDocumentForHomeItem) + - [ListDocumentForHomeRequest](#api-v1-ListDocumentForHomeRequest) + - [ListDocumentForHomeResponse](#api-v1-ListDocumentForHomeResponse) + - [ListDocumentReply](#api-v1-ListDocumentReply) + - [ListDocumentRequest](#api-v1-ListDocumentRequest) + - [RecoverRecycleDocumentRequest](#api-v1-RecoverRecycleDocumentRequest) + - [SearchDocumentReply](#api-v1-SearchDocumentReply) + - [SearchDocumentRequest](#api-v1-SearchDocumentRequest) + - [SetDocumentRecommendRequest](#api-v1-SetDocumentRecommendRequest) + + - [DocumentAPI](#api-v1-DocumentAPI) + - [RecycleAPI](#api-v1-RecycleAPI) + +- [api/v1/favorite.proto](#api_v1_favorite-proto) + - [DeleteFavoriteRequest](#api-v1-DeleteFavoriteRequest) + - [Favorite](#api-v1-Favorite) + - [GetFavoriteRequest](#api-v1-GetFavoriteRequest) + - [ListFavoriteReply](#api-v1-ListFavoriteReply) + - [ListFavoriteRequest](#api-v1-ListFavoriteRequest) + + - [FavoriteAPI](#api-v1-FavoriteAPI) + +- [api/v1/friendlink.proto](#api_v1_friendlink-proto) + - [DeleteFriendlinkRequest](#api-v1-DeleteFriendlinkRequest) + - [Friendlink](#api-v1-Friendlink) + - [GetFriendlinkRequest](#api-v1-GetFriendlinkRequest) + - [ListFriendlinkReply](#api-v1-ListFriendlinkReply) + - [ListFriendlinkRequest](#api-v1-ListFriendlinkRequest) + + - [FriendlinkAPI](#api-v1-FriendlinkAPI) + +- [api/v1/group.proto](#api_v1_group-proto) + - [DeleteGroupRequest](#api-v1-DeleteGroupRequest) + - [GetGroupPermissionRequest](#api-v1-GetGroupPermissionRequest) + - [GetGroupRequest](#api-v1-GetGroupRequest) + - [Group](#api-v1-Group) + - [GroupPermissions](#api-v1-GroupPermissions) + - [ListGroupReply](#api-v1-ListGroupReply) + - [ListGroupRequest](#api-v1-ListGroupRequest) + - [UpdateGroupPermissionRequest](#api-v1-UpdateGroupPermissionRequest) + + - [GroupAPI](#api-v1-GroupAPI) + +- [api/v1/health.proto](#api_v1_health-proto) + - [PingRequest](#-PingRequest) + - [PongReply](#-PongReply) + + - [HealthAPI](#-HealthAPI) + +- [api/v1/permission.proto](#api_v1_permission-proto) + - [GetPermissionReply](#api-v1-GetPermissionReply) + - [GetPermissionRequest](#api-v1-GetPermissionRequest) + - [ListPermissionReply](#api-v1-ListPermissionReply) + - [ListPermissionRequest](#api-v1-ListPermissionRequest) + - [Permission](#api-v1-Permission) + + - [PermissionAPI](#api-v1-PermissionAPI) + +- [api/v1/report.proto](#api_v1_report-proto) + - [DeleteReportRequest](#api-v1-DeleteReportRequest) + - [ListReportReply](#api-v1-ListReportReply) + - [ListReportRequest](#api-v1-ListReportRequest) + - [Report](#api-v1-Report) + + - [ReportAPI](#api-v1-ReportAPI) + +- [api/v1/user.proto](#api_v1_user-proto) + - [DeleteUserRequest](#api-v1-DeleteUserRequest) + - [Dynamic](#api-v1-Dynamic) + - [FindPasswordRequest](#api-v1-FindPasswordRequest) + - [GetUserCaptchaReply](#api-v1-GetUserCaptchaReply) + - [GetUserCaptchaRequest](#api-v1-GetUserCaptchaRequest) + - [GetUserPermissionsReply](#api-v1-GetUserPermissionsReply) + - [GetUserRequest](#api-v1-GetUserRequest) + - [ListUserDynamicReply](#api-v1-ListUserDynamicReply) + - [ListUserDynamicRequest](#api-v1-ListUserDynamicRequest) + - [ListUserReply](#api-v1-ListUserReply) + - [ListUserRequest](#api-v1-ListUserRequest) + - [LoginReply](#api-v1-LoginReply) + - [RegisterAndLoginRequest](#api-v1-RegisterAndLoginRequest) + - [SetUserRequest](#api-v1-SetUserRequest) + - [Sign](#api-v1-Sign) + - [UpdateUserPasswordRequest](#api-v1-UpdateUserPasswordRequest) + - [User](#api-v1-User) + + - [UserAPI](#api-v1-UserAPI) + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## api/v1/article.proto + + + + + +### Article +文章 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 文章ID | +| identifier | [string](#string) | | 文章唯一标识 | +| author | [string](#string) | | 文章作者。如果为空,则使用网站名称作为作者 | +| view_count | [int64](#int64) | | 文章浏览次数 | +| title | [string](#string) | | 文章标题 | +| keywords | [string](#string) | | 文章关键字 | +| description | [string](#string) | | 文章描述 | +| content | [string](#string) | | 文章内容 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 文章创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 文章更新时间 | + + + + + + + + +### DeleteArticleRequest +删除文章请求,传入单个或者多个文章ID + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### GetArticleRequest +根据ID或者文章标识获取文章,二选一 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 文章ID | +| identifier | [string](#string) | | 文章唯一标识 | + + + + + + + + +### ListArticleReply +文章列表响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 文章总数 | +| article | [Article](#api-v1-Article) | repeated | 文章列表 | + + + + + + + + +### ListArticleRequest +文章列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| wd | [string](#string) | | 搜索关键字 | +| field | [string](#string) | repeated | 查询字段 | +| order | [string](#string) | | 排序字段,根据指定的字段倒序排序 | + + + + + + + + + + + + + + +### ArticleAPI +文章API服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateArticle | [Article](#api-v1-Article) | [.google.protobuf.Empty](#google-protobuf-Empty) | 创建文章 | +| UpdateArticle | [Article](#api-v1-Article) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新文章 | +| DeleteArticle | [DeleteArticleRequest](#api-v1-DeleteArticleRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除文章 | +| GetArticle | [GetArticleRequest](#api-v1-GetArticleRequest) | [Article](#api-v1-Article) | 获取文章 | +| ListArticle | [ListArticleRequest](#api-v1-ListArticleRequest) | [ListArticleReply](#api-v1-ListArticleReply) | 文章列表 | + + + + + + +

Top

+ +## api/v1/attachment.proto + + + + + +### Attachment +附件 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 附件ID | +| hash | [string](#string) | | 附件哈希值,MD5 | +| user_id | [int64](#int64) | | 上传用户ID | +| type_id | [int64](#int64) | | 附件类型ID,如果是文档类型,则为文档ID | +| type | [int32](#int32) | | 附件类型,见 web/utils/enum.js | +| enable | [bool](#bool) | | 是否启用 | +| path | [string](#string) | | 附件路径 | +| name | [string](#string) | | 附件名称 | +| size | [int64](#int64) | | 附件大小,单位:字节 | +| width | [int64](#int64) | | 附件宽度,单位:像素。针对图片附件 | +| height | [int64](#int64) | | 附件高度,单位:像素。针对图片附件 | +| ext | [string](#string) | | 扩展名,如:.docx | +| ip | [string](#string) | | 上传IP地址 | +| username | [string](#string) | | 用户名称 | +| type_name | [string](#string) | | 附件类型名称 | +| description | [string](#string) | | 附件描述、备注 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### DeleteAttachmentRequest +删除附件请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### GetAttachmentRequest +获取附件请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### ListAttachmentReply +列出附件响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | | +| attachment | [Attachment](#api-v1-Attachment) | repeated | | + + + + + + + + +### ListAttachmentRequest +列出附件请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| wd | [string](#string) | | 搜索关键字 | +| enable | [bool](#bool) | repeated | 是否启用 | +| user_id | [int64](#int64) | repeated | 用户ID | +| type | [int64](#int64) | repeated | 类型 | +| ext | [string](#string) | | 扩展名 | + + + + + + + + + + + + + + +### AttachmentAPI +附件服务。只有管理员才有权限操作 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| UpdateAttachment | [Attachment](#api-v1-Attachment) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新附件 | +| DeleteAttachment | [DeleteAttachmentRequest](#api-v1-DeleteAttachmentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除附件。这里只是软删除,不会真正删除附件,默认24小时候会真正清除附件 | +| GetAttachment | [GetAttachmentRequest](#api-v1-GetAttachmentRequest) | [Attachment](#api-v1-Attachment) | 查询附件 | +| ListAttachment | [ListAttachmentRequest](#api-v1-ListAttachmentRequest) | [ListAttachmentReply](#api-v1-ListAttachmentReply) | 列出附件 | + + + + + + +

Top

+ +## api/v1/banner.proto + + + + + +### Banner +banner,轮播图 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 主键 | +| title | [string](#string) | | 标题,名称 | +| path | [string](#string) | | 图片地址 | +| sort | [int32](#int32) | | 排序,值越大越靠前 | +| enable | [bool](#bool) | | 是否启用 | +| type | [int32](#int32) | | 类型,如PC横幅、小程序横幅等,见 web/utils/enum.js 中的枚举 | +| url | [string](#string) | | 跳转地址 | +| description | [string](#string) | | 描述 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### DeleteBannerRequest +删除横幅 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### GetBannerRequest +获取横幅 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### ListBannerReply +横幅列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 总数 | +| banner | [Banner](#api-v1-Banner) | repeated | 横幅数组 | + + + + + + + + +### ListBannerRequest +横幅列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| type | [int32](#int32) | repeated | 类型 | +| enable | [bool](#bool) | repeated | 是否启用 | +| wd | [string](#string) | | 搜索关键字 | +| field | [string](#string) | repeated | 查询字段,不指定,则查询全部 | + + + + + + + + + + + + + + +### BannerAPI +横幅API服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateBanner | [Banner](#api-v1-Banner) | [Banner](#api-v1-Banner) | 创建横幅 | +| UpdateBanner | [Banner](#api-v1-Banner) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新横幅 | +| DeleteBanner | [DeleteBannerRequest](#api-v1-DeleteBannerRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除横幅 | +| GetBanner | [GetBannerRequest](#api-v1-GetBannerRequest) | [Banner](#api-v1-Banner) | 查询横幅 | +| ListBanner | [ListBannerRequest](#api-v1-ListBannerRequest) | [ListBannerReply](#api-v1-ListBannerReply) | 横幅列表 | + + + + + + +

Top

+ +## api/v1/category.proto + + + + + +### Category +文档分类 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | 分类ID | +| parent_id | [int32](#int32) | | 父分类ID | +| title | [string](#string) | | 分类标题 | +| doc_count | [int32](#int32) | | 文档数量 | +| sort | [int32](#int32) | | 排序,倒序排序,值越大越靠前 | +| enable | [bool](#bool) | | 是否启用 | +| cover | [string](#string) | | 分类封面 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### DeleteCategoryRequest +删除分类请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### GetCategoryRequest +获取分类请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### ListCategoryReply +分类列表响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 总数 | +| category | [Category](#api-v1-Category) | repeated | 分类列表 | + + + + + + + + +### ListCategoryRequest +分类列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| parent_id | [int64](#int64) | repeated | 父分类ID | +| wd | [string](#string) | | 搜索关键字 | +| enable | [bool](#bool) | repeated | 是否启用 | +| field | [string](#string) | repeated | 查询字段 | + + + + + + + + + + + + + + +### CategoryAPI +文档分类API服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateCategory | [Category](#api-v1-Category) | [.google.protobuf.Empty](#google-protobuf-Empty) | 创建分类 | +| UpdateCategory | [Category](#api-v1-Category) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新分类 | +| DeleteCategory | [DeleteCategoryRequest](#api-v1-DeleteCategoryRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除分类 | +| GetCategory | [GetCategoryRequest](#api-v1-GetCategoryRequest) | [Category](#api-v1-Category) | 获取分类 | +| ListCategory | [ListCategoryRequest](#api-v1-ListCategoryRequest) | [ListCategoryReply](#api-v1-ListCategoryReply) | 分类列表 | + + + + + + +

Top

+ +## api/v1/comment.proto + + + + + +### CheckCommentRequest +审核评论,修改评论状态 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | 评论ID | +| status | [int32](#int32) | | 状态,见 web/utils/enum.js 枚举 | + + + + + + + + +### Comment +评论 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | +| id | [int64](#int64) | | 评论ID | +| parent_id | [int64](#int64) | | 父评论ID | +| content | [string](#string) | | 评论内容 | +| document_id | [int64](#int64) | | 文档ID | +| status | [int32](#int32) | | 状态,见 web/utils/enum.js 枚举 | +| comment_count | [int32](#int32) | | 回复数量 | +| user_id | [int64](#int64) | | 用户ID | +| user | [User](#api-v1-User) | | 用户信息 | +| document_title | [string](#string) | | 文档标题 | + + + + + + + + +### CreateCommentRequest +创建评论请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| document_id | [int64](#int64) | | 文档ID | +| parent_id | [int64](#int64) | | 父评论ID | +| content | [string](#string) | | 评论内容 | +| captcha_id | [string](#string) | | 验证码ID | +| captcha | [string](#string) | | 验证码 | + + + + + + + + +### DeleteCommentRequest +删除评论请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### GetCommentRequest +获取评论请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### ListCommentReply +获取评论列表响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 总数 | +| comment | [Comment](#api-v1-Comment) | repeated | 评论列表 | + + + + + + + + +### ListCommentRequest +获取评论列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| wd | [string](#string) | | 搜索关键词 | +| field | [string](#string) | repeated | 查询的数据字段 | +| order | [string](#string) | | 排序字段 | +| status | [int32](#int32) | repeated | 状态,见 web/utils/enum.js 枚举 | +| document_id | [int64](#int64) | | 文档ID | +| user_id | [int64](#int64) | | 用户ID | +| parent_id | [int64](#int64) | repeated | 父评论ID | +| with_document_title | [bool](#bool) | | 是否返回文档标题 | + + + + + + + + + + + + + + +### CommentAPI +评论服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateComment | [CreateCommentRequest](#api-v1-CreateCommentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 创建评论 | +| UpdateComment | [Comment](#api-v1-Comment) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新评论,仅限管理员操作 | +| DeleteComment | [DeleteCommentRequest](#api-v1-DeleteCommentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 管理员或用户自己删除自己的评论 | +| GetComment | [GetCommentRequest](#api-v1-GetCommentRequest) | [Comment](#api-v1-Comment) | 获取单个评论 | +| ListComment | [ListCommentRequest](#api-v1-ListCommentRequest) | [ListCommentReply](#api-v1-ListCommentReply) | 获取评论列表 | +| CheckComment | [CheckCommentRequest](#api-v1-CheckCommentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 审核评论 | + + + + + + +

Top

+ +## api/v1/config.proto + + + + + +### Config +配置 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 配置ID | +| label | [string](#string) | | 配置标签 | +| name | [string](#string) | | 配置名称 | +| value | [string](#string) | | 配置值 | +| placeholder | [string](#string) | | 配置占位符 | +| input_type | [string](#string) | | 输入类型,如:textarea、number、switch等 | +| category | [string](#string) | | 配置分类,如:system、footer、security等,见 web/utils/enum.js | +| sort | [int32](#int32) | | 排序,越小越靠前 | +| options | [string](#string) | | 配置项枚举,一个一行,如select的option选项,用 key=value 的形式 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### ConfigCaptcha +验证码配置 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| length | [int32](#int32) | | 验证码长度 | +| width | [int32](#int32) | | 验证码宽度 | +| height | [int32](#int32) | | 验证码高度 | +| type | [string](#string) | | 验证码类型,见 web/utils/enum.js | + + + + + + + + +### ConfigFooter +底链配置项,为跳转的链接地址 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| about | [string](#string) | | 关于我们 | +| contact | [string](#string) | | 联系我们 | +| agreement | [string](#string) | | 用户协议、文库协议 | +| copyright | [string](#string) | | 版权声明 | +| feedback | [string](#string) | | 意见和建议反馈 | + + + + + + + + +### ConfigSecurity +安全配置 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| is_close | [bool](#bool) | | 是否关闭站点 | +| close_statement | [string](#string) | | 关闭站点的说明,支持HTML | +| enable_register | [bool](#bool) | | 是否开放注册 | +| enable_captcha_login | [bool](#bool) | | 是否开启登录验证码 | +| enable_captcha_register | [bool](#bool) | | 是否开启注册验证码 | +| enable_captcha_comment | [bool](#bool) | | 是否开启评论验证码 | +| enable_captcha_find_password | [bool](#bool) | | 是否开启找回密码验证码 | +| enable_captcha_upload | [bool](#bool) | | 是否开启上传验证码 | +| max_document_size | [int32](#int32) | | 文档最大大小 | +| document_allowed_ext | [string](#string) | repeated | 文档允许的扩展名 | +| login_required | [bool](#bool) | | 是否登录才能访问 | + + + + + + + + +### ConfigSystem +系统配置项 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| domain | [string](#string) | | 站点域名,如: https://moredoc.mnt.ltd | +| title | [string](#string) | | 站点标题,首页显示 | +| keywords | [string](#string) | | 站点关键词,SEO用 | +| description | [string](#string) | | 站点描述,SEO用 | +| logo | [string](#string) | | 站点logo | +| favicon | [string](#string) | | 站点favicon | +| icp | [string](#string) | | 站点备案号 | +| analytics | [string](#string) | | 站点统计代码,目前只支持百度统计 | +| sitename | [string](#string) | | 站点名称 | +| copyright_start_year | [string](#string) | | 站点版权起始年份,如:2018,则底部显示 2018 - 2023 | +| register_background | [string](#string) | | 注册页背景图 | +| login_background | [string](#string) | | 登录页背景图 | +| recommend_words | [string](#string) | repeated | 推荐搜索词,首页展示 | +| version | [string](#string) | | 程序版本号 | + + + + + + + + +### Configs +配置列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| config | [Config](#api-v1-Config) | repeated | | + + + + + + + + +### EnvDependent +依赖项 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | 依赖名称 | +| description | [string](#string) | | 依赖描述 | +| is_installed | [bool](#bool) | | 是否已安装 | +| error | [string](#string) | | 错误信息 | +| checked_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 检测时间 | +| cmd | [string](#string) | | 检测命令 | +| is_required | [bool](#bool) | | 是否必须 | + + + + + + + + +### Envs +依赖项列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| envs | [EnvDependent](#api-v1-EnvDependent) | repeated | | + + + + + + + + +### ListConfigRequest +查询配置项请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| category | [string](#string) | repeated | | + + + + + + + + +### Settings +系统配置 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| system | [ConfigSystem](#api-v1-ConfigSystem) | | 系统配置 | +| footer | [ConfigFooter](#api-v1-ConfigFooter) | | 底链配置 | +| security | [ConfigSecurity](#api-v1-ConfigSecurity) | | 安全配置 | + + + + + + + + +### Stats +系统状态 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| user_count | [int64](#int64) | | 用户数量 | +| document_count | [int64](#int64) | | 文档数量 | +| category_count | [int64](#int64) | | 分类数量 | +| article_count | [int64](#int64) | | 文章数量 | +| comment_count | [int64](#int64) | | 评论数量 | +| banner_count | [int64](#int64) | | banner数量 | +| friendlink_count | [int64](#int64) | | 友情链接数量 | +| os | [string](#string) | | 操作系统 | +| version | [string](#string) | | 程序版本号 | +| hash | [string](#string) | | 程序构建时的 git hash | +| build_at | [string](#string) | | 程序构建时间 | +| report_count | [int64](#int64) | | 举报数量 | + + + + + + + + + + + + + + +### ConfigAPI +配置服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| GetSettings | [.google.protobuf.Empty](#google-protobuf-Empty) | [Settings](#api-v1-Settings) | 获取系统配置(针对所有用户,只读) | +| UpdateConfig | [Configs](#api-v1-Configs) | [.google.protobuf.Empty](#google-protobuf-Empty) | UpdateConfig 更新配置 | +| ListConfig | [ListConfigRequest](#api-v1-ListConfigRequest) | [Configs](#api-v1-Configs) | ListConfig 查询配置项 | +| GetStats | [.google.protobuf.Empty](#google-protobuf-Empty) | [Stats](#api-v1-Stats) | 获取系统配置 | +| GetEnvs | [.google.protobuf.Empty](#google-protobuf-Empty) | [Envs](#api-v1-Envs) | 获取系统环境依赖检测 | +| UpdateSitemap | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新站点地图 | + + + + + + +

Top

+ +## api/v1/document.proto + + + + + +### CreateDocumentItem +创建文档 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| title | [string](#string) | | 文档标题 | +| attachment_id | [int64](#int64) | | 文档附件ID | +| price | [int32](#int32) | | 文档价格 | + + + + + + + + +### CreateDocumentRequest +创建文档 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| overwrite | [bool](#bool) | | 是否覆盖。暂时用不到 | +| category_id | [int64](#int64) | repeated | 文档分类ID | +| document | [CreateDocumentItem](#api-v1-CreateDocumentItem) | repeated | 文档列表 | + + + + + + + + +### DeleteDocumentRequest +删除文档,放入回收站 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### Document +文档 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 文档ID | +| title | [string](#string) | | 文档标题 | +| keywords | [string](#string) | | 文档关键字 | +| description | [string](#string) | | 文档描述 | +| user_id | [int64](#int64) | | 文档作者 | +| cover | [string](#string) | | 文档封面 | +| width | [int32](#int32) | | 文档宽度 | +| height | [int32](#int32) | | 文档高度 | +| preview | [int32](#int32) | | 文档可预览页数,0表示不限制 | +| pages | [int32](#int32) | | 文档页数 | +| uuid | [string](#string) | | 文档UUID | +| download_count | [int32](#int32) | | 文档下载次数 | +| view_count | [int32](#int32) | | 文档浏览次数 | +| favorite_count | [int32](#int32) | | 文档收藏次数 | +| comment_count | [int32](#int32) | | 文档评论次数 | +| score | [int32](#int32) | | 文档评分 | +| score_count | [int32](#int32) | | 文档评分次数 | +| price | [int32](#int32) | | 文档价格 | +| size | [int64](#int64) | | 文档大小 | +| status | [int32](#int32) | | 文档状态,见 web/utils/enum.js | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 文档创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 文档更新时间 | +| deleted_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 文档删除时间 | +| recommend_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 文档推荐时间 | +| deleted_user_id | [int64](#int64) | | 删除文档的用户 | +| username | [string](#string) | | 文档作者用户名 | +| category_id | [int64](#int64) | repeated | 文档分类ID | +| deleted_username | [string](#string) | | 删除文档的用户名 | +| ext | [string](#string) | | 文档扩展名 | +| attachment | [Attachment](#api-v1-Attachment) | | 文档附件 | +| user | [User](#api-v1-User) | | 文档作者 | +| enable_gzip | [bool](#bool) | | 是否启用gzip压缩 | +| convert_error | [string](#string) | | 转换错误信息 | + + + + + + + + +### DocumentScore +文档评分 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 评分ID | +| document_id | [int64](#int64) | | 文档ID | +| user_id | [int64](#int64) | | 用户ID | +| score | [int32](#int32) | | 评分,100~500,100为1分,500为5分 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 评分时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### DownloadDocumentReply +文档下载 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| url | [string](#string) | | | + + + + + + + + +### GetDocumentRequest +查询文档 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 文档ID | +| with_author | [bool](#bool) | | 是否查询作者信息 | + + + + + + + + +### ListDocumentForHomeItem +首页文档查询返回项 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| category_id | [int64](#int64) | | 分类ID | +| category_cover | [string](#string) | | 分类封面 | +| category_name | [string](#string) | | 分类名称 | +| document | [Document](#api-v1-Document) | repeated | 文档列表 | + + + + + + + + +### ListDocumentForHomeRequest +查询文档(针对首页的查询) + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| limit | [int64](#int64) | | | + + + + + + + + +### ListDocumentForHomeResponse +查询文档(针对首页的查询) + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| document | [ListDocumentForHomeItem](#api-v1-ListDocumentForHomeItem) | repeated | 文档列表 | + + + + + + + + +### ListDocumentReply +文档列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 文档总数 | +| document | [Document](#api-v1-Document) | repeated | 文档列表 | + + + + + + + + +### ListDocumentRequest +文档列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| wd | [string](#string) | | 搜索关键字 | +| field | [string](#string) | repeated | 查询字段 | +| order | [string](#string) | | 排序 | +| category_id | [int64](#int64) | repeated | 分类ID | +| user_id | [int64](#int64) | repeated | 用户ID | +| status | [int32](#int32) | repeated | 文档状态 | +| is_recommend | [bool](#bool) | repeated | 是否推荐 | +| limit | [int64](#int64) | | 查询数量显示。当该值大于0时,page和size无效 | + + + + + + + + +### RecoverRecycleDocumentRequest +恢复文档 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### SearchDocumentReply +文档搜索响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 文档总数 | +| spend | [string](#string) | | 搜索耗时 | +| document | [Document](#api-v1-Document) | repeated | 文档列表 | + + + + + + + + +### SearchDocumentRequest +文档搜索 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int32](#int32) | | 页码 | +| size | [int32](#int32) | | 每页数量 | +| wd | [string](#string) | | 搜索关键字 | +| category_id | [int64](#int64) | repeated | 分类 | +| sort | [string](#string) | | 排序 | +| ext | [string](#string) | | 类型 | + + + + + + + + +### SetDocumentRecommendRequest +设置文档推荐 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | 文档ID | +| type | [int32](#int32) | | 0, 取消推荐,1:推荐 2:重新推荐 | + + + + + + + + + + + + + + +### DocumentAPI +文档服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| ListDocumentForHome | [ListDocumentForHomeRequest](#api-v1-ListDocumentForHomeRequest) | [ListDocumentForHomeResponse](#api-v1-ListDocumentForHomeResponse) | 针对首页的文档查询 | +| SetDocumentRecommend | [SetDocumentRecommendRequest](#api-v1-SetDocumentRecommendRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 设置文档推荐 | +| CreateDocument | [CreateDocumentRequest](#api-v1-CreateDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 创建文档 | +| UpdateDocument | [Document](#api-v1-Document) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新文档 | +| DeleteDocument | [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除文档 | +| GetDocument | [GetDocumentRequest](#api-v1-GetDocumentRequest) | [Document](#api-v1-Document) | 查询文档 | +| GetRelatedDocuments | [Document](#api-v1-Document) | [ListDocumentReply](#api-v1-ListDocumentReply) | 根据文档ID查询当前文档的相关文档 | +| DownloadDocument | [Document](#api-v1-Document) | [DownloadDocumentReply](#api-v1-DownloadDocumentReply) | 根据文档ID,获取文档下载链接 | +| ListDocument | [ListDocumentRequest](#api-v1-ListDocumentRequest) | [ListDocumentReply](#api-v1-ListDocumentReply) | 文档列表查询 | +| SearchDocument | [SearchDocumentRequest](#api-v1-SearchDocumentRequest) | [SearchDocumentReply](#api-v1-SearchDocumentReply) | 文档搜索 | +| SetDocumentScore | [DocumentScore](#api-v1-DocumentScore) | [.google.protobuf.Empty](#google-protobuf-Empty) | 设置文档评分 | +| GetDocumentScore | [DocumentScore](#api-v1-DocumentScore) | [DocumentScore](#api-v1-DocumentScore) | 获取当前登录用户的文档评分 | +| SetDocumentReconvert | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 将文档一键设置为重转 | + + + + +### RecycleAPI + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| ListRecycleDocument | [ListDocumentRequest](#api-v1-ListDocumentRequest) | [ListDocumentReply](#api-v1-ListDocumentReply) | 文档回收站列表 | +| RecoverRecycleDocument | [RecoverRecycleDocumentRequest](#api-v1-RecoverRecycleDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 恢复回收站文档,支持恢复单个文档或者是批量恢复 | +| DeleteRecycleDocument | [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除回收站文档 | +| ClearRecycleDocument | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 清空回收站文档 | + + + + + + +

Top

+ +## api/v1/favorite.proto + + + + + +### DeleteFavoriteRequest +取消收藏 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### Favorite +文档收藏 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | +| user_id | [int64](#int64) | | | +| document_id | [int64](#int64) | | | +| title | [string](#string) | | | +| ext | [string](#string) | | | +| score | [int32](#int32) | | | +| size | [int64](#int64) | | | +| pages | [int32](#int32) | | | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | + + + + + + + + +### GetFavoriteRequest +根据文章id,查询用户是否有收藏某篇文档 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| document_id | [int64](#int64) | | | + + + + + + + + +### ListFavoriteReply +查询用户的收藏 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | | +| favorite | [Favorite](#api-v1-Favorite) | repeated | | + + + + + + + + +### ListFavoriteRequest +查询用户的收藏 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | | +| size | [int64](#int64) | | | +| user_id | [int64](#int64) | | | + + + + + + + + + + + + + + +### FavoriteAPI + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateFavorite | [Favorite](#api-v1-Favorite) | [Favorite](#api-v1-Favorite) | 添加收藏 | +| DeleteFavorite | [DeleteFavoriteRequest](#api-v1-DeleteFavoriteRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 取消收藏 | +| GetFavorite | [GetFavoriteRequest](#api-v1-GetFavoriteRequest) | [Favorite](#api-v1-Favorite) | 根据文章id,查询用户是否有收藏某篇文档 | +| ListFavorite | [ListFavoriteRequest](#api-v1-ListFavoriteRequest) | [ListFavoriteReply](#api-v1-ListFavoriteReply) | 查询用户的收藏 | + + + + + + +

Top

+ +## api/v1/friendlink.proto + + + + + +### DeleteFriendlinkRequest +删除友情链接 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### Friendlink +友情链接 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | 主键 | +| title | [string](#string) | | 标题 | +| link | [string](#string) | | 链接 | +| description | [string](#string) | | 描述 | +| sort | [int32](#int32) | | 排序 | +| enable | [bool](#bool) | | 是否启用 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### GetFriendlinkRequest +获取友情链接 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### ListFriendlinkReply +友情链接列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| friendlink | [Friendlink](#api-v1-Friendlink) | repeated | | +| total | [int64](#int64) | | | + + + + + + + + +### ListFriendlinkRequest +友情链接列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int32](#int32) | | | +| size | [int32](#int32) | | | +| wd | [string](#string) | | | +| enable | [bool](#bool) | repeated | | +| field | [string](#string) | repeated | | + + + + + + + + + + + + + + +### FriendlinkAPI +友情链接服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateFriendlink | [Friendlink](#api-v1-Friendlink) | [Friendlink](#api-v1-Friendlink) | 创建友情链接 | +| UpdateFriendlink | [Friendlink](#api-v1-Friendlink) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新友情链接 | +| DeleteFriendlink | [DeleteFriendlinkRequest](#api-v1-DeleteFriendlinkRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除友情链接 | +| GetFriendlink | [GetFriendlinkRequest](#api-v1-GetFriendlinkRequest) | [Friendlink](#api-v1-Friendlink) | 获取友情链接 | +| ListFriendlink | [ListFriendlinkRequest](#api-v1-ListFriendlinkRequest) | [ListFriendlinkReply](#api-v1-ListFriendlinkReply) | 获取友情链接 | + + + + + + +

Top

+ +## api/v1/group.proto + + + + + +### DeleteGroupRequest +删除用户组,可以批量删除 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### GetGroupPermissionRequest +获取用户组权限 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### GetGroupRequest +根据组名或者ID获取用户组 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | +| title | [string](#string) | | | + + + + + + + + +### Group +用户组,角色 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 用户组ID | +| title | [string](#string) | | 用户组名称 | +| color | [string](#string) | | 用户组颜色 | +| is_default | [bool](#bool) | | 是否是默认用户组 | +| is_display | [bool](#bool) | | 是否显示 | +| description | [string](#string) | | 用户组描述 | +| user_count | [int32](#int32) | | 用户组下的用户数量 | +| sort | [int32](#int32) | | 排序 | +| enable_upload | [bool](#bool) | | 是否允许上传文档 | +| enable_comment_approval | [bool](#bool) | | 是否需要审核评论 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### GroupPermissions +用户组权限 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| permission_id | [int64](#int64) | repeated | | + + + + + + + + +### ListGroupReply +用户组列表 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| group | [Group](#api-v1-Group) | repeated | | +| total | [int64](#int64) | | | + + + + + + + + +### ListGroupRequest +查询用户组列表。不需要分页,直接返回全部用户组,只是可以指定查询哪些字段 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| wd | [string](#string) | | | +| page | [int64](#int64) | | | +| size | [int64](#int64) | | | +| sort | [string](#string) | | | +| field | [string](#string) | repeated | | + + + + + + + + +### UpdateGroupPermissionRequest +更新用户组权限 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| group_id | [int64](#int64) | | | +| permission_id | [int64](#int64) | repeated | | + + + + + + + + + + + + + + +### GroupAPI + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateGroup | [Group](#api-v1-Group) | [Group](#api-v1-Group) | 创建用户组 | +| UpdateGroup | [Group](#api-v1-Group) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新用户组 | +| DeleteGroup | [DeleteGroupRequest](#api-v1-DeleteGroupRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除用户组 | +| GetGroup | [GetGroupRequest](#api-v1-GetGroupRequest) | [Group](#api-v1-Group) | 获取用户组 | +| ListGroup | [ListGroupRequest](#api-v1-ListGroupRequest) | [ListGroupReply](#api-v1-ListGroupReply) | 获取用户组列表 | +| GetGroupPermission | [GetGroupPermissionRequest](#api-v1-GetGroupPermissionRequest) | [GroupPermissions](#api-v1-GroupPermissions) | 获取用户组权限列表 | +| UpdateGroupPermission | [UpdateGroupPermissionRequest](#api-v1-UpdateGroupPermissionRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新用户组权限,给用户组设置权限 | + + + + + + +

Top

+ +## api/v1/health.proto + + + + + +### PingRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | | + + + + + + + + +### PongReply + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | + + + + + + + + + + + + + + +### HealthAPI + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| Health | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | | +| Ping | [.PingRequest](#PingRequest) | [.PongReply](#PongReply) | | + + + + + + +

Top

+ +## api/v1/permission.proto + + + + + +### GetPermissionReply +权限响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| permission | [Permission](#api-v1-Permission) | | | + + + + + + + + +### GetPermissionRequest +权限请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### ListPermissionReply +权限列表响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | | +| permission | [Permission](#api-v1-Permission) | repeated | | + + + + + + + + +### ListPermissionRequest +权限列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | | +| size | [int64](#int64) | | | +| wd | [string](#string) | | | +| method | [string](#string) | repeated | | +| path | [string](#string) | | | + + + + + + + + +### Permission +权限 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 权限ID | +| method | [string](#string) | | 请求方法 | +| path | [string](#string) | | 请求路径 | +| title | [string](#string) | | 权限名称 | +| description | [string](#string) | | 权限描述 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + + + + + + + +### PermissionAPI +权限API服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| UpdatePermission | [Permission](#api-v1-Permission) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新权限信息。这里只能操作title和description | +| GetPermission | [GetPermissionRequest](#api-v1-GetPermissionRequest) | [Permission](#api-v1-Permission) | 查询权限信息 | +| ListPermission | [ListPermissionRequest](#api-v1-ListPermissionRequest) | [ListPermissionReply](#api-v1-ListPermissionReply) | 查询权限列表 | + + + + + + +

Top

+ +## api/v1/report.proto + + + + + +### DeleteReportRequest +删除举报请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### ListReportReply +举报列表响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | | +| report | [Report](#api-v1-Report) | repeated | | + + + + + + + + +### ListReportRequest +举报列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | | +| size | [int64](#int64) | | | +| wd | [string](#string) | | | +| field | [string](#string) | repeated | | +| order | [string](#string) | | | +| status | [bool](#bool) | repeated | | + + + + + + + + +### Report +举报 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 举报ID | +| document_id | [int64](#int64) | | 文档ID | +| user_id | [int64](#int64) | | 举报人ID | +| reason | [int32](#int32) | | 举报原因 | +| status | [bool](#bool) | | 举报处理状态 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 举报时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 处理时间 | +| document_title | [string](#string) | | 文档标题 | +| remark | [string](#string) | | 处理备注 | +| username | [string](#string) | | 举报人 | + + + + + + + + + + + + + + +### ReportAPI +举报服务 + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| CreateReport | [Report](#api-v1-Report) | [.google.protobuf.Empty](#google-protobuf-Empty) | 创建举报 | +| UpdateReport | [Report](#api-v1-Report) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新举报,审核举报内容 | +| DeleteReport | [DeleteReportRequest](#api-v1-DeleteReportRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除举报 | +| ListReport | [ListReportRequest](#api-v1-ListReportRequest) | [ListReportReply](#api-v1-ListReportReply) | 获取举报列表 | + + + + + + +

Top

+ +## api/v1/user.proto + + + + + +### DeleteUserRequest +删除用户 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | repeated | | + + + + + + + + +### Dynamic +用户动态 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 动态ID | +| user_id | [int64](#int64) | | 用户ID | +| content | [string](#string) | | 内容 | +| type | [int32](#int32) | | 类型 | +| username | [string](#string) | | 用户名 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | + + + + + + + + +### FindPasswordRequest +找回密码 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| email | [string](#string) | | 邮箱 | +| token | [string](#string) | | 签名token | +| password | [string](#string) | | 新密码 | +| captcha | [string](#string) | | 验证码 | +| captcha_id | [string](#string) | | 验证码ID | + + + + + + + + +### GetUserCaptchaReply +验证码响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| enable | [bool](#bool) | | 是否启用验证码 | +| id | [string](#string) | | 验证码ID | +| captcha | [string](#string) | | 验证码 | +| type | [string](#string) | | 验证码类型 | + + + + + + + + +### GetUserCaptchaRequest +查询验证码请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| type | [string](#string) | | 验证码类型:register、login、comment、find_password、upload | + + + + + + + + +### GetUserPermissionsReply +用户权限信息查询 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| permission | [Permission](#api-v1-Permission) | repeated | | + + + + + + + + +### GetUserRequest +获取用户信息 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | | + + + + + + + + +### ListUserDynamicReply +用户动态列表响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 总数 | +| dynamic | [Dynamic](#api-v1-Dynamic) | repeated | 动态列表 | + + + + + + + + +### ListUserDynamicRequest +用户动态列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| id | [int64](#int64) | | 用户ID | + + + + + + + + +### ListUserReply +用户列表响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| total | [int64](#int64) | | 总数 | +| user | [User](#api-v1-User) | repeated | 用户列表 | + + + + + + + + +### ListUserRequest +用户列表请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| wd | [string](#string) | | 搜索关键词 | +| sort | [string](#string) | | 排序字段 | +| id | [int64](#int64) | repeated | 用户ID | +| group_id | [int64](#int64) | repeated | 用户组ID | +| status | [int32](#int32) | repeated | 用户状态 | +| limit | [int64](#int64) | | 请求数量限制,大于0时,page和size无效 | + + + + + + + + +### LoginReply +用户登录响应 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| token | [string](#string) | | | +| user | [User](#api-v1-User) | | | + + + + + + + + +### RegisterAndLoginRequest +用户注册登录请求 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| username | [string](#string) | | 用户名 | +| password | [string](#string) | | 密码 | +| captcha | [string](#string) | | 验证码 | +| captcha_id | [string](#string) | | 验证码ID | +| email | [string](#string) | | 邮箱 | + + + + + + + + +### SetUserRequest +管理后台设置用户信息 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 用户ID | +| username | [string](#string) | | 用户名 | +| password | [string](#string) | | 密码 | +| group_id | [int64](#int64) | repeated | 用户组ID | +| email | [string](#string) | | 邮箱 | + + + + + + + + +### Sign +用户签到 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 签到ID | +| user_id | [int64](#int64) | | 用户ID | +| sign_at | [int32](#int32) | | 签到日期 | +| ip | [string](#string) | | 签到IP | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| award | [int32](#int32) | | 签到积分奖励 | + + + + + + + + +### UpdateUserPasswordRequest +修改用户密码 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int64](#int64) | | 用户ID | +| old_password | [string](#string) | | 旧密码 | +| new_password | [string](#string) | | 新密码 | + + + + + + + + +### User +用户信息 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| login_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 最后登录时间 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 注册时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | +| id | [int64](#int64) | | 用户ID | +| username | [string](#string) | | 用户名 | +| mobile | [string](#string) | | 手机号 | +| email | [string](#string) | | 邮箱,唯一 | +| address | [string](#string) | | 地址 | +| signature | [string](#string) | | 个性签名 | +| last_login_ip | [string](#string) | | 最后登录IP | +| register_ip | [string](#string) | | 注册IP | +| doc_count | [int32](#int32) | | 文档数量 | +| follow_count | [int32](#int32) | | 关注数量 | +| fans_count | [int32](#int32) | | 粉丝数量 | +| favorite_count | [int32](#int32) | | 收藏数量 | +| comment_count | [int32](#int32) | | 评论数量 | +| status | [int32](#int32) | | 用户状态,见 web/utils/enum.js,当前没有使用 | +| avatar | [string](#string) | | 头像 | +| identity | [string](#string) | | 身份证 | +| realname | [string](#string) | | 真实姓名 | +| group_id | [int64](#int64) | repeated | 用户组ID | +| credit_count | [int32](#int32) | | 积分 | + + + + + + + + + + + + + + +### UserAPI + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| Register | [RegisterAndLoginRequest](#api-v1-RegisterAndLoginRequest) | [LoginReply](#api-v1-LoginReply) | 用户注册 | +| Login | [RegisterAndLoginRequest](#api-v1-RegisterAndLoginRequest) | [LoginReply](#api-v1-LoginReply) | 用户登录 | +| Logout | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 退出登录 | +| GetUser | [GetUserRequest](#api-v1-GetUserRequest) | [User](#api-v1-User) | 查询用户信息。如果传递了Id参数,则表示查询用户的公开信息,否则查询当前用户的私有信息 | +| UpdateUserPassword | [UpdateUserPasswordRequest](#api-v1-UpdateUserPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限 | +| UpdateUserProfile | [User](#api-v1-User) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限 | +| DeleteUser | [DeleteUserRequest](#api-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除用户。需要验证用户权限 | +| AddUser | [SetUserRequest](#api-v1-SetUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 新增用户 | +| SetUser | [SetUserRequest](#api-v1-SetUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 设置用户 | +| ListUser | [ListUserRequest](#api-v1-ListUserRequest) | [ListUserReply](#api-v1-ListUserReply) | 查询用户列表。对于非管理员,返回相应用户的公开信息; 对于管理员,返回相应用户的绝大部分信息 | +| GetUserCaptcha | [GetUserCaptchaRequest](#api-v1-GetUserCaptchaRequest) | [GetUserCaptchaReply](#api-v1-GetUserCaptchaReply) | GetUserCaptcha 获取用户验证码 | +| GetUserPermissions | [.google.protobuf.Empty](#google-protobuf-Empty) | [GetUserPermissionsReply](#api-v1-GetUserPermissionsReply) | GetUserCaptcha 获取用户验证码 | +| CanIUploadDocument | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 用户是否可以上传文档 | +| ListUserDynamic | [ListUserDynamicRequest](#api-v1-ListUserDynamicRequest) | [ListUserDynamicReply](#api-v1-ListUserDynamicReply) | 获取用户动态,包括获取关注的用户的动态 | +| SignToday | [.google.protobuf.Empty](#google-protobuf-Empty) | [Sign](#api-v1-Sign) | 每日签到 | +| GetSignedToday | [.google.protobuf.Empty](#google-protobuf-Empty) | [Sign](#api-v1-Sign) | 获取今日已签到记录 | +| FindPasswordStepOne | [FindPasswordRequest](#api-v1-FindPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 找回密码:第一步,发送验证码 | +| FindPasswordStepTwo | [FindPasswordRequest](#api-v1-FindPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 找回密码:第二步,修改密码 | + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | + diff --git a/docs/api/attachment.md b/docs/api/attachment.md index 39c5d3e..0ddb718 100644 --- a/docs/api/attachment.md +++ b/docs/api/attachment.md @@ -35,10 +35,8 @@ | hash | [string](#string) | | 附件哈希值,MD5 | | user_id | [int64](#int64) | | 上传用户ID | | type_id | [int64](#int64) | | 附件类型ID,如果是文档类型,则为文档ID | -| type | [int32](#int32) | | 附件类型,0: 未知,1: 头像,2: 文档,3: 文章,4: 评论,5: | -| enable | [bool](#bool) | | 横幅,6: 分类封面,7: 配置 - -是否启用 | +| type | [int32](#int32) | | 附件类型,见 web/utils/enum.js | +| enable | [bool](#bool) | | 是否启用 | | path | [string](#string) | | 附件路径 | | name | [string](#string) | | 附件名称 | | size | [int64](#int64) | | 附件大小,单位:字节 | diff --git a/docs/api/config.md b/docs/api/config.md index 6c4c2b1..aef577e 100644 --- a/docs/api/config.md +++ b/docs/api/config.md @@ -42,10 +42,8 @@ | name | [string](#string) | | 配置名称 | | value | [string](#string) | | 配置值 | | placeholder | [string](#string) | | 配置占位符 | -| input_type | [string](#string) | | 输入类型,如:textarea、number、switch等,为 | -| category | [string](#string) | | element-ui 的 el-input 的 type 属性 - -配置分类,如:system、footer、security等,见 web/utils/enum.js | +| input_type | [string](#string) | | 输入类型,如:textarea、number、switch等 | +| category | [string](#string) | | 配置分类,如:system、footer、security等,见 web/utils/enum.js | | sort | [int32](#int32) | | 排序,越小越靠前 | | options | [string](#string) | | 配置项枚举,一个一行,如select的option选项,用 key=value 的形式 | | created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | diff --git a/docs/api/document.md b/docs/api/document.md index 3b4fcb3..f7aa1f6 100644 --- a/docs/api/document.md +++ b/docs/api/document.md @@ -139,12 +139,12 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| document_id | [int64](#int64) | | | -| user_id | [int64](#int64) | | | -| score | [int32](#int32) | | 评分 | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| id | [int64](#int64) | | 评分ID | +| document_id | [int64](#int64) | | 文档ID | +| user_id | [int64](#int64) | | 用户ID | +| score | [int32](#int32) | | 评分,100~500,100为1分,500为5分 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 评分时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | @@ -154,7 +154,7 @@ ### DownloadDocumentReply - +文档下载 | Field | Type | Label | Description | @@ -190,10 +190,10 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| category_id | [int64](#int64) | | | -| category_cover | [string](#string) | | | -| category_name | [string](#string) | | | -| document | [Document](#api-v1-Document) | repeated | | +| category_id | [int64](#int64) | | 分类ID | +| category_cover | [string](#string) | | 分类封面 | +| category_name | [string](#string) | | 分类名称 | +| document | [Document](#api-v1-Document) | repeated | 文档列表 | @@ -223,7 +223,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| document | [ListDocumentForHomeItem](#api-v1-ListDocumentForHomeItem) | repeated | | +| document | [ListDocumentForHomeItem](#api-v1-ListDocumentForHomeItem) | repeated | 文档列表 | @@ -288,14 +288,14 @@ ### SearchDocumentReply - +文档搜索响应 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| total | [int64](#int64) | | | +| total | [int64](#int64) | | 文档总数 | | spend | [string](#string) | | 搜索耗时 | -| document | [Document](#api-v1-Document) | repeated | | +| document | [Document](#api-v1-Document) | repeated | 文档列表 | @@ -305,14 +305,14 @@ ### SearchDocumentRequest - +文档搜索 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| page | [int32](#int32) | | | -| size | [int32](#int32) | | | -| wd | [string](#string) | | | +| page | [int32](#int32) | | 页码 | +| size | [int32](#int32) | | 每页数量 | +| wd | [string](#string) | | 搜索关键字 | | category_id | [int64](#int64) | repeated | 分类 | | sort | [string](#string) | | 排序 | | ext | [string](#string) | | 类型 | @@ -347,20 +347,20 @@ ### DocumentAPI - +文档服务 | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| ListDocumentForHome | [ListDocumentForHomeRequest](#api-v1-ListDocumentForHomeRequest) | [ListDocumentForHomeResponse](#api-v1-ListDocumentForHomeResponse) | | -| SetDocumentRecommend | [SetDocumentRecommendRequest](#api-v1-SetDocumentRecommendRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| CreateDocument | [CreateDocumentRequest](#api-v1-CreateDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| UpdateDocument | [Document](#api-v1-Document) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| DeleteDocument | [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| GetDocument | [GetDocumentRequest](#api-v1-GetDocumentRequest) | [Document](#api-v1-Document) | | -| GetRelatedDocuments | [Document](#api-v1-Document) | [ListDocumentReply](#api-v1-ListDocumentReply) | | -| DownloadDocument | [Document](#api-v1-Document) | [DownloadDocumentReply](#api-v1-DownloadDocumentReply) | | -| ListDocument | [ListDocumentRequest](#api-v1-ListDocumentRequest) | [ListDocumentReply](#api-v1-ListDocumentReply) | | -| SearchDocument | [SearchDocumentRequest](#api-v1-SearchDocumentRequest) | [SearchDocumentReply](#api-v1-SearchDocumentReply) | | +| ListDocumentForHome | [ListDocumentForHomeRequest](#api-v1-ListDocumentForHomeRequest) | [ListDocumentForHomeResponse](#api-v1-ListDocumentForHomeResponse) | 针对首页的文档查询 | +| SetDocumentRecommend | [SetDocumentRecommendRequest](#api-v1-SetDocumentRecommendRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 设置文档推荐 | +| CreateDocument | [CreateDocumentRequest](#api-v1-CreateDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 创建文档 | +| UpdateDocument | [Document](#api-v1-Document) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新文档 | +| DeleteDocument | [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除文档 | +| GetDocument | [GetDocumentRequest](#api-v1-GetDocumentRequest) | [Document](#api-v1-Document) | 查询文档 | +| GetRelatedDocuments | [Document](#api-v1-Document) | [ListDocumentReply](#api-v1-ListDocumentReply) | 根据文档ID查询当前文档的相关文档 | +| DownloadDocument | [Document](#api-v1-Document) | [DownloadDocumentReply](#api-v1-DownloadDocumentReply) | 根据文档ID,获取文档下载链接 | +| ListDocument | [ListDocumentRequest](#api-v1-ListDocumentRequest) | [ListDocumentReply](#api-v1-ListDocumentReply) | 文档列表查询 | +| SearchDocument | [SearchDocumentRequest](#api-v1-SearchDocumentRequest) | [SearchDocumentReply](#api-v1-SearchDocumentReply) | 文档搜索 | | SetDocumentScore | [DocumentScore](#api-v1-DocumentScore) | [.google.protobuf.Empty](#google-protobuf-Empty) | 设置文档评分 | | GetDocumentScore | [DocumentScore](#api-v1-DocumentScore) | [DocumentScore](#api-v1-DocumentScore) | 获取当前登录用户的文档评分 | | SetDocumentReconvert | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 将文档一键设置为重转 | diff --git a/docs/api/favorite.md b/docs/api/favorite.md index 77cf632..f81f6cb 100644 --- a/docs/api/favorite.md +++ b/docs/api/favorite.md @@ -26,7 +26,7 @@ ### DeleteFavoriteRequest - +取消收藏 | Field | Type | Label | Description | @@ -41,7 +41,7 @@ ### Favorite - +文档收藏 | Field | Type | Label | Description | @@ -65,7 +65,7 @@ ### GetFavoriteRequest - +根据文章id,查询用户是否有收藏某篇文档 | Field | Type | Label | Description | @@ -80,7 +80,7 @@ ### ListFavoriteReply - +查询用户的收藏 | Field | Type | Label | Description | @@ -96,7 +96,7 @@ ### ListFavoriteRequest - +查询用户的收藏 | Field | Type | Label | Description | diff --git a/docs/api/friendlink.md b/docs/api/friendlink.md index c3e57c1..f7fa7d0 100644 --- a/docs/api/friendlink.md +++ b/docs/api/friendlink.md @@ -26,7 +26,7 @@ ### DeleteFriendlinkRequest - +删除友情链接 | Field | Type | Label | Description | @@ -41,19 +41,19 @@ ### Friendlink - +友情链接 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int32](#int32) | | | -| title | [string](#string) | | | -| link | [string](#string) | | | -| description | [string](#string) | | | -| sort | [int32](#int32) | | | -| enable | [bool](#bool) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| id | [int32](#int32) | | 主键 | +| title | [string](#string) | | 标题 | +| link | [string](#string) | | 链接 | +| description | [string](#string) | | 描述 | +| sort | [int32](#int32) | | 排序 | +| enable | [bool](#bool) | | 是否启用 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | @@ -63,7 +63,7 @@ ### GetFriendlinkRequest - +获取友情链接 | Field | Type | Label | Description | @@ -78,7 +78,7 @@ ### ListFriendlinkReply - +友情链接列表 | Field | Type | Label | Description | @@ -94,7 +94,7 @@ ### ListFriendlinkRequest - +友情链接列表 | Field | Type | Label | Description | @@ -119,15 +119,15 @@ ### FriendlinkAPI - +友情链接服务 | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| CreateFriendlink | [Friendlink](#api-v1-Friendlink) | [Friendlink](#api-v1-Friendlink) | | -| UpdateFriendlink | [Friendlink](#api-v1-Friendlink) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| DeleteFriendlink | [DeleteFriendlinkRequest](#api-v1-DeleteFriendlinkRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| GetFriendlink | [GetFriendlinkRequest](#api-v1-GetFriendlinkRequest) | [Friendlink](#api-v1-Friendlink) | | -| ListFriendlink | [ListFriendlinkRequest](#api-v1-ListFriendlinkRequest) | [ListFriendlinkReply](#api-v1-ListFriendlinkReply) | | +| CreateFriendlink | [Friendlink](#api-v1-Friendlink) | [Friendlink](#api-v1-Friendlink) | 创建友情链接 | +| UpdateFriendlink | [Friendlink](#api-v1-Friendlink) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新友情链接 | +| DeleteFriendlink | [DeleteFriendlinkRequest](#api-v1-DeleteFriendlinkRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除友情链接 | +| GetFriendlink | [GetFriendlinkRequest](#api-v1-GetFriendlinkRequest) | [Friendlink](#api-v1-Friendlink) | 获取友情链接 | +| ListFriendlink | [ListFriendlinkRequest](#api-v1-ListFriendlinkRequest) | [ListFriendlinkReply](#api-v1-ListFriendlinkReply) | 获取友情链接 | diff --git a/docs/api/group.md b/docs/api/group.md index 1bb517a..7811ff2 100644 --- a/docs/api/group.md +++ b/docs/api/group.md @@ -29,7 +29,7 @@ ### DeleteGroupRequest - +删除用户组,可以批量删除 | Field | Type | Label | Description | @@ -44,7 +44,7 @@ ### GetGroupPermissionRequest - +获取用户组权限 | Field | Type | Label | Description | @@ -75,23 +75,23 @@ ### Group - +用户组,角色 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| title | [string](#string) | | | -| color | [string](#string) | | | -| is_default | [bool](#bool) | | | -| is_display | [bool](#bool) | | | -| description | [string](#string) | | | -| user_count | [int32](#int32) | | | -| sort | [int32](#int32) | | | -| enable_upload | [bool](#bool) | | | -| enable_comment_approval | [bool](#bool) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| id | [int64](#int64) | | 用户组ID | +| title | [string](#string) | | 用户组名称 | +| color | [string](#string) | | 用户组颜色 | +| is_default | [bool](#bool) | | 是否是默认用户组 | +| is_display | [bool](#bool) | | 是否显示 | +| description | [string](#string) | | 用户组描述 | +| user_count | [int32](#int32) | | 用户组下的用户数量 | +| sort | [int32](#int32) | | 排序 | +| enable_upload | [bool](#bool) | | 是否允许上传文档 | +| enable_comment_approval | [bool](#bool) | | 是否需要审核评论 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | @@ -101,7 +101,7 @@ ### GroupPermissions - +用户组权限 | Field | Type | Label | Description | @@ -116,7 +116,7 @@ ### ListGroupReply - +用户组列表 | Field | Type | Label | Description | @@ -151,7 +151,7 @@ ### UpdateGroupPermissionRequest - +更新用户组权限 | Field | Type | Label | Description | @@ -180,8 +180,8 @@ | CreateGroup | [Group](#api-v1-Group) | [Group](#api-v1-Group) | 创建用户组 | | UpdateGroup | [Group](#api-v1-Group) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新用户组 | | DeleteGroup | [DeleteGroupRequest](#api-v1-DeleteGroupRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除用户组 | -| GetGroup | [GetGroupRequest](#api-v1-GetGroupRequest) | [Group](#api-v1-Group) | 获取用户组列表 | -| ListGroup | [ListGroupRequest](#api-v1-ListGroupRequest) | [ListGroupReply](#api-v1-ListGroupReply) | | +| GetGroup | [GetGroupRequest](#api-v1-GetGroupRequest) | [Group](#api-v1-Group) | 获取用户组 | +| ListGroup | [ListGroupRequest](#api-v1-ListGroupRequest) | [ListGroupReply](#api-v1-ListGroupReply) | 获取用户组列表 | | GetGroupPermission | [GetGroupPermissionRequest](#api-v1-GetGroupPermissionRequest) | [GroupPermissions](#api-v1-GroupPermissions) | 获取用户组权限列表 | | UpdateGroupPermission | [UpdateGroupPermissionRequest](#api-v1-UpdateGroupPermissionRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新用户组权限,给用户组设置权限 | diff --git a/docs/api/permission.md b/docs/api/permission.md index 8e57946..5605a60 100644 --- a/docs/api/permission.md +++ b/docs/api/permission.md @@ -4,7 +4,6 @@ ## Table of Contents - [api/v1/permission.proto](#api_v1_permission-proto) - - [DeletePermissionRequest](#api-v1-DeletePermissionRequest) - [GetPermissionReply](#api-v1-GetPermissionReply) - [GetPermissionRequest](#api-v1-GetPermissionRequest) - [ListPermissionReply](#api-v1-ListPermissionReply) @@ -24,25 +23,10 @@ - - -### DeletePermissionRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | repeated | | - - - - - - ### GetPermissionReply - +权限响应 | Field | Type | Label | Description | @@ -57,7 +41,7 @@ ### GetPermissionRequest - +权限请求 | Field | Type | Label | Description | @@ -72,7 +56,7 @@ ### ListPermissionReply - +权限列表响应 | Field | Type | Label | Description | @@ -88,7 +72,7 @@ ### ListPermissionRequest - +权限列表请求 | Field | Type | Label | Description | @@ -107,18 +91,18 @@ ### Permission - +权限 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| method | [string](#string) | | | -| path | [string](#string) | | | -| title | [string](#string) | | | -| description | [string](#string) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| id | [int64](#int64) | | 权限ID | +| method | [string](#string) | | 请求方法 | +| path | [string](#string) | | 请求路径 | +| title | [string](#string) | | 权限名称 | +| description | [string](#string) | | 权限描述 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | @@ -134,13 +118,13 @@ ### PermissionAPI - +权限API服务 | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| UpdatePermission | [Permission](#api-v1-Permission) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| GetPermission | [GetPermissionRequest](#api-v1-GetPermissionRequest) | [Permission](#api-v1-Permission) | | -| ListPermission | [ListPermissionRequest](#api-v1-ListPermissionRequest) | [ListPermissionReply](#api-v1-ListPermissionReply) | | +| UpdatePermission | [Permission](#api-v1-Permission) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新权限信息。这里只能操作title和description | +| GetPermission | [GetPermissionRequest](#api-v1-GetPermissionRequest) | [Permission](#api-v1-Permission) | 查询权限信息 | +| ListPermission | [ListPermissionRequest](#api-v1-ListPermissionRequest) | [ListPermissionReply](#api-v1-ListPermissionReply) | 查询权限列表 | diff --git a/docs/api/report.md b/docs/api/report.md index 617a3bf..d98bcb6 100644 --- a/docs/api/report.md +++ b/docs/api/report.md @@ -25,7 +25,7 @@ ### DeleteReportRequest - +删除举报请求 | Field | Type | Label | Description | @@ -40,7 +40,7 @@ ### ListReportReply - +举报列表响应 | Field | Type | Label | Description | @@ -56,7 +56,7 @@ ### ListReportRequest - +举报列表请求 | Field | Type | Label | Description | @@ -76,21 +76,21 @@ ### Report -这里是proto文件中的结构体,可以根据需要删除或者调整 +举报 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| document_id | [int64](#int64) | | | -| user_id | [int64](#int64) | | | -| reason | [int32](#int32) | | | -| status | [bool](#bool) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| document_title | [string](#string) | | | -| remark | [string](#string) | | | -| username | [string](#string) | | | +| id | [int64](#int64) | | 举报ID | +| document_id | [int64](#int64) | | 文档ID | +| user_id | [int64](#int64) | | 举报人ID | +| reason | [int32](#int32) | | 举报原因 | +| status | [bool](#bool) | | 举报处理状态 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 举报时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 处理时间 | +| document_title | [string](#string) | | 文档标题 | +| remark | [string](#string) | | 处理备注 | +| username | [string](#string) | | 举报人 | @@ -106,14 +106,14 @@ ### ReportAPI - +举报服务 | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| CreateReport | [Report](#api-v1-Report) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| UpdateReport | [Report](#api-v1-Report) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| DeleteReport | [DeleteReportRequest](#api-v1-DeleteReportRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| ListReport | [ListReportRequest](#api-v1-ListReportRequest) | [ListReportReply](#api-v1-ListReportReply) | | +| CreateReport | [Report](#api-v1-Report) | [.google.protobuf.Empty](#google-protobuf-Empty) | 创建举报 | +| UpdateReport | [Report](#api-v1-Report) | [.google.protobuf.Empty](#google-protobuf-Empty) | 更新举报,审核举报内容 | +| DeleteReport | [DeleteReportRequest](#api-v1-DeleteReportRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除举报 | +| ListReport | [ListReportRequest](#api-v1-ListReportRequest) | [ListReportReply](#api-v1-ListReportReply) | 获取举报列表 | diff --git a/docs/api/user.md b/docs/api/user.md index f78a46f..d9ab813 100644 --- a/docs/api/user.md +++ b/docs/api/user.md @@ -38,7 +38,7 @@ ### DeleteUserRequest - +删除用户 | Field | Type | Label | Description | @@ -53,18 +53,18 @@ ### Dynamic - +用户动态 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| user_id | [int64](#int64) | | | -| content | [string](#string) | | | +| id | [int64](#int64) | | 动态ID | +| user_id | [int64](#int64) | | 用户ID | +| content | [string](#string) | | 内容 | | type | [int32](#int32) | | 类型 | -| username | [string](#string) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| username | [string](#string) | | 用户名 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | @@ -74,16 +74,16 @@ ### FindPasswordRequest - +找回密码 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| email | [string](#string) | | | -| token | [string](#string) | | | -| password | [string](#string) | | | -| captcha | [string](#string) | | | -| captcha_id | [string](#string) | | | +| email | [string](#string) | | 邮箱 | +| token | [string](#string) | | 签名token | +| password | [string](#string) | | 新密码 | +| captcha | [string](#string) | | 验证码 | +| captcha_id | [string](#string) | | 验证码ID | @@ -93,15 +93,15 @@ ### GetUserCaptchaReply - +验证码响应 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| enable | [bool](#bool) | | | -| id | [string](#string) | | | -| captcha | [string](#string) | | | -| type | [string](#string) | | | +| enable | [bool](#bool) | | 是否启用验证码 | +| id | [string](#string) | | 验证码ID | +| captcha | [string](#string) | | 验证码 | +| type | [string](#string) | | 验证码类型 | @@ -111,7 +111,7 @@ ### GetUserCaptchaRequest - +查询验证码请求 | Field | Type | Label | Description | @@ -126,7 +126,7 @@ ### GetUserPermissionsReply - +用户权限信息查询 | Field | Type | Label | Description | @@ -141,7 +141,7 @@ ### GetUserRequest - +获取用户信息 | Field | Type | Label | Description | @@ -156,13 +156,13 @@ ### ListUserDynamicReply - +用户动态列表响应 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| total | [int64](#int64) | | | -| dynamic | [Dynamic](#api-v1-Dynamic) | repeated | | +| total | [int64](#int64) | | 总数 | +| dynamic | [Dynamic](#api-v1-Dynamic) | repeated | 动态列表 | @@ -172,14 +172,14 @@ ### ListUserDynamicRequest - +用户动态列表请求 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| page | [int64](#int64) | | | -| size | [int64](#int64) | | | -| id | [int64](#int64) | | | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| id | [int64](#int64) | | 用户ID | @@ -189,13 +189,13 @@ ### ListUserReply - +用户列表响应 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| total | [int64](#int64) | | | -| user | [User](#api-v1-User) | repeated | | +| total | [int64](#int64) | | 总数 | +| user | [User](#api-v1-User) | repeated | 用户列表 | @@ -205,19 +205,19 @@ ### ListUserRequest - +用户列表请求 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| page | [int64](#int64) | | | -| size | [int64](#int64) | | | -| wd | [string](#string) | | | -| sort | [string](#string) | | | -| id | [int64](#int64) | repeated | | -| group_id | [int64](#int64) | repeated | | -| status | [int32](#int32) | repeated | | -| limit | [int64](#int64) | | | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| wd | [string](#string) | | 搜索关键词 | +| sort | [string](#string) | | 排序字段 | +| id | [int64](#int64) | repeated | 用户ID | +| group_id | [int64](#int64) | repeated | 用户组ID | +| status | [int32](#int32) | repeated | 用户状态 | +| limit | [int64](#int64) | | 请求数量限制,大于0时,page和size无效 | @@ -227,7 +227,7 @@ ### LoginReply - +用户登录响应 | Field | Type | Label | Description | @@ -243,16 +243,16 @@ ### RegisterAndLoginRequest - +用户注册登录请求 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| username | [string](#string) | | | -| password | [string](#string) | | | -| captcha | [string](#string) | | | -| captcha_id | [string](#string) | | | -| email | [string](#string) | | | +| username | [string](#string) | | 用户名 | +| password | [string](#string) | | 密码 | +| captcha | [string](#string) | | 验证码 | +| captcha_id | [string](#string) | | 验证码ID | +| email | [string](#string) | | 邮箱 | @@ -262,16 +262,16 @@ ### SetUserRequest - +管理后台设置用户信息 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| username | [string](#string) | | | -| password | [string](#string) | | | -| group_id | [int64](#int64) | repeated | | -| email | [string](#string) | | | +| id | [int64](#int64) | | 用户ID | +| username | [string](#string) | | 用户名 | +| password | [string](#string) | | 密码 | +| group_id | [int64](#int64) | repeated | 用户组ID | +| email | [string](#string) | | 邮箱 | @@ -281,16 +281,16 @@ ### Sign - +用户签到 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| user_id | [int64](#int64) | | | -| sign_at | [int32](#int32) | | | -| ip | [string](#string) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| id | [int64](#int64) | | 签到ID | +| user_id | [int64](#int64) | | 用户ID | +| sign_at | [int32](#int32) | | 签到日期 | +| ip | [string](#string) | | 签到IP | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | | award | [int32](#int32) | | 签到积分奖励 | @@ -306,9 +306,9 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| old_password | [string](#string) | | | -| new_password | [string](#string) | | | +| id | [int64](#int64) | | 用户ID | +| old_password | [string](#string) | | 旧密码 | +| new_password | [string](#string) | | 新密码 | @@ -318,33 +318,33 @@ ### User - +用户信息 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| login_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| id | [int64](#int64) | | | -| username | [string](#string) | | | -| mobile | [string](#string) | | | -| email | [string](#string) | | | -| address | [string](#string) | | | -| signature | [string](#string) | | | -| last_login_ip | [string](#string) | | | -| register_ip | [string](#string) | | | -| doc_count | [int32](#int32) | | | -| follow_count | [int32](#int32) | | | -| fans_count | [int32](#int32) | | | -| favorite_count | [int32](#int32) | | | -| comment_count | [int32](#int32) | | | -| status | [int32](#int32) | | | -| avatar | [string](#string) | | | -| identity | [string](#string) | | | -| realname | [string](#string) | | | -| group_id | [int64](#int64) | repeated | | -| credit_count | [int32](#int32) | | | +| login_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 最后登录时间 | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 注册时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | +| id | [int64](#int64) | | 用户ID | +| username | [string](#string) | | 用户名 | +| mobile | [string](#string) | | 手机号 | +| email | [string](#string) | | 邮箱,唯一 | +| address | [string](#string) | | 地址 | +| signature | [string](#string) | | 个性签名 | +| last_login_ip | [string](#string) | | 最后登录IP | +| register_ip | [string](#string) | | 注册IP | +| doc_count | [int32](#int32) | | 文档数量 | +| follow_count | [int32](#int32) | | 关注数量 | +| fans_count | [int32](#int32) | | 粉丝数量 | +| favorite_count | [int32](#int32) | | 收藏数量 | +| comment_count | [int32](#int32) | | 评论数量 | +| status | [int32](#int32) | | 用户状态,见 web/utils/enum.js,当前没有使用 | +| avatar | [string](#string) | | 头像 | +| identity | [string](#string) | | 身份证 | +| realname | [string](#string) | | 真实姓名 | +| group_id | [int64](#int64) | repeated | 用户组ID | +| credit_count | [int32](#int32) | | 积分 | @@ -380,8 +380,8 @@ | ListUserDynamic | [ListUserDynamicRequest](#api-v1-ListUserDynamicRequest) | [ListUserDynamicReply](#api-v1-ListUserDynamicReply) | 获取用户动态,包括获取关注的用户的动态 | | SignToday | [.google.protobuf.Empty](#google-protobuf-Empty) | [Sign](#api-v1-Sign) | 每日签到 | | GetSignedToday | [.google.protobuf.Empty](#google-protobuf-Empty) | [Sign](#api-v1-Sign) | 获取今日已签到记录 | -| FindPasswordStepOne | [FindPasswordRequest](#api-v1-FindPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| FindPasswordStepTwo | [FindPasswordRequest](#api-v1-FindPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | +| FindPasswordStepOne | [FindPasswordRequest](#api-v1-FindPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 找回密码:第一步,发送验证码 | +| FindPasswordStepTwo | [FindPasswordRequest](#api-v1-FindPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 找回密码:第二步,修改密码 | diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 363af8b..126d7b5 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -3,28 +3,32 @@ openapi: 3.0.3 info: - title: UserAPI API + title: "" version: 0.0.1 paths: - /api/v1/user: + /api/v1/article: get: tags: - - UserAPI - description: 查询用户信息。如果传递了Id参数,则表示查询用户的公开信息,否则查询当前用户的私有信息 - operationId: UserAPI_GetUser + - ArticleAPI + description: 获取文章 + operationId: ArticleAPI_GetArticle parameters: - name: id in: query schema: type: integer format: int64 + - name: identifier + in: query + schema: + type: string responses: "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/User' + $ref: '#/components/schemas/Article' default: description: Default error response content: @@ -33,14 +37,14 @@ paths: $ref: '#/components/schemas/Status' put: tags: - - UserAPI - description: 设置用户 - operationId: UserAPI_SetUser + - ArticleAPI + description: 更新文章 + operationId: ArticleAPI_UpdateArticle requestBody: content: application/json: schema: - $ref: '#/components/schemas/SetUserRequest' + $ref: '#/components/schemas/Article' required: true responses: "200": @@ -54,14 +58,14 @@ paths: $ref: '#/components/schemas/Status' post: tags: - - UserAPI - description: 新增用户 - operationId: UserAPI_AddUser + - ArticleAPI + description: 创建文章 + operationId: ArticleAPI_CreateArticle requestBody: content: application/json: schema: - $ref: '#/components/schemas/SetUserRequest' + $ref: '#/components/schemas/Article' required: true responses: "200": @@ -75,9 +79,9 @@ paths: $ref: '#/components/schemas/Status' delete: tags: - - UserAPI - description: 删除用户。需要验证用户权限 - operationId: UserAPI_DeleteUser + - ArticleAPI + description: 删除文章 + operationId: ArticleAPI_DeleteArticle parameters: - name: id in: query @@ -96,30 +100,34 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/caniuploaddocument: - get: - tags: - - UserAPI - description: 用户是否可以上传文档 - operationId: UserAPI_CanIUploadDocument - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/user/captcha: + /api/v1/article/list: get: tags: - - UserAPI - description: GetUserCaptcha 获取用户验证码 - operationId: UserAPI_GetUserCaptcha + - ArticleAPI + description: 文章列表 + operationId: ArticleAPI_ListArticle parameters: - - name: type + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: field + in: query + schema: + type: array + items: + type: string + - name: order in: query schema: type: string @@ -129,30 +137,20 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/GetUserCaptchaReply' + $ref: '#/components/schemas/ListArticleReply' default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/dynamic: + /api/v1/attachment: get: tags: - - UserAPI - description: 获取用户动态,包括获取关注的用户的动态 - operationId: UserAPI_ListUserDynamic + - AttachmentAPI + description: 查询附件 + operationId: AttachmentAPI_GetAttachment parameters: - - name: page - in: query - schema: - type: integer - format: int64 - - name: size - in: query - schema: - type: integer - format: int64 - name: id in: query schema: @@ -164,23 +162,23 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ListUserDynamicReply' + $ref: '#/components/schemas/Attachment' default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/findpassword/stepone: - post: + put: tags: - - UserAPI - operationId: UserAPI_FindPasswordStepOne + - AttachmentAPI + description: 更新附件 + operationId: AttachmentAPI_UpdateAttachment requestBody: content: application/json: schema: - $ref: '#/components/schemas/FindPasswordRequest' + $ref: '#/components/schemas/Attachment' required: true responses: "200": @@ -192,17 +190,19 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/findpassword/steptwo: - put: + delete: tags: - - UserAPI - operationId: UserAPI_FindPasswordStepTwo - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/FindPasswordRequest' - required: true + - AttachmentAPI + description: 删除附件。这里只是软删除,不会真正删除附件,默认24小时候会真正清除附件 + operationId: AttachmentAPI_DeleteAttachment + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 responses: "200": description: OK @@ -213,14 +213,12 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/list: + /api/v1/attachment/list: get: tags: - - UserAPI - description: |- - 查询用户列表。对于非管理员,返回相应用户的公开信息; - 对于管理员,返回相应用户的绝大部分信息 - operationId: UserAPI_ListUser + - AttachmentAPI + description: 列出附件 + operationId: AttachmentAPI_ListAttachment parameters: - name: page in: query @@ -236,32 +234,51 @@ paths: in: query schema: type: string - - name: sort + - name: enable in: query schema: - type: string - - name: id + type: array + items: + type: boolean + - name: userId in: query schema: type: array items: type: integer format: int64 - - name: groupId + - name: type in: query schema: type: array items: type: integer format: int64 - - name: status + - name: ext in: query schema: - type: array - items: - type: integer - format: int32 - - name: limit + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListAttachmentReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/banner: + get: + tags: + - BannerAPI + description: 查询横幅 + operationId: BannerAPI_GetBanner + parameters: + - name: id in: query schema: type: integer @@ -272,24 +289,44 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ListUserReply' + $ref: '#/components/schemas/Banner' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - BannerAPI + description: 更新横幅 + operationId: BannerAPI_UpdateBanner + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Banner' + required: true + responses: + "200": + description: OK + content: {} default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/login: post: tags: - - UserAPI - description: 用户登录 - operationId: UserAPI_Login + - BannerAPI + description: 创建横幅 + operationId: BannerAPI_CreateBanner requestBody: content: application/json: schema: - $ref: '#/components/schemas/RegisterAndLoginRequest' + $ref: '#/components/schemas/Banner' required: true responses: "200": @@ -297,19 +334,26 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/LoginReply' + $ref: '#/components/schemas/Banner' default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/logout: delete: tags: - - UserAPI - description: 退出登录 - operationId: UserAPI_Logout + - BannerAPI + description: 删除横幅 + operationId: BannerAPI_DeleteBanner + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 responses: "200": description: OK @@ -320,62 +364,94 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/password: - put: + /api/v1/banner/list: + get: tags: - - UserAPI - description: |- - 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; - 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限 - operationId: UserAPI_UpdateUserPassword - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateUserPasswordRequest' - required: true + - BannerAPI + description: 横幅列表 + operationId: BannerAPI_ListBanner + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: type + in: query + schema: + type: array + items: + type: integer + format: int32 + - name: enable + in: query + schema: + type: array + items: + type: boolean + - name: wd + in: query + schema: + type: string + - name: field + in: query + schema: + type: array + items: + type: string responses: "200": description: OK - content: {} + content: + application/json: + schema: + $ref: '#/components/schemas/ListBannerReply' default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/permission: + /api/v1/category: get: tags: - - UserAPI - description: GetUserCaptcha 获取用户验证码 - operationId: UserAPI_GetUserPermissions + - CategoryAPI + description: 获取分类 + operationId: CategoryAPI_GetCategory + parameters: + - name: id + in: query + schema: + type: integer + format: int64 responses: "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/GetUserPermissionsReply' + $ref: '#/components/schemas/Category' default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/profile: put: tags: - - UserAPI - description: |- - 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; - 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限 - operationId: UserAPI_UpdateUserProfile + - CategoryAPI + description: 更新分类 + operationId: CategoryAPI_UpdateCategory requestBody: content: application/json: schema: - $ref: '#/components/schemas/User' + $ref: '#/components/schemas/Category' required: true responses: "200": @@ -387,44 +463,122 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/register: post: tags: - - UserAPI - description: 用户注册 - operationId: UserAPI_Register + - CategoryAPI + description: 创建分类 + operationId: CategoryAPI_CreateCategory requestBody: content: application/json: schema: - $ref: '#/components/schemas/RegisterAndLoginRequest' + $ref: '#/components/schemas/Category' required: true responses: "200": description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/LoginReply' + content: {} default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/user/sign: - get: + delete: tags: - - UserAPI - description: 获取今日已签到记录 - operationId: UserAPI_GetSignedToday - responses: - "200": - description: OK + - CategoryAPI + description: 删除分类 + operationId: CategoryAPI_DeleteCategory + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response content: application/json: schema: - $ref: '#/components/schemas/Sign' + $ref: '#/components/schemas/Status' + /api/v1/category/list: + get: + tags: + - CategoryAPI + description: 分类列表 + operationId: CategoryAPI_ListCategory + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: parentId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: enable + in: query + schema: + type: array + items: + type: boolean + - name: field + in: query + schema: + type: array + items: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListCategoryReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/comment: + get: + tags: + - CommentAPI + description: 获取单个评论 + operationId: CommentAPI_GetComment + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' default: description: Default error response content: @@ -433,25 +587,3223 @@ paths: $ref: '#/components/schemas/Status' put: tags: - - UserAPI - description: 每日签到 - operationId: UserAPI_SignToday + - CommentAPI + description: 更新评论,仅限管理员操作 + operationId: CommentAPI_UpdateComment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + required: true responses: "200": description: OK + content: {} + default: + description: Default error response content: application/json: schema: - $ref: '#/components/schemas/Sign' + $ref: '#/components/schemas/Status' + post: + tags: + - CommentAPI + description: 创建评论 + operationId: CommentAPI_CreateComment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCommentRequest' + required: true + responses: + "200": + description: OK + content: {} default: description: Default error response content: application/json: schema: $ref: '#/components/schemas/Status' -components: - schemas: - Dynamic: + delete: + tags: + - CommentAPI + description: 管理员或用户自己删除自己的评论 + operationId: CommentAPI_DeleteComment + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/comment/check: + post: + tags: + - CommentAPI + description: 审核评论 + operationId: CommentAPI_CheckComment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CheckCommentRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/comment/list: + get: + tags: + - CommentAPI + description: 获取评论列表 + operationId: CommentAPI_ListComment + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: field + in: query + schema: + type: array + items: + type: string + - name: order + in: query + schema: + type: string + - name: status + in: query + schema: + type: array + items: + type: integer + format: int32 + - name: documentId + in: query + schema: + type: integer + format: int64 + - name: userId + in: query + schema: + type: integer + format: int64 + - name: parentId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: withDocumentTitle + in: query + schema: + type: boolean + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListCommentReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/config: + put: + tags: + - ConfigAPI + description: UpdateConfig 更新配置 + operationId: ConfigAPI_UpdateConfig + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Configs' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/config/list: + get: + tags: + - ConfigAPI + description: ListConfig 查询配置项 + operationId: ConfigAPI_ListConfig + parameters: + - name: category + in: query + schema: + type: array + items: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Configs' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document: + get: + tags: + - DocumentAPI + description: 查询文档 + operationId: DocumentAPI_GetDocument + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + - name: withAuthor + in: query + schema: + type: boolean + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - DocumentAPI + description: 更新文档 + operationId: DocumentAPI_UpdateDocument + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + post: + tags: + - DocumentAPI + description: 创建文档 + operationId: DocumentAPI_CreateDocument + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDocumentRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - DocumentAPI + description: 删除文档 + operationId: DocumentAPI_DeleteDocument + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/download: + get: + tags: + - DocumentAPI + description: 根据文档ID,获取文档下载链接 + operationId: DocumentAPI_DownloadDocument + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + - name: title + in: query + schema: + type: string + - name: keywords + in: query + schema: + type: string + - name: description + in: query + schema: + type: string + - name: userId + in: query + schema: + type: integer + format: int64 + - name: cover + in: query + schema: + type: string + - name: width + in: query + schema: + type: integer + format: int32 + - name: height + in: query + schema: + type: integer + format: int32 + - name: preview + in: query + schema: + type: integer + format: int32 + - name: pages + in: query + schema: + type: integer + format: int32 + - name: uuid + in: query + schema: + type: string + - name: downloadCount + in: query + schema: + type: integer + format: int32 + - name: viewCount + in: query + schema: + type: integer + format: int32 + - name: favoriteCount + in: query + schema: + type: integer + format: int32 + - name: commentCount + in: query + schema: + type: integer + format: int32 + - name: score + in: query + schema: + type: integer + format: int32 + - name: scoreCount + in: query + schema: + type: integer + format: int32 + - name: price + in: query + schema: + type: integer + format: int32 + - name: size + in: query + schema: + type: integer + format: int64 + - name: status + in: query + schema: + type: integer + format: int32 + - name: createdAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: createdAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: updatedAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: updatedAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: deletedAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: deletedAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: recommendAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: recommendAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: deletedUserId + in: query + schema: + type: integer + format: int64 + - name: username + in: query + schema: + type: string + - name: categoryId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: deletedUsername + in: query + schema: + type: string + - name: ext + in: query + schema: + type: string + - name: attachment.id + in: query + schema: + type: integer + format: int64 + - name: attachment.hash + in: query + schema: + type: string + - name: attachment.userId + in: query + schema: + type: integer + format: int64 + - name: attachment.typeId + in: query + schema: + type: integer + format: int64 + - name: attachment.type + in: query + schema: + type: integer + format: int32 + - name: attachment.enable + in: query + schema: + type: boolean + - name: attachment.path + in: query + schema: + type: string + - name: attachment.name + in: query + schema: + type: string + - name: attachment.size + in: query + schema: + type: integer + format: int64 + - name: attachment.width + in: query + schema: + type: integer + format: int64 + - name: attachment.height + in: query + schema: + type: integer + format: int64 + - name: attachment.ext + in: query + schema: + type: string + - name: attachment.ip + in: query + schema: + type: string + - name: attachment.username + in: query + schema: + type: string + - name: attachment.typeName + in: query + schema: + type: string + - name: attachment.description + in: query + schema: + type: string + - name: attachment.createdAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: attachment.createdAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: attachment.updatedAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: attachment.updatedAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: user.loginAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: user.loginAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: user.createdAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: user.createdAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: user.id + in: query + schema: + type: integer + format: int64 + - name: user.username + in: query + schema: + type: string + - name: user.mobile + in: query + schema: + type: string + - name: user.email + in: query + schema: + type: string + - name: user.address + in: query + schema: + type: string + - name: user.signature + in: query + schema: + type: string + - name: user.lastLoginIp + in: query + schema: + type: string + - name: user.registerIp + in: query + schema: + type: string + - name: user.docCount + in: query + schema: + type: integer + format: int32 + - name: user.followCount + in: query + schema: + type: integer + format: int32 + - name: user.fansCount + in: query + schema: + type: integer + format: int32 + - name: user.favoriteCount + in: query + schema: + type: integer + format: int32 + - name: user.commentCount + in: query + schema: + type: integer + format: int32 + - name: user.status + in: query + schema: + type: integer + format: int32 + - name: user.avatar + in: query + schema: + type: string + - name: user.identity + in: query + schema: + type: string + - name: user.realname + in: query + schema: + type: string + - name: user.groupId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: user.creditCount + in: query + schema: + type: integer + format: int32 + - name: enableGzip + in: query + schema: + type: boolean + - name: convertError + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DownloadDocumentReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/home: + get: + tags: + - DocumentAPI + description: 针对首页的文档查询 + operationId: DocumentAPI_ListDocumentForHome + parameters: + - name: limit + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListDocumentForHomeResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/list: + get: + tags: + - DocumentAPI + description: 文档列表查询 + operationId: DocumentAPI_ListDocument + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: field + in: query + schema: + type: array + items: + type: string + - name: order + in: query + schema: + type: string + - name: categoryId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: userId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: status + in: query + schema: + type: array + items: + type: integer + format: int32 + - name: isRecommend + in: query + schema: + type: array + items: + type: boolean + - name: limit + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListDocumentReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/recommend: + put: + tags: + - DocumentAPI + description: 设置文档推荐 + operationId: DocumentAPI_SetDocumentRecommend + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetDocumentRecommendRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/reconvert: + put: + tags: + - DocumentAPI + description: 将文档一键设置为重转 + operationId: DocumentAPI_SetDocumentReconvert + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/recycle: + get: + tags: + - RecycleAPI + description: 文档回收站列表 + operationId: RecycleAPI_ListRecycleDocument + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: field + in: query + schema: + type: array + items: + type: string + - name: order + in: query + schema: + type: string + - name: categoryId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: userId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: status + in: query + schema: + type: array + items: + type: integer + format: int32 + - name: isRecommend + in: query + schema: + type: array + items: + type: boolean + - name: limit + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListDocumentReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - RecycleAPI + description: 恢复回收站文档,支持恢复单个文档或者是批量恢复 + operationId: RecycleAPI_RecoverRecycleDocument + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RecoverRecycleDocumentRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - RecycleAPI + description: 删除回收站文档 + operationId: RecycleAPI_DeleteRecycleDocument + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/recycle/all: + delete: + tags: + - RecycleAPI + description: 清空回收站文档 + operationId: RecycleAPI_ClearRecycleDocument + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/related: + get: + tags: + - DocumentAPI + description: 根据文档ID查询当前文档的相关文档 + operationId: DocumentAPI_GetRelatedDocuments + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + - name: title + in: query + schema: + type: string + - name: keywords + in: query + schema: + type: string + - name: description + in: query + schema: + type: string + - name: userId + in: query + schema: + type: integer + format: int64 + - name: cover + in: query + schema: + type: string + - name: width + in: query + schema: + type: integer + format: int32 + - name: height + in: query + schema: + type: integer + format: int32 + - name: preview + in: query + schema: + type: integer + format: int32 + - name: pages + in: query + schema: + type: integer + format: int32 + - name: uuid + in: query + schema: + type: string + - name: downloadCount + in: query + schema: + type: integer + format: int32 + - name: viewCount + in: query + schema: + type: integer + format: int32 + - name: favoriteCount + in: query + schema: + type: integer + format: int32 + - name: commentCount + in: query + schema: + type: integer + format: int32 + - name: score + in: query + schema: + type: integer + format: int32 + - name: scoreCount + in: query + schema: + type: integer + format: int32 + - name: price + in: query + schema: + type: integer + format: int32 + - name: size + in: query + schema: + type: integer + format: int64 + - name: status + in: query + schema: + type: integer + format: int32 + - name: createdAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: createdAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: updatedAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: updatedAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: deletedAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: deletedAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: recommendAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: recommendAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: deletedUserId + in: query + schema: + type: integer + format: int64 + - name: username + in: query + schema: + type: string + - name: categoryId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: deletedUsername + in: query + schema: + type: string + - name: ext + in: query + schema: + type: string + - name: attachment.id + in: query + schema: + type: integer + format: int64 + - name: attachment.hash + in: query + schema: + type: string + - name: attachment.userId + in: query + schema: + type: integer + format: int64 + - name: attachment.typeId + in: query + schema: + type: integer + format: int64 + - name: attachment.type + in: query + schema: + type: integer + format: int32 + - name: attachment.enable + in: query + schema: + type: boolean + - name: attachment.path + in: query + schema: + type: string + - name: attachment.name + in: query + schema: + type: string + - name: attachment.size + in: query + schema: + type: integer + format: int64 + - name: attachment.width + in: query + schema: + type: integer + format: int64 + - name: attachment.height + in: query + schema: + type: integer + format: int64 + - name: attachment.ext + in: query + schema: + type: string + - name: attachment.ip + in: query + schema: + type: string + - name: attachment.username + in: query + schema: + type: string + - name: attachment.typeName + in: query + schema: + type: string + - name: attachment.description + in: query + schema: + type: string + - name: attachment.createdAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: attachment.createdAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: attachment.updatedAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: attachment.updatedAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: user.loginAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: user.loginAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: user.createdAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: user.createdAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: user.id + in: query + schema: + type: integer + format: int64 + - name: user.username + in: query + schema: + type: string + - name: user.mobile + in: query + schema: + type: string + - name: user.email + in: query + schema: + type: string + - name: user.address + in: query + schema: + type: string + - name: user.signature + in: query + schema: + type: string + - name: user.lastLoginIp + in: query + schema: + type: string + - name: user.registerIp + in: query + schema: + type: string + - name: user.docCount + in: query + schema: + type: integer + format: int32 + - name: user.followCount + in: query + schema: + type: integer + format: int32 + - name: user.fansCount + in: query + schema: + type: integer + format: int32 + - name: user.favoriteCount + in: query + schema: + type: integer + format: int32 + - name: user.commentCount + in: query + schema: + type: integer + format: int32 + - name: user.status + in: query + schema: + type: integer + format: int32 + - name: user.avatar + in: query + schema: + type: string + - name: user.identity + in: query + schema: + type: string + - name: user.realname + in: query + schema: + type: string + - name: user.groupId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: user.creditCount + in: query + schema: + type: integer + format: int32 + - name: enableGzip + in: query + schema: + type: boolean + - name: convertError + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListDocumentReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/score: + get: + tags: + - DocumentAPI + description: 获取当前登录用户的文档评分 + operationId: DocumentAPI_GetDocumentScore + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + - name: documentId + in: query + schema: + type: integer + format: int64 + - name: userId + in: query + schema: + type: integer + format: int64 + - name: score + in: query + schema: + type: integer + format: int32 + - name: createdAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: createdAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + - name: updatedAt.seconds + in: query + description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + schema: + type: integer + format: int64 + - name: updatedAt.nanos + in: query + description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + schema: + type: integer + format: int32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentScore' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + post: + tags: + - DocumentAPI + description: 设置文档评分 + operationId: DocumentAPI_SetDocumentScore + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentScore' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/document/search: + get: + tags: + - DocumentAPI + description: 文档搜索 + operationId: DocumentAPI_SearchDocument + parameters: + - name: page + in: query + schema: + type: integer + format: int32 + - name: size + in: query + schema: + type: integer + format: int32 + - name: wd + in: query + schema: + type: string + - name: categoryId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: sort + in: query + schema: + type: string + - name: ext + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SearchDocumentReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/envs: + get: + tags: + - ConfigAPI + description: 获取系统环境依赖检测 + operationId: ConfigAPI_GetEnvs + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Envs' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/favorite: + get: + tags: + - FavoriteAPI + description: 根据文章id,查询用户是否有收藏某篇文档 + operationId: FavoriteAPI_GetFavorite + parameters: + - name: documentId + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Favorite' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + post: + tags: + - FavoriteAPI + description: 添加收藏 + operationId: FavoriteAPI_CreateFavorite + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Favorite' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Favorite' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - FavoriteAPI + description: 取消收藏 + operationId: FavoriteAPI_DeleteFavorite + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/favorite/list: + get: + tags: + - FavoriteAPI + description: 查询用户的收藏 + operationId: FavoriteAPI_ListFavorite + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: userId + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFavoriteReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/friendlink: + get: + tags: + - FriendlinkAPI + description: 获取友情链接 + operationId: FriendlinkAPI_GetFriendlink + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Friendlink' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - FriendlinkAPI + description: 更新友情链接 + operationId: FriendlinkAPI_UpdateFriendlink + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Friendlink' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + post: + tags: + - FriendlinkAPI + description: 创建友情链接 + operationId: FriendlinkAPI_CreateFriendlink + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Friendlink' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Friendlink' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - FriendlinkAPI + description: 删除友情链接 + operationId: FriendlinkAPI_DeleteFriendlink + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/friendlink/list: + get: + tags: + - FriendlinkAPI + description: 获取友情链接 + operationId: FriendlinkAPI_ListFriendlink + parameters: + - name: page + in: query + schema: + type: integer + format: int32 + - name: size + in: query + schema: + type: integer + format: int32 + - name: wd + in: query + schema: + type: string + - name: enable + in: query + schema: + type: array + items: + type: boolean + - name: field + in: query + schema: + type: array + items: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFriendlinkReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/group: + get: + tags: + - GroupAPI + description: 获取用户组 + operationId: GroupAPI_GetGroup + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + - name: title + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Group' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - GroupAPI + description: 更新用户组 + operationId: GroupAPI_UpdateGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Group' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + post: + tags: + - GroupAPI + description: 创建用户组 + operationId: GroupAPI_CreateGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Group' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Group' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - GroupAPI + description: 删除用户组 + operationId: GroupAPI_DeleteGroup + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/group/list: + get: + tags: + - GroupAPI + description: 获取用户组列表 + operationId: GroupAPI_ListGroup + parameters: + - name: wd + in: query + schema: + type: string + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: sort + in: query + schema: + type: string + - name: field + in: query + schema: + type: array + items: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListGroupReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/group/permission: + get: + tags: + - GroupAPI + description: 获取用户组权限列表 + operationId: GroupAPI_GetGroupPermission + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GroupPermissions' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - GroupAPI + description: 更新用户组权限,给用户组设置权限 + operationId: GroupAPI_UpdateGroupPermission + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateGroupPermissionRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/permission: + get: + tags: + - PermissionAPI + description: 查询权限信息 + operationId: PermissionAPI_GetPermission + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Permission' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - PermissionAPI + description: 更新权限信息。这里只能操作title和description + operationId: PermissionAPI_UpdatePermission + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Permission' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/permission/list: + get: + tags: + - PermissionAPI + description: 查询权限列表 + operationId: PermissionAPI_ListPermission + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: method + in: query + schema: + type: array + items: + type: string + - name: path + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListPermissionReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/ping: + get: + tags: + - HealthAPI + operationId: HealthAPI_Ping + parameters: + - name: name + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PongReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/report: + put: + tags: + - ReportAPI + description: 更新举报,审核举报内容 + operationId: ReportAPI_UpdateReport + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Report' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + post: + tags: + - ReportAPI + description: 创建举报 + operationId: ReportAPI_CreateReport + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Report' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - ReportAPI + description: 删除举报 + operationId: ReportAPI_DeleteReport + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/report/list: + get: + tags: + - ReportAPI + description: 获取举报列表 + operationId: ReportAPI_ListReport + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: field + in: query + schema: + type: array + items: + type: string + - name: order + in: query + schema: + type: string + - name: status + in: query + schema: + type: array + items: + type: boolean + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListReportReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/settings: + get: + tags: + - ConfigAPI + description: 获取系统配置(针对所有用户,只读) + operationId: ConfigAPI_GetSettings + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Settings' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/sitemap: + put: + tags: + - ConfigAPI + description: 更新站点地图 + operationId: ConfigAPI_UpdateSitemap + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/stats: + get: + tags: + - ConfigAPI + description: 获取系统配置 + operationId: ConfigAPI_GetStats + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Stats' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user: + get: + tags: + - UserAPI + description: 查询用户信息。如果传递了Id参数,则表示查询用户的公开信息,否则查询当前用户的私有信息 + operationId: UserAPI_GetUser + parameters: + - name: id + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/User' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - UserAPI + description: 设置用户 + operationId: UserAPI_SetUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetUserRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + post: + tags: + - UserAPI + description: 新增用户 + operationId: UserAPI_AddUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetUserRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - UserAPI + description: 删除用户。需要验证用户权限 + operationId: UserAPI_DeleteUser + parameters: + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/caniuploaddocument: + get: + tags: + - UserAPI + description: 用户是否可以上传文档 + operationId: UserAPI_CanIUploadDocument + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/captcha: + get: + tags: + - UserAPI + description: GetUserCaptcha 获取用户验证码 + operationId: UserAPI_GetUserCaptcha + parameters: + - name: type + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetUserCaptchaReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/dynamic: + get: + tags: + - UserAPI + description: 获取用户动态,包括获取关注的用户的动态 + operationId: UserAPI_ListUserDynamic + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: id + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListUserDynamicReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/findpassword/stepone: + post: + tags: + - UserAPI + description: 找回密码:第一步,发送验证码 + operationId: UserAPI_FindPasswordStepOne + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FindPasswordRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/findpassword/steptwo: + put: + tags: + - UserAPI + description: 找回密码:第二步,修改密码 + operationId: UserAPI_FindPasswordStepTwo + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FindPasswordRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/list: + get: + tags: + - UserAPI + description: |- + 查询用户列表。对于非管理员,返回相应用户的公开信息; + 对于管理员,返回相应用户的绝大部分信息 + operationId: UserAPI_ListUser + parameters: + - name: page + in: query + schema: + type: integer + format: int64 + - name: size + in: query + schema: + type: integer + format: int64 + - name: wd + in: query + schema: + type: string + - name: sort + in: query + schema: + type: string + - name: id + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: groupId + in: query + schema: + type: array + items: + type: integer + format: int64 + - name: status + in: query + schema: + type: array + items: + type: integer + format: int32 + - name: limit + in: query + schema: + type: integer + format: int64 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListUserReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/login: + post: + tags: + - UserAPI + description: 用户登录 + operationId: UserAPI_Login + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RegisterAndLoginRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LoginReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/logout: + delete: + tags: + - UserAPI + description: 退出登录 + operationId: UserAPI_Logout + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/password: + put: + tags: + - UserAPI + description: |- + 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; + 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限 + operationId: UserAPI_UpdateUserPassword + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserPasswordRequest' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/permission: + get: + tags: + - UserAPI + description: GetUserCaptcha 获取用户验证码 + operationId: UserAPI_GetUserPermissions + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetUserPermissionsReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/profile: + put: + tags: + - UserAPI + description: |- + 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; + 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限 + operationId: UserAPI_UpdateUserProfile + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/register: + post: + tags: + - UserAPI + description: 用户注册 + operationId: UserAPI_Register + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RegisterAndLoginRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LoginReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/user/sign: + get: + tags: + - UserAPI + description: 获取今日已签到记录 + operationId: UserAPI_GetSignedToday + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Sign' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + put: + tags: + - UserAPI + description: 每日签到 + operationId: UserAPI_SignToday + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Sign' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /health: + get: + tags: + - HealthAPI + operationId: HealthAPI_Health + responses: + "200": + description: OK + content: {} + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' +components: + schemas: + Article: + type: object + properties: + id: + type: integer + format: int64 + identifier: + type: string + author: + type: string + viewCount: + type: integer + format: int64 + title: + type: string + keywords: + type: string + description: + type: string + content: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 文章 + Attachment: + type: object + properties: + id: + type: integer + format: int64 + hash: + type: string + userId: + type: integer + format: int64 + typeId: + type: integer + format: int64 + type: + type: integer + format: int32 + enable: + type: boolean + path: + type: string + name: + type: string + size: + type: integer + format: int64 + width: + type: integer + format: int64 + height: + type: integer + format: int64 + ext: + type: string + ip: + type: string + username: + type: string + typeName: + type: string + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 附件 + Banner: + type: object + properties: + id: + type: integer + format: int64 + title: + type: string + path: + type: string + sort: + type: integer + format: int32 + enable: + type: boolean + type: + type: integer + format: int32 + url: + type: string + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: banner,轮播图 + Category: + type: object + properties: + id: + type: integer + format: int32 + parentId: + type: integer + format: int32 + title: + type: string + docCount: + type: integer + format: int32 + sort: + type: integer + format: int32 + enable: + type: boolean + cover: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 文档分类 + CheckCommentRequest: + type: object + properties: + id: + type: array + items: + type: integer + format: int64 + status: + type: integer + format: int32 + description: 审核评论,修改评论状态 + Comment: + type: object + properties: + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + id: + type: integer + format: int64 + parentId: + type: integer + format: int64 + content: + type: string + documentId: + type: integer + format: int64 + status: + type: integer + format: int32 + commentCount: + type: integer + format: int32 + userId: + type: integer + format: int64 + user: + $ref: '#/components/schemas/User' + documentTitle: + type: string + description: 评论 + Config: + type: object + properties: + id: + type: integer + format: int64 + label: + type: string + name: + type: string + value: + type: string + placeholder: + type: string + inputType: + type: string + category: + type: string + sort: + type: integer + format: int32 + options: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 配置 + ConfigFooter: + type: object + properties: + about: + type: string + contact: + type: string + agreement: + type: string + copyright: + type: string + feedback: + type: string + description: 底链配置项,为跳转的链接地址 + ConfigSecurity: + type: object + properties: + isClose: + type: boolean + closeStatement: + type: string + enableRegister: + type: boolean + enableCaptchaLogin: + type: boolean + enableCaptchaRegister: + type: boolean + enableCaptchaComment: + type: boolean + enableCaptchaFindPassword: + type: boolean + enableCaptchaUpload: + type: boolean + maxDocumentSize: + type: integer + format: int32 + documentAllowedExt: + type: array + items: + type: string + loginRequired: + type: boolean + description: 安全配置 + ConfigSystem: + type: object + properties: + domain: + type: string + title: + type: string + keywords: + type: string + description: + type: string + logo: + type: string + favicon: + type: string + icp: + type: string + analytics: + type: string + sitename: + type: string + copyrightStartYear: + type: string + registerBackground: + type: string + loginBackground: + type: string + recommendWords: + type: array + items: + type: string + version: + type: string + description: 系统配置项 + Configs: + type: object + properties: + config: + type: array + items: + $ref: '#/components/schemas/Config' + description: 配置列表 + CreateCommentRequest: + type: object + properties: + documentId: + type: integer + format: int64 + parentId: + type: integer + format: int64 + content: + type: string + captchaId: + type: string + captcha: + type: string + description: 创建评论请求 + CreateDocumentItem: + type: object + properties: + title: + type: string + attachmentId: + type: integer + format: int64 + price: + type: integer + format: int32 + description: 创建文档 + CreateDocumentRequest: + type: object + properties: + overwrite: + type: boolean + categoryId: + type: array + items: + type: integer + format: int64 + document: + type: array + items: + $ref: '#/components/schemas/CreateDocumentItem' + description: 创建文档 + Document: + type: object + properties: + id: + type: integer + format: int64 + title: + type: string + keywords: + type: string + description: + type: string + userId: + type: integer + format: int64 + cover: + type: string + width: + type: integer + format: int32 + height: + type: integer + format: int32 + preview: + type: integer + format: int32 + pages: + type: integer + format: int32 + uuid: + type: string + downloadCount: + type: integer + format: int32 + viewCount: + type: integer + format: int32 + favoriteCount: + type: integer + format: int32 + commentCount: + type: integer + format: int32 + score: + type: integer + format: int32 + scoreCount: + type: integer + format: int32 + price: + type: integer + format: int32 + size: + type: integer + format: int64 + status: + type: integer + format: int32 + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + deletedAt: + type: string + format: date-time + recommendAt: + type: string + format: date-time + deletedUserId: + type: integer + format: int64 + username: + type: string + categoryId: + type: array + items: + type: integer + format: int64 + deletedUsername: + type: string + ext: + type: string + attachment: + $ref: '#/components/schemas/Attachment' + user: + $ref: '#/components/schemas/User' + enableGzip: + type: boolean + convertError: + type: string + description: 文档 + DocumentScore: + type: object + properties: + id: + type: integer + format: int64 + documentId: + type: integer + format: int64 + userId: + type: integer + format: int64 + score: + type: integer + format: int32 + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 文档评分 + DownloadDocumentReply: + type: object + properties: + url: + type: string + description: 文档下载 + Dynamic: + type: object + properties: + id: + type: integer + format: int64 + userId: + type: integer + format: int64 + content: + type: string + type: + type: integer + format: int32 + username: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 用户动态 + EnvDependent: + type: object + properties: + name: + type: string + description: + type: string + isInstalled: + type: boolean + error: + type: string + checkedAt: + type: string + format: date-time + cmd: + type: string + isRequired: + type: boolean + description: 依赖项 + Envs: + type: object + properties: + envs: + type: array + items: + $ref: '#/components/schemas/EnvDependent' + description: 依赖项列表 + Favorite: type: object properties: id: @@ -460,19 +3812,29 @@ components: userId: type: integer format: int64 - content: + documentId: + type: integer + format: int64 + title: type: string - type: + ext: + type: string + score: + type: integer + format: int32 + size: + type: integer + format: int64 + pages: type: integer format: int32 - username: - type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time + description: 文档收藏 FindPasswordRequest: type: object properties: @@ -486,6 +3848,31 @@ components: type: string captchaId: type: string + description: 找回密码 + Friendlink: + type: object + properties: + id: + type: integer + format: int32 + title: + type: string + link: + type: string + description: + type: string + sort: + type: integer + format: int32 + enable: + type: boolean + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 友情链接 GetUserCaptchaReply: type: object properties: @@ -497,6 +3884,7 @@ components: type: string type: type: string + description: 验证码响应 GetUserPermissionsReply: type: object properties: @@ -504,6 +3892,7 @@ components: type: array items: $ref: '#/components/schemas/Permission' + description: 用户权限信息查询 GoogleProtobufAny: type: object properties: @@ -512,6 +3901,192 @@ components: description: The type of the serialized message. additionalProperties: true description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. + Group: + type: object + properties: + id: + type: integer + format: int64 + title: + type: string + color: + type: string + isDefault: + type: boolean + isDisplay: + type: boolean + description: + type: string + userCount: + type: integer + format: int32 + sort: + type: integer + format: int32 + enableUpload: + type: boolean + enableCommentApproval: + type: boolean + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + description: 用户组,角色 + GroupPermissions: + type: object + properties: + permissionId: + type: array + items: + type: integer + format: int64 + description: 用户组权限 + ListArticleReply: + type: object + properties: + total: + type: integer + format: int64 + article: + type: array + items: + $ref: '#/components/schemas/Article' + description: 文章列表响应 + ListAttachmentReply: + type: object + properties: + total: + type: integer + format: int64 + attachment: + type: array + items: + $ref: '#/components/schemas/Attachment' + description: 列出附件响应 + ListBannerReply: + type: object + properties: + total: + type: integer + format: int64 + banner: + type: array + items: + $ref: '#/components/schemas/Banner' + description: 横幅列表 + ListCategoryReply: + type: object + properties: + total: + type: integer + format: int64 + category: + type: array + items: + $ref: '#/components/schemas/Category' + description: 分类列表响应 + ListCommentReply: + type: object + properties: + total: + type: integer + format: int64 + comment: + type: array + items: + $ref: '#/components/schemas/Comment' + description: 获取评论列表响应 + ListDocumentForHomeItem: + type: object + properties: + categoryId: + type: integer + format: int64 + categoryCover: + type: string + categoryName: + type: string + document: + type: array + items: + $ref: '#/components/schemas/Document' + description: 首页文档查询返回项 + ListDocumentForHomeResponse: + type: object + properties: + document: + type: array + items: + $ref: '#/components/schemas/ListDocumentForHomeItem' + description: 查询文档(针对首页的查询) + ListDocumentReply: + type: object + properties: + total: + type: integer + format: int64 + document: + type: array + items: + $ref: '#/components/schemas/Document' + description: 文档列表 + ListFavoriteReply: + type: object + properties: + total: + type: integer + format: int64 + favorite: + type: array + items: + $ref: '#/components/schemas/Favorite' + description: 查询用户的收藏 + ListFriendlinkReply: + type: object + properties: + friendlink: + type: array + items: + $ref: '#/components/schemas/Friendlink' + total: + type: integer + format: int64 + description: 友情链接列表 + ListGroupReply: + type: object + properties: + group: + type: array + items: + $ref: '#/components/schemas/Group' + total: + type: integer + format: int64 + description: 用户组列表 + ListPermissionReply: + type: object + properties: + total: + type: integer + format: int64 + permission: + type: array + items: + $ref: '#/components/schemas/Permission' + description: 权限列表响应 + ListReportReply: + type: object + properties: + total: + type: integer + format: int64 + report: + type: array + items: + $ref: '#/components/schemas/Report' + description: 举报列表响应 ListUserDynamicReply: type: object properties: @@ -522,6 +4097,7 @@ components: type: array items: $ref: '#/components/schemas/Dynamic' + description: 用户动态列表响应 ListUserReply: type: object properties: @@ -532,6 +4108,7 @@ components: type: array items: $ref: '#/components/schemas/User' + description: 用户列表响应 LoginReply: type: object properties: @@ -539,6 +4116,7 @@ components: type: string user: $ref: '#/components/schemas/User' + description: 用户登录响应 Permission: type: object properties: @@ -559,6 +4137,24 @@ components: updatedAt: type: string format: date-time + description: 权限 + PongReply: + type: object + properties: + name: + type: string + createdAt: + type: string + format: date-time + RecoverRecycleDocumentRequest: + type: object + properties: + id: + type: array + items: + type: integer + format: int64 + description: 恢复文档 RegisterAndLoginRequest: type: object properties: @@ -572,6 +4168,62 @@ components: type: string email: type: string + description: 用户注册登录请求 + Report: + type: object + properties: + id: + type: integer + format: int64 + documentId: + type: integer + format: int64 + userId: + type: integer + format: int64 + reason: + type: integer + format: int32 + status: + type: boolean + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + documentTitle: + type: string + remark: + type: string + username: + type: string + description: 举报 + SearchDocumentReply: + type: object + properties: + total: + type: integer + format: int64 + spend: + type: string + document: + type: array + items: + $ref: '#/components/schemas/Document' + description: 文档搜索响应 + SetDocumentRecommendRequest: + type: object + properties: + id: + type: array + items: + type: integer + format: int64 + type: + type: integer + format: int32 + description: 设置文档推荐 SetUserRequest: type: object properties: @@ -589,6 +4241,17 @@ components: format: int64 email: type: string + description: 管理后台设置用户信息 + Settings: + type: object + properties: + system: + $ref: '#/components/schemas/ConfigSystem' + footer: + $ref: '#/components/schemas/ConfigFooter' + security: + $ref: '#/components/schemas/ConfigSecurity' + description: 系统配置 Sign: type: object properties: @@ -609,6 +4272,43 @@ components: award: type: integer format: int32 + description: 用户签到 + Stats: + type: object + properties: + userCount: + type: integer + format: int64 + documentCount: + type: integer + format: int64 + categoryCount: + type: integer + format: int64 + articleCount: + type: integer + format: int64 + commentCount: + type: integer + format: int64 + bannerCount: + type: integer + format: int64 + friendlinkCount: + type: integer + format: int64 + os: + type: string + version: + type: string + hash: + type: string + buildAt: + type: string + reportCount: + type: integer + format: int64 + description: 系统状态 Status: type: object properties: @@ -625,6 +4325,18 @@ components: $ref: '#/components/schemas/GoogleProtobufAny' description: A list of messages that carry the error details. There is a common set of message types for APIs to use. description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).' + UpdateGroupPermissionRequest: + type: object + properties: + groupId: + type: integer + format: int64 + permissionId: + type: array + items: + type: integer + format: int64 + description: 更新用户组权限 UpdateUserPasswordRequest: type: object properties: @@ -697,5 +4409,30 @@ components: creditCount: type: integer format: int32 + description: 用户信息 tags: + - name: ArticleAPI + description: 文章API服务 + - name: AttachmentAPI + description: 附件服务。只有管理员才有权限操作 + - name: BannerAPI + description: 横幅API服务 + - name: CategoryAPI + description: 文档分类API服务 + - name: CommentAPI + description: 评论服务 + - name: ConfigAPI + description: 配置服务 + - name: DocumentAPI + description: 文档服务 + - name: FavoriteAPI + - name: FriendlinkAPI + description: 友情链接服务 + - name: GroupAPI + - name: HealthAPI + - name: PermissionAPI + description: 权限API服务 + - name: RecycleAPI + - name: ReportAPI + description: 举报服务 - name: UserAPI