diff --git a/api/v1/category.pb.go b/api/v1/category.pb.go index 46f9049..bef7522 100644 --- a/api/v1/category.pb.go +++ b/api/v1/category.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 文档分类 type Category struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` ParentId int32 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` @@ -141,6 +142,7 @@ func (m *Category) GetUpdatedAt() *time.Time { return nil } +// 分类列表请求 type ListCategoryRequest 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"` @@ -225,6 +227,7 @@ func (m *ListCategoryRequest) GetField() []string { return nil } +// 分类列表响应 type ListCategoryReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Category []*Category `protobuf:"bytes,2,rep,name=category,proto3" json:"category,omitempty"` @@ -277,6 +280,7 @@ func (m *ListCategoryReply) GetCategory() []*Category { return nil } +// 删除分类请求 type DeleteCategoryRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -321,6 +325,7 @@ func (m *DeleteCategoryRequest) GetId() []int64 { return nil } +// 获取分类请求 type GetCategoryRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -432,10 +437,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 CategoryAPIClient interface { + // 创建分类 CreateCategory(ctx context.Context, in *Category, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 更新分类 UpdateCategory(ctx context.Context, in *Category, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 删除分类 DeleteCategory(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 获取分类 GetCategory(ctx context.Context, in *GetCategoryRequest, opts ...grpc.CallOption) (*Category, error) + // 分类列表 ListCategory(ctx context.Context, in *ListCategoryRequest, opts ...grpc.CallOption) (*ListCategoryReply, error) } @@ -494,10 +504,15 @@ func (c *categoryAPIClient) ListCategory(ctx context.Context, in *ListCategoryRe // CategoryAPIServer is the server API for CategoryAPI service. type CategoryAPIServer interface { + // 创建分类 CreateCategory(context.Context, *Category) (*emptypb.Empty, error) + // 更新分类 UpdateCategory(context.Context, *Category) (*emptypb.Empty, error) + // 删除分类 DeleteCategory(context.Context, *DeleteCategoryRequest) (*emptypb.Empty, error) + // 获取分类 GetCategory(context.Context, *GetCategoryRequest) (*Category, error) + // 分类列表 ListCategory(context.Context, *ListCategoryRequest) (*ListCategoryReply, error) } diff --git a/api/v1/category.proto b/api/v1/category.proto index bd191d1..65cb5e7 100644 --- a/api/v1/category.proto +++ b/api/v1/category.proto @@ -12,41 +12,48 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; +// 文档分类 message Category { - int32 id = 1; - int32 parent_id = 2; - string title = 3 [(gogoproto.moretags) = "validate:\"required\""]; - int32 doc_count = 4; - int32 sort = 5; - bool enable = 6; + int32 id = 1; // 分类ID + int32 parent_id = 2; // 父分类ID + string title = 3 + [ (gogoproto.moretags) = "validate:\"required\"" ]; // 分类标题 + int32 doc_count = 4; // 文档数量 + int32 sort = 5; // 排序,倒序排序,值越大越靠前 + bool enable = 6; // 是否启用 string cover = 9; // 分类封面 - google.protobuf.Timestamp created_at = 7 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 8 [ (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp created_at = 7 + [ (gogoproto.stdtime) = true ]; // 创建时间 + google.protobuf.Timestamp updated_at = 8 + [ (gogoproto.stdtime) = true ]; // 更新时间 } +// 分类列表请求 message ListCategoryRequest { - int64 page = 1; - int64 size = 2; - repeated int64 parent_id = 3; - string wd = 4; - repeated bool enable = 5; - repeated string field = 6; + int64 page = 1; // 页码 + int64 size = 2; // 每页数量 + repeated int64 parent_id = 3; // 父分类ID + string wd = 4; // 搜索关键字 + repeated bool enable = 5; // 是否启用 + repeated string field = 6; // 查询字段 } +// 分类列表响应 message ListCategoryReply { - int64 total = 1; - repeated Category category = 2; + int64 total = 1; // 总数 + repeated Category category = 2; // 分类列表 } -message DeleteCategoryRequest{ - repeated int64 id = 1; -} +// 删除分类请求 +message DeleteCategoryRequest { repeated int64 id = 1; } -message GetCategoryRequest{ - int64 id = 1; -} +// 获取分类请求 +message GetCategoryRequest { int64 id = 1; } +// 文档分类API服务 service CategoryAPI { + + // 创建分类 rpc CreateCategory(Category) returns (google.protobuf.Empty) { option (google.api.http) = { post : '/api/v1/category', @@ -54,6 +61,7 @@ service CategoryAPI { }; } + // 更新分类 rpc UpdateCategory(Category) returns (google.protobuf.Empty) { option (google.api.http) = { put : '/api/v1/category', @@ -61,18 +69,21 @@ service CategoryAPI { }; } + // 删除分类 rpc DeleteCategory(DeleteCategoryRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete : '/api/v1/category', }; } + // 获取分类 rpc GetCategory(GetCategoryRequest) returns (Category) { option (google.api.http) = { get : '/api/v1/category', }; } + // 分类列表 rpc ListCategory(ListCategoryRequest) returns (ListCategoryReply) { option (google.api.http) = { get : '/api/v1/category/list', diff --git a/api/v1/comment.pb.go b/api/v1/comment.pb.go index 99d6be3..be231a6 100644 --- a/api/v1/comment.pb.go +++ b/api/v1/comment.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 评论 type Comment struct { CreatedAt *time.Time `protobuf:"bytes,1,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,2,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` @@ -157,6 +158,7 @@ func (m *Comment) GetDocumentTitle() string { return "" } +// 审核评论,修改评论状态 type CheckCommentRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` @@ -209,6 +211,7 @@ func (m *CheckCommentRequest) GetStatus() int32 { return 0 } +// 删除评论请求 type DeleteCommentRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -253,6 +256,7 @@ func (m *DeleteCommentRequest) GetId() []int64 { return nil } +// 获取评论请求 type GetCommentRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -297,6 +301,7 @@ func (m *GetCommentRequest) GetId() int64 { return 0 } +// 获取评论列表请求 type ListCommentRequest 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"` @@ -413,6 +418,7 @@ func (m *ListCommentRequest) GetWithDocumentTitle() bool { return false } +// 获取评论列表响应 type ListCommentReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Comment []*Comment `protobuf:"bytes,2,rep,name=comment,proto3" json:"comment,omitempty"` @@ -465,6 +471,7 @@ func (m *ListCommentReply) GetComment() []*Comment { return nil } +// 创建评论请求 type CreateCommentRequest struct { DocumentId int64 `protobuf:"varint,1,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty"` ParentId int64 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` @@ -620,6 +627,7 @@ 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 CommentAPIClient interface { + // 创建评论 CreateComment(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // 更新评论,仅限管理员操作 UpdateComment(ctx context.Context, in *Comment, opts ...grpc.CallOption) (*emptypb.Empty, error) @@ -697,6 +705,7 @@ func (c *commentAPIClient) CheckComment(ctx context.Context, in *CheckCommentReq // CommentAPIServer is the server API for CommentAPI service. type CommentAPIServer interface { + // 创建评论 CreateComment(context.Context, *CreateCommentRequest) (*emptypb.Empty, error) // 更新评论,仅限管理员操作 UpdateComment(context.Context, *Comment) (*emptypb.Empty, error) diff --git a/api/v1/comment.proto b/api/v1/comment.proto index f9451fb..3c284ca 100644 --- a/api/v1/comment.proto +++ b/api/v1/comment.proto @@ -1,4 +1,4 @@ -syntax="proto3"; +syntax = "proto3"; import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; @@ -13,101 +13,109 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; -message Comment{ - google.protobuf.Timestamp created_at = 1 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 2 [ (gogoproto.stdtime) = true ]; - int64 id = 3; - int64 parent_id = 4; - string content = 5; - int64 document_id = 6; - int32 status = 7; - int32 comment_count = 8; - int64 user_id = 9; - User user = 10; - string document_title=11; +// 评论 +message Comment { + google.protobuf.Timestamp created_at = 1 + [ (gogoproto.stdtime) = true ]; // 创建时间 + google.protobuf.Timestamp updated_at = 2 + [ (gogoproto.stdtime) = true ]; // 更新时间 + int64 id = 3; // 评论ID + int64 parent_id = 4; // 父评论ID + string content = 5; // 评论内容 + int64 document_id = 6; // 文档ID + int32 status = 7; // 状态,见 web/utils/enum.js 枚举 + int32 comment_count = 8; // 回复数量 + int64 user_id = 9; // 用户ID + User user = 10; // 用户信息 + string document_title = 11; // 文档标题 } +// 审核评论,修改评论状态 message CheckCommentRequest { - repeated int64 id = 1; - int32 status = 2; + repeated int64 id = 1; // 评论ID + int32 status = 2; // 状态,见 web/utils/enum.js 枚举 } -message DeleteCommentRequest { - repeated int64 id = 1; -} +// 删除评论请求 +message DeleteCommentRequest { repeated int64 id = 1; } -message GetCommentRequest { - int64 id = 1; -} +// 获取评论请求 +message GetCommentRequest { int64 id = 1; } +// 获取评论列表请求 message ListCommentRequest { - int64 page = 1; - int64 size = 2; - string wd = 3; - repeated string field = 4; - string order = 5; - repeated int32 status = 6; - int64 document_id = 7; - int64 user_id = 8; - repeated int64 parent_id = 9; - bool with_document_title = 10; + int64 page = 1; // 页码 + int64 size = 2; // 每页数量 + string wd = 3; // 搜索关键词 + repeated string field = 4; // 查询的数据字段 + string order = 5; // 排序字段 + repeated int32 status = 6; // 状态,见 web/utils/enum.js 枚举 + int64 document_id = 7; // 文档ID + int64 user_id = 8; // 用户ID + repeated int64 parent_id = 9; // 父评论ID + bool with_document_title = 10; // 是否返回文档标题 } +// 获取评论列表响应 message ListCommentReply { - int64 total = 1; - repeated Comment comment = 2; + int64 total = 1; // 总数 + repeated Comment comment = 2; // 评论列表 } -message CreateCommentRequest{ - int64 document_id = 1; - int64 parent_id = 2; - string content = 3; - string captcha_id = 4; - string captcha = 5; +// 创建评论请求 +message CreateCommentRequest { + int64 document_id = 1; // 文档ID + int64 parent_id = 2; // 父评论ID + string content = 3; // 评论内容 + string captcha_id = 4; // 验证码ID + string captcha = 5; // 验证码 } -service CommentAPI{ - rpc CreateComment (CreateCommentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: '/api/v1/comment', - body: '*', - }; - } - - // 更新评论,仅限管理员操作 - rpc UpdateComment (Comment) returns (google.protobuf.Empty){ - option (google.api.http) = { - put: '/api/v1/comment', - body: '*', - }; - } - - // 管理员或用户自己删除自己的评论 - rpc DeleteComment (DeleteCommentRequest) returns (google.protobuf.Empty){ - option (google.api.http) = { - delete: '/api/v1/comment', - }; - } - - // 获取单个评论 - rpc GetComment (GetCommentRequest) returns (Comment){ - option (google.api.http) = { - get: '/api/v1/comment', - }; - } - - // 获取评论列表 - rpc ListComment (ListCommentRequest) returns (ListCommentReply){ - option (google.api.http) = { - get: '/api/v1/comment/list', - }; - } - - // 审核评论 - rpc CheckComment (CheckCommentRequest) returns (google.protobuf.Empty){ - option (google.api.http) = { - post: '/api/v1/comment/check', - body: '*', - }; - } +// 评论服务 +service CommentAPI { + + // 创建评论 + rpc CreateComment(CreateCommentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post : '/api/v1/comment', + body : '*', + }; + } + + // 更新评论,仅限管理员操作 + rpc UpdateComment(Comment) returns (google.protobuf.Empty) { + option (google.api.http) = { + put : '/api/v1/comment', + body : '*', + }; + } + + // 管理员或用户自己删除自己的评论 + rpc DeleteComment(DeleteCommentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete : '/api/v1/comment', + }; + } + + // 获取单个评论 + rpc GetComment(GetCommentRequest) returns (Comment) { + option (google.api.http) = { + get : '/api/v1/comment', + }; + } + + // 获取评论列表 + rpc ListComment(ListCommentRequest) returns (ListCommentReply) { + option (google.api.http) = { + get : '/api/v1/comment/list', + }; + } + + // 审核评论 + rpc CheckComment(CheckCommentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post : '/api/v1/comment/check', + body : '*', + }; + } } \ No newline at end of file diff --git a/api/v1/config.pb.go b/api/v1/config.pb.go index 93b9db3..b78eb7b 100644 --- a/api/v1/config.pb.go +++ b/api/v1/config.pb.go @@ -33,18 +33,20 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 配置 type Config struct { - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - Placeholder string `protobuf:"bytes,5,opt,name=placeholder,proto3" json:"placeholder,omitempty"` - InputType string `protobuf:"bytes,6,opt,name=input_type,json=inputType,proto3" json:"input_type,omitempty"` - Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"` - Sort int32 `protobuf:"varint,8,opt,name=sort,proto3" json:"sort,omitempty"` - Options string `protobuf:"bytes,9,opt,name=options,proto3" json:"options,omitempty"` - CreatedAt *time.Time `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` - UpdatedAt *time.Time `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + Placeholder string `protobuf:"bytes,5,opt,name=placeholder,proto3" json:"placeholder,omitempty"` + InputType string `protobuf:"bytes,6,opt,name=input_type,json=inputType,proto3" json:"input_type,omitempty"` + // element-ui 的 el-input 的 type 属性 + Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"` + Sort int32 `protobuf:"varint,8,opt,name=sort,proto3" json:"sort,omitempty"` + Options string `protobuf:"bytes,9,opt,name=options,proto3" json:"options,omitempty"` + CreatedAt *time.Time `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` + UpdatedAt *time.Time `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` } func (m *Config) Reset() { *m = Config{} } @@ -157,6 +159,7 @@ func (m *Config) GetUpdatedAt() *time.Time { return nil } +// 查询配置项请求 type ListConfigRequest struct { Category []string `protobuf:"bytes,1,rep,name=category,proto3" json:"category,omitempty"` } @@ -201,6 +204,7 @@ func (m *ListConfigRequest) GetCategory() []string { return nil } +// 配置列表 type Configs struct { Config []*Config `protobuf:"bytes,1,rep,name=config,proto3" json:"config,omitempty"` } @@ -463,7 +467,7 @@ func (m *ConfigSystem) GetVersion() string { return "" } -// 底链配置项 +// 底链配置项,为跳转的链接地址 type ConfigFooter struct { About string `protobuf:"bytes,1,opt,name=about,proto3" json:"about,omitempty"` Contact string `protobuf:"bytes,2,opt,name=contact,proto3" json:"contact,omitempty"` @@ -665,6 +669,7 @@ func (m *ConfigSecurity) GetLoginRequired() bool { return false } +// 系统配置 type Settings struct { System *ConfigSystem `protobuf:"bytes,1,opt,name=system,proto3" json:"system,omitempty"` Footer *ConfigFooter `protobuf:"bytes,2,opt,name=footer,proto3" json:"footer,omitempty"` @@ -725,6 +730,7 @@ func (m *Settings) GetSecurity() *ConfigSecurity { return nil } +// 依赖项 type EnvDependent struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` @@ -817,6 +823,7 @@ func (m *EnvDependent) GetIsRequired() bool { return false } +// 依赖项列表 type Envs struct { Envs []*EnvDependent `protobuf:"bytes,1,rep,name=envs,proto3" json:"envs,omitempty"` } @@ -861,6 +868,7 @@ func (m *Envs) GetEnvs() []*EnvDependent { return nil } +// 系统状态 type Stats struct { UserCount int64 `protobuf:"varint,1,opt,name=user_count,json=userCount,proto3" json:"user_count,omitempty"` DocumentCount int64 `protobuf:"varint,2,opt,name=document_count,json=documentCount,proto3" json:"document_count,omitempty"` diff --git a/api/v1/config.proto b/api/v1/config.proto index c853246..f436aa7 100644 --- a/api/v1/config.proto +++ b/api/v1/config.proto @@ -12,81 +12,92 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; +// 配置 message Config { - int64 id = 1; - string label = 2; - string name = 3; - string value = 4; - string placeholder = 5; - string input_type = 6; - string category = 7; - int32 sort = 8; - string options = 9; - google.protobuf.Timestamp created_at = 10 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 11 [ (gogoproto.stdtime) = true ]; + int64 id = 1; // 配置ID + string label = 2; // 配置标签 + string name = 3; // 配置名称 + string value = 4; // 配置值 + string placeholder = 5; // 配置占位符 + string input_type = 6; // 输入类型,如:textarea、number、switch等,为 + // element-ui 的 el-input 的 type 属性 + string category = + 7; // 配置分类,如:system、footer、security等,见 web/utils/enum.js + int32 sort = 8; // 排序,越小越靠前 + string options = + 9; // 配置项枚举,一个一行,如select的option选项,用 key=value 的形式 + google.protobuf.Timestamp created_at = 10 + [ (gogoproto.stdtime) = true ]; // 创建时间 + google.protobuf.Timestamp updated_at = 11 + [ (gogoproto.stdtime) = true ]; // 更新时间 } +// 查询配置项请求 message ListConfigRequest { repeated string category = 1; } +// 配置列表 message Configs { repeated Config config = 1; } // 验证码配置 message ConfigCaptcha { - int32 length = 1; - int32 width = 2; - int32 height = 3; - string type = 4; + int32 length = 1; // 验证码长度 + int32 width = 2; // 验证码宽度 + int32 height = 3; // 验证码高度 + string type = 4; // 验证码类型,见 web/utils/enum.js } // 系统配置项 message ConfigSystem { - string domain = 1; - string title = 2; - string keywords = 3; - string description = 4; - string logo = 5; - string favicon = 6; - string icp = 7; - string analytics = 8; - string sitename = 9; - string copyright_start_year = 10; - string register_background = 11; - string login_background = 12; - repeated string recommend_words = 13; - string version = 14; // 程序版本号 + string domain = 1; // 站点域名,如: https://moredoc.mnt.ltd + string title = 2; // 站点标题,首页显示 + string keywords = 3; // 站点关键词,SEO用 + string description = 4; // 站点描述,SEO用 + string logo = 5; // 站点logo + string favicon = 6; // 站点favicon + string icp = 7; // 站点备案号 + string analytics = 8; // 站点统计代码,目前只支持百度统计 + string sitename = 9; // 站点名称 + string copyright_start_year = + 10; // 站点版权起始年份,如:2018,则底部显示 2018 - 2023 + string register_background = 11; // 注册页背景图 + string login_background = 12; // 登录页背景图 + repeated string recommend_words = 13; // 推荐搜索词,首页展示 + string version = 14; // 程序版本号 } -// 底链配置项 +// 底链配置项,为跳转的链接地址 message ConfigFooter { - string about = 1; - string contact = 2; - string agreement = 3; - string copyright = 4; - string feedback = 5; + string about = 1; // 关于我们 + string contact = 2; // 联系我们 + string agreement = 3; // 用户协议、文库协议 + string copyright = 4; // 版权声明 + string feedback = 5; // 意见和建议反馈 } // 安全配置 message ConfigSecurity { - bool is_close = 1; - string close_statement = 2; - bool enable_register = 3; - bool enable_captcha_login = 4; - bool enable_captcha_register = 5; - bool enable_captcha_comment = 6; - bool enable_captcha_find_password = 7; - bool enable_captcha_upload = 8; - int32 max_document_size = 9; - repeated string document_allowed_ext = 10; - bool login_required = 11; // 是否登录才能访问 + bool is_close = 1; // 是否关闭站点 + string close_statement = 2; // 关闭站点的说明,支持HTML + bool enable_register = 3; // 是否开放注册 + bool enable_captcha_login = 4; // 是否开启登录验证码 + bool enable_captcha_register = 5; // 是否开启注册验证码 + bool enable_captcha_comment = 6; // 是否开启评论验证码 + bool enable_captcha_find_password = 7; // 是否开启找回密码验证码 + bool enable_captcha_upload = 8; // 是否开启上传验证码 + int32 max_document_size = 9; // 文档最大大小 + repeated string document_allowed_ext = 10; // 文档允许的扩展名 + bool login_required = 11; // 是否登录才能访问 } +// 系统配置 message Settings { - ConfigSystem system = 1; - ConfigFooter footer = 2; - ConfigSecurity security = 3; + ConfigSystem system = 1; // 系统配置 + ConfigFooter footer = 2; // 底链配置 + ConfigSecurity security = 3; // 安全配置 // ConfigCaptcha captcha = 4; } +// 依赖项 message EnvDependent { string name = 1; // 依赖名称 string description = 2; // 依赖描述 @@ -98,24 +109,28 @@ message EnvDependent { bool is_required = 7; // 是否必须 } +// 依赖项列表 message Envs { repeated EnvDependent envs = 1; } +// 系统状态 message Stats { - int64 user_count = 1; - int64 document_count = 2; - int64 category_count = 3; - int64 article_count = 4; - int64 comment_count = 5; - int64 banner_count = 6; - int64 friendlink_count = 7; - string os = 8; - string version = 9; - string hash = 10; - string build_at = 11; - int64 report_count = 12; + int64 user_count = 1; // 用户数量 + int64 document_count = 2; // 文档数量 + int64 category_count = 3; // 分类数量 + int64 article_count = 4; // 文章数量 + int64 comment_count = 5; // 评论数量 + int64 banner_count = 6; // banner数量 + int64 friendlink_count = 7; // 友情链接数量 + string os = 8; // 操作系统 + string version = 9; // 程序版本号 + string hash = 10; // 程序构建时的 git hash + string build_at = 11; // 程序构建时间 + int64 report_count = 12; // 举报数量 } +// 配置服务 service ConfigAPI { + // 获取系统配置(针对所有用户,只读) rpc GetSettings(google.protobuf.Empty) returns (Settings) { option (google.api.http) = { diff --git a/api/v1/document.pb.go b/api/v1/document.pb.go index 14bfbcc..eb0385d 100644 --- a/api/v1/document.pb.go +++ b/api/v1/document.pb.go @@ -33,6 +33,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// 文档 type Document 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"` @@ -333,6 +334,7 @@ func (m *Document) GetConvertError() string { return "" } +// 删除文档,放入回收站 type DeleteDocumentRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -377,6 +379,7 @@ func (m *DeleteDocumentRequest) GetId() []int64 { return nil } +// 恢复文档 type RecoverRecycleDocumentRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } @@ -421,6 +424,7 @@ func (m *RecoverRecycleDocumentRequest) GetId() []int64 { return nil } +// 查询文档 type GetDocumentRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` WithAuthor bool `protobuf:"varint,2,opt,name=with_author,json=withAuthor,proto3" json:"with_author,omitempty"` @@ -473,6 +477,7 @@ func (m *GetDocumentRequest) GetWithAuthor() bool { return false } +// 文档列表 type ListDocumentRequest 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"` @@ -589,6 +594,7 @@ func (m *ListDocumentRequest) GetLimit() int64 { return 0 } +// 文档列表 type ListDocumentReply struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Document []*Document `protobuf:"bytes,2,rep,name=document,proto3" json:"document,omitempty"` @@ -641,6 +647,7 @@ func (m *ListDocumentReply) GetDocument() []*Document { return nil } +// 创建文档 type CreateDocumentItem struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` AttachmentId int64 `protobuf:"varint,2,opt,name=attachment_id,json=attachmentId,proto3" json:"attachment_id,omitempty"` @@ -701,6 +708,7 @@ func (m *CreateDocumentItem) GetPrice() int32 { return 0 } +// 创建文档 type CreateDocumentRequest struct { Overwrite bool `protobuf:"varint,1,opt,name=overwrite,proto3" json:"overwrite,omitempty"` CategoryId []int64 `protobuf:"varint,2,rep,packed,name=category_id,json=categoryId,proto3" json:"category_id,omitempty"` @@ -761,6 +769,7 @@ func (m *CreateDocumentRequest) GetDocument() []*CreateDocumentItem { return nil } +// 设置文档推荐 type SetDocumentRecommendRequest struct { Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` Type int32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` @@ -813,6 +822,7 @@ func (m *SetDocumentRecommendRequest) GetType() int32 { return 0 } +// 查询文档(针对首页的查询) type ListDocumentForHomeRequest struct { Limit int64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` } @@ -857,6 +867,7 @@ func (m *ListDocumentForHomeRequest) GetLimit() int64 { return 0 } +// 首页文档查询返回项 type ListDocumentForHomeItem struct { CategoryId int64 `protobuf:"varint,1,opt,name=category_id,json=categoryId,proto3" json:"category_id,omitempty"` CategoryCover string `protobuf:"bytes,2,opt,name=category_cover,json=categoryCover,proto3" json:"category_cover,omitempty"` @@ -925,6 +936,7 @@ func (m *ListDocumentForHomeItem) GetDocument() []*Document { return nil } +// 查询文档(针对首页的查询) type ListDocumentForHomeResponse struct { Document []*ListDocumentForHomeItem `protobuf:"bytes,1,rep,name=document,proto3" json:"document,omitempty"` } @@ -1053,6 +1065,7 @@ func (m *SearchDocumentRequest) GetExt() string { return "" } +// 文档评分 type DocumentScore 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"` diff --git a/api/v1/document.proto b/api/v1/document.proto index 3b59fd2..65ad8c8 100644 --- a/api/v1/document.proto +++ b/api/v1/document.proto @@ -14,87 +14,103 @@ option go_package = "moredoc/api/v1;v1"; option java_multiple_files = true; option java_package = "api.v1"; +// 文档 message Document { - int64 id = 1; - string title = 2; - string keywords = 3; - string description = 4; - int64 user_id = 5; - string cover = 6; - int32 width = 7; - int32 height = 8; - int32 preview = 9; - int32 pages = 10; - string uuid = 11; - int32 download_count = 12; - int32 view_count = 13; - int32 favorite_count = 14; - int32 comment_count = 15; - int32 score = 16; - int32 score_count = 17; - int32 price = 18; - int64 size = 19; - int32 status = 20; - google.protobuf.Timestamp created_at = 21 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp updated_at = 22 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp deleted_at = 23 [ (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp recommend_at = 29 [ (gogoproto.stdtime) = true ]; - int64 deleted_user_id = 24; - string username = 25; - repeated int64 category_id = 26; - string deleted_username = 27; - string ext = 28; - Attachment attachment = 30; - User user = 31; - bool enable_gzip = 32; - string convert_error = 33; + int64 id = 1; // 文档ID + string title = 2; // 文档标题 + string keywords = 3; // 文档关键字 + string description = 4; // 文档描述 + int64 user_id = 5; // 文档作者 + string cover = 6; // 文档封面 + int32 width = 7; // 文档宽度 + int32 height = 8; // 文档高度 + int32 preview = 9; // 文档可预览页数,0表示不限制 + int32 pages = 10; // 文档页数 + string uuid = 11; // 文档UUID + int32 download_count = 12; // 文档下载次数 + int32 view_count = 13; // 文档浏览次数 + int32 favorite_count = 14; // 文档收藏次数 + int32 comment_count = 15; // 文档评论次数 + int32 score = 16; // 文档评分 + int32 score_count = 17; // 文档评分次数 + int32 price = 18; // 文档价格 + int64 size = 19; // 文档大小 + int32 status = 20; // 文档状态,见 web/utils/enum.js + google.protobuf.Timestamp created_at = 21 + [ (gogoproto.stdtime) = true ]; // 文档创建时间 + google.protobuf.Timestamp updated_at = 22 + [ (gogoproto.stdtime) = true ]; // 文档更新时间 + google.protobuf.Timestamp deleted_at = 23 + [ (gogoproto.stdtime) = true ]; // 文档删除时间 + google.protobuf.Timestamp recommend_at = 29 + [ (gogoproto.stdtime) = true ]; // 文档推荐时间 + int64 deleted_user_id = 24; // 删除文档的用户 + string username = 25; // 文档作者用户名 + repeated int64 category_id = 26; // 文档分类ID + string deleted_username = 27; // 删除文档的用户名 + string ext = 28; // 文档扩展名 + Attachment attachment = 30; // 文档附件 + User user = 31; // 文档作者 + bool enable_gzip = 32; // 是否启用gzip压缩 + string convert_error = 33; // 转换错误信息 } +// 删除文档,放入回收站 message DeleteDocumentRequest { repeated int64 id = 1; } + +// 恢复文档 message RecoverRecycleDocumentRequest { repeated int64 id = 1; } +// 查询文档 message GetDocumentRequest { - int64 id = 1; - bool with_author = 2; + int64 id = 1; // 文档ID + bool with_author = 2; // 是否查询作者信息 } +// 文档列表 message ListDocumentRequest { - int64 page = 1; - int64 size = 2; - string wd = 3; - repeated string field = 4; - string order = 5; - repeated int64 category_id = 6; - repeated int64 user_id = 7; - repeated int32 status = 8; - repeated bool is_recommend = 9; - int64 limit = 10; + int64 page = 1; // 页码 + int64 size = 2; // 每页数量 + string wd = 3; // 搜索关键字 + repeated string field = 4; // 查询字段 + string order = 5; // 排序 + repeated int64 category_id = 6; // 分类ID + repeated int64 user_id = 7; // 用户ID + repeated int32 status = 8; // 文档状态 + repeated bool is_recommend = 9; // 是否推荐 + int64 limit = 10; // 查询数量显示。当该值大于0时,page和size无效 } +// 文档列表 message ListDocumentReply { - int64 total = 1; - repeated Document document = 2; + int64 total = 1; // 文档总数 + repeated Document document = 2; // 文档列表 } +// 创建文档 message CreateDocumentItem { - string title = 1; - int64 attachment_id = 2; - int32 price = 3; + string title = 1; // 文档标题 + int64 attachment_id = 2; // 文档附件ID + int32 price = 3; // 文档价格 } +// 创建文档 message CreateDocumentRequest { - bool overwrite = 1; - repeated int64 category_id = 2; - repeated CreateDocumentItem document = 3; + bool overwrite = 1; // 是否覆盖。暂时用不到 + repeated int64 category_id = 2; // 文档分类ID + repeated CreateDocumentItem document = 3; // 文档列表 } +// 设置文档推荐 message SetDocumentRecommendRequest { - repeated int64 id = 1; - int32 type = 2; // 0, 取消推荐,1:推荐 2:重新推荐 + repeated int64 id = 1; // 文档ID + int32 type = 2; // 0, 取消推荐,1:推荐 2:重新推荐 } +// 查询文档(针对首页的查询) message ListDocumentForHomeRequest { int64 limit = 1; } +// 首页文档查询返回项 message ListDocumentForHomeItem { int64 category_id = 1; string category_cover = 2; @@ -102,6 +118,7 @@ message ListDocumentForHomeItem { repeated Document document = 4; } +// 查询文档(针对首页的查询) message ListDocumentForHomeResponse { repeated ListDocumentForHomeItem document = 1; } @@ -115,11 +132,12 @@ message SearchDocumentRequest { string ext = 7; // 类型 } +// 文档评分 message DocumentScore { int64 id = 1; int64 document_id = 2; int64 user_id = 3; - int32 score = 4; + int32 score = 4; // 评分 google.protobuf.Timestamp created_at = 5 [ (gogoproto.stdtime) = true ]; google.protobuf.Timestamp updated_at = 6 [ (gogoproto.stdtime) = true ]; } diff --git a/docs/api/category.md b/docs/api/category.md index 410877a..b36e5ca 100644 --- a/docs/api/category.md +++ b/docs/api/category.md @@ -26,20 +26,20 @@ ### Category - +文档分类 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int32](#int32) | | | -| parent_id | [int32](#int32) | | | -| title | [string](#string) | | | -| doc_count | [int32](#int32) | | | -| sort | [int32](#int32) | | | -| enable | [bool](#bool) | | | +| 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) | | | +| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 创建时间 | +| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | 更新时间 | @@ -49,7 +49,7 @@ ### DeleteCategoryRequest - +删除分类请求 | Field | Type | Label | Description | @@ -64,7 +64,7 @@ ### GetCategoryRequest - +获取分类请求 | Field | Type | Label | Description | @@ -79,13 +79,13 @@ ### ListCategoryReply - +分类列表响应 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| total | [int64](#int64) | | | -| category | [Category](#api-v1-Category) | repeated | | +| total | [int64](#int64) | | 总数 | +| category | [Category](#api-v1-Category) | repeated | 分类列表 | @@ -95,17 +95,17 @@ ### ListCategoryRequest - +分类列表请求 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| page | [int64](#int64) | | | -| size | [int64](#int64) | | | -| parent_id | [int64](#int64) | repeated | | -| wd | [string](#string) | | | -| enable | [bool](#bool) | repeated | | -| field | [string](#string) | repeated | | +| page | [int64](#int64) | | 页码 | +| size | [int64](#int64) | | 每页数量 | +| parent_id | [int64](#int64) | repeated | 父分类ID | +| wd | [string](#string) | | 搜索关键字 | +| enable | [bool](#bool) | repeated | 是否启用 | +| field | [string](#string) | repeated | 查询字段 | @@ -121,15 +121,15 @@ ### 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) | | +| 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) | 分类列表 | diff --git a/docs/api/comment.md b/docs/api/comment.md index 92de454..76d9a04 100644 --- a/docs/api/comment.md +++ b/docs/api/comment.md @@ -28,13 +28,13 @@ ### CheckCommentRequest - +审核评论,修改评论状态 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | repeated | | -| status | [int32](#int32) | | | +| id | [int64](#int64) | repeated | 评论ID | +| status | [int32](#int32) | | 状态,见 web/utils/enum.js 枚举 | @@ -44,22 +44,22 @@ ### Comment - +评论 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| id | [int64](#int64) | | | -| parent_id | [int64](#int64) | | | -| content | [string](#string) | | | -| document_id | [int64](#int64) | | | -| status | [int32](#int32) | | | -| comment_count | [int32](#int32) | | | -| user_id | [int64](#int64) | | | -| user | [User](#api-v1-User) | | | -| document_title | [string](#string) | | | +| 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) | | 文档标题 | @@ -69,16 +69,16 @@ ### CreateCommentRequest - +创建评论请求 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| document_id | [int64](#int64) | | | -| parent_id | [int64](#int64) | | | -| content | [string](#string) | | | -| captcha_id | [string](#string) | | | -| captcha | [string](#string) | | | +| document_id | [int64](#int64) | | 文档ID | +| parent_id | [int64](#int64) | | 父评论ID | +| content | [string](#string) | | 评论内容 | +| captcha_id | [string](#string) | | 验证码ID | +| captcha | [string](#string) | | 验证码 | @@ -88,7 +88,7 @@ ### DeleteCommentRequest - +删除评论请求 | Field | Type | Label | Description | @@ -103,7 +103,7 @@ ### GetCommentRequest - +获取评论请求 | Field | Type | Label | Description | @@ -118,13 +118,13 @@ ### ListCommentReply - +获取评论列表响应 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| total | [int64](#int64) | | | -| comment | [Comment](#api-v1-Comment) | repeated | | +| total | [int64](#int64) | | 总数 | +| comment | [Comment](#api-v1-Comment) | repeated | 评论列表 | @@ -134,21 +134,21 @@ ### 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 | | -| document_id | [int64](#int64) | | | -| user_id | [int64](#int64) | | | -| parent_id | [int64](#int64) | repeated | | -| with_document_title | [bool](#bool) | | | +| 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) | | 是否返回文档标题 | @@ -164,11 +164,11 @@ ### CommentAPI - +评论服务 | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| CreateComment | [CreateCommentRequest](#api-v1-CreateCommentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | | +| 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) | 获取单个评论 | diff --git a/docs/api/config.md b/docs/api/config.md index 43f2f01..6c4c2b1 100644 --- a/docs/api/config.md +++ b/docs/api/config.md @@ -32,22 +32,24 @@ ### Config - +配置 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| label | [string](#string) | | | -| name | [string](#string) | | | -| value | [string](#string) | | | -| placeholder | [string](#string) | | | -| input_type | [string](#string) | | | -| category | [string](#string) | | | -| sort | [int32](#int32) | | | -| options | [string](#string) | | | -| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| 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) | | element-ui 的 el-input 的 type 属性 + +配置分类,如: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) | | 更新时间 | @@ -62,10 +64,10 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| length | [int32](#int32) | | | -| width | [int32](#int32) | | | -| height | [int32](#int32) | | | -| type | [string](#string) | | | +| length | [int32](#int32) | | 验证码长度 | +| width | [int32](#int32) | | 验证码宽度 | +| height | [int32](#int32) | | 验证码高度 | +| type | [string](#string) | | 验证码类型,见 web/utils/enum.js | @@ -75,16 +77,16 @@ ### ConfigFooter -底链配置项 +底链配置项,为跳转的链接地址 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| about | [string](#string) | | | -| contact | [string](#string) | | | -| agreement | [string](#string) | | | -| copyright | [string](#string) | | | -| feedback | [string](#string) | | | +| about | [string](#string) | | 关于我们 | +| contact | [string](#string) | | 联系我们 | +| agreement | [string](#string) | | 用户协议、文库协议 | +| copyright | [string](#string) | | 版权声明 | +| feedback | [string](#string) | | 意见和建议反馈 | @@ -99,16 +101,16 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| is_close | [bool](#bool) | | | -| close_statement | [string](#string) | | | -| 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 | | +| 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) | | 是否登录才能访问 | @@ -124,19 +126,19 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| domain | [string](#string) | | | -| title | [string](#string) | | | -| keywords | [string](#string) | | | -| description | [string](#string) | | | -| logo | [string](#string) | | | -| favicon | [string](#string) | | | -| icp | [string](#string) | | | -| analytics | [string](#string) | | | -| sitename | [string](#string) | | | -| copyright_start_year | [string](#string) | | | -| register_background | [string](#string) | | | -| login_background | [string](#string) | | | -| recommend_words | [string](#string) | repeated | | +| 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) | | 程序版本号 | @@ -147,7 +149,7 @@ ### Configs - +配置列表 | Field | Type | Label | Description | @@ -162,7 +164,7 @@ ### EnvDependent - +依赖项 | Field | Type | Label | Description | @@ -183,7 +185,7 @@ ### Envs - +依赖项列表 | Field | Type | Label | Description | @@ -198,7 +200,7 @@ ### ListConfigRequest - +查询配置项请求 | Field | Type | Label | Description | @@ -213,14 +215,14 @@ ### Settings - +系统配置 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| system | [ConfigSystem](#api-v1-ConfigSystem) | | | -| footer | [ConfigFooter](#api-v1-ConfigFooter) | | | -| security | [ConfigSecurity](#api-v1-ConfigSecurity) | | ConfigCaptcha captcha = 4; | +| system | [ConfigSystem](#api-v1-ConfigSystem) | | 系统配置 | +| footer | [ConfigFooter](#api-v1-ConfigFooter) | | 底链配置 | +| security | [ConfigSecurity](#api-v1-ConfigSecurity) | | 安全配置 | @@ -230,23 +232,23 @@ ### 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) | | | -| friendlink_count | [int64](#int64) | | | -| os | [string](#string) | | | -| version | [string](#string) | | | -| hash | [string](#string) | | | -| build_at | [string](#string) | | | -| report_count | [int64](#int64) | | | +| 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) | | 举报数量 | @@ -262,7 +264,7 @@ ### ConfigAPI - +配置服务 | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| diff --git a/docs/api/document.md b/docs/api/document.md index d637100..3b4fcb3 100644 --- a/docs/api/document.md +++ b/docs/api/document.md @@ -38,14 +38,14 @@ ### CreateDocumentItem - +创建文档 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | | -| attachment_id | [int64](#int64) | | | -| price | [int32](#int32) | | | +| title | [string](#string) | | 文档标题 | +| attachment_id | [int64](#int64) | | 文档附件ID | +| price | [int32](#int32) | | 文档价格 | @@ -55,14 +55,14 @@ ### CreateDocumentRequest - +创建文档 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| overwrite | [bool](#bool) | | | -| category_id | [int64](#int64) | repeated | | -| document | [CreateDocumentItem](#api-v1-CreateDocumentItem) | repeated | | +| overwrite | [bool](#bool) | | 是否覆盖。暂时用不到 | +| category_id | [int64](#int64) | repeated | 文档分类ID | +| document | [CreateDocumentItem](#api-v1-CreateDocumentItem) | repeated | 文档列表 | @@ -72,7 +72,7 @@ ### DeleteDocumentRequest - +删除文档,放入回收站 | Field | Type | Label | Description | @@ -87,44 +87,44 @@ ### Document - +文档 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| 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) | | | -| pages | [int32](#int32) | | | -| uuid | [string](#string) | | | -| 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) | | | -| 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 | | -| deleted_username | [string](#string) | | | -| ext | [string](#string) | | | -| attachment | [Attachment](#api-v1-Attachment) | | | -| user | [User](#api-v1-User) | | | -| enable_gzip | [bool](#bool) | | | -| convert_error | [string](#string) | | | +| 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) | | 转换错误信息 | @@ -134,7 +134,7 @@ ### DocumentScore - +文档评分 | Field | Type | Label | Description | @@ -142,7 +142,7 @@ | id | [int64](#int64) | | | | document_id | [int64](#int64) | | | | user_id | [int64](#int64) | | | -| score | [int32](#int32) | | | +| score | [int32](#int32) | | 评分 | | created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | @@ -169,13 +169,13 @@ ### GetDocumentRequest - +查询文档 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | | | -| with_author | [bool](#bool) | | | +| id | [int64](#int64) | | 文档ID | +| with_author | [bool](#bool) | | 是否查询作者信息 | @@ -185,7 +185,7 @@ ### ListDocumentForHomeItem - +首页文档查询返回项 | Field | Type | Label | Description | @@ -203,7 +203,7 @@ ### ListDocumentForHomeRequest - +查询文档(针对首页的查询) | Field | Type | Label | Description | @@ -218,7 +218,7 @@ ### ListDocumentForHomeResponse - +查询文档(针对首页的查询) | Field | Type | Label | Description | @@ -233,13 +233,13 @@ ### ListDocumentReply - +文档列表 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| total | [int64](#int64) | | | -| document | [Document](#api-v1-Document) | repeated | | +| total | [int64](#int64) | | 文档总数 | +| document | [Document](#api-v1-Document) | repeated | 文档列表 | @@ -249,21 +249,21 @@ ### 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 | | -| user_id | [int64](#int64) | repeated | | -| status | [int32](#int32) | repeated | | -| is_recommend | [bool](#bool) | repeated | | -| limit | [int64](#int64) | | | +| 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无效 | @@ -273,7 +273,7 @@ ### RecoverRecycleDocumentRequest - +恢复文档 | Field | Type | Label | Description | @@ -325,12 +325,12 @@ ### SetDocumentRecommendRequest - +设置文档推荐 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [int64](#int64) | repeated | | +| id | [int64](#int64) | repeated | 文档ID | | type | [int32](#int32) | | 0, 取消推荐,1:推荐 2:重新推荐 |