This commit is contained in:
2025-03-29 17:38:05 +08:00
parent 7d46f7178d
commit d94b2744c0
21 changed files with 4337 additions and 137 deletions

34
proto/blocks.proto Normal file
View File

@@ -0,0 +1,34 @@
syntax = "proto3";
package content;
option go_package = "./;content";
message FetchRequest {
int64 page_no=1; // 页数
int64 page_size=2; // 每页记录数
map<string,string> params=3; // 条件参数,key=val,eg key:category_id=?,vlaue=11
}
message IdentRequest{
int64 id = 1; // 唯一ID
string identity = 2; // 唯一码
}
message VersionRequest {
int64 version=1; // 时序版本号
}
message SearchRequest {
string keyword=1; //关键词
}
message StatusReply{
int64 status = 1; // 状态码
string identity=2; // 标识码
string message=3; //状态说明
int64 timeseq=4; // 响应时间序列
}
message Empty{
}

59
proto/category.proto Normal file
View File

@@ -0,0 +1,59 @@
syntax = "proto3";
package content;
option go_package = "./;content";
import "blocks.proto";
// 系统分类
service Category {
//分类列表
rpc CategoryList (Empty) returns (CategoryListReply) {};
rpc AddCategory (AddCategoryRequest) returns (AddCategoryResponse) {};
rpc ModifyCategory (ModifyCategoryRequest) returns (Empty) {};
rpc DeleteCategory (DeleteCategoryRequest) returns (Empty) {};
}
// 无限极分类
message CategoryItem{
string identity = 1;
string parent_identity = 2; // 为空表示顶级分类
string title = 3;
string cover_path = 4;
string intro=5;
string created_at = 6;
string updated_at = 7;
repeated CategoryItem data = 8;
}
message CategoryListReply {
repeated CategoryItem data = 1;
int64 count = 2;
}
message AddCategoryResponse{
string identity = 1; // 新增数据的唯一码
}
message AddCategoryRequest{
string identity = 1; //
string parent_identity = 2; // 为空表示顶级分类
string title = 3;
string cover_path = 4;
string intro=5;
string created_at = 6;
string updated_at = 7;
repeated CategoryItem data = 8;
}
message ModifyCategoryRequest{
string identity = 1; //
string parent_identity = 2; // 为空表示顶级分类
string title = 3;
string cover_path = 4;
string intro=5;
string created_at = 6;
string updated_at = 7;
repeated CategoryItem data = 8;
}
message DeleteCategoryRequest{
string identity = 1; //
}

133
proto/post.proto Normal file
View File

@@ -0,0 +1,133 @@
syntax = "proto3";
package content;
option go_package = "./;content";
import "blocks.proto";
// 正文
service Post{
//文章列表
rpc PostList(PostListRequest) returns (PostListReply) {};
//获取文章详情
rpc GetPost (GetPostRequest) returns (PostItem) {};
//发布文章
rpc AddPost(PostItem) returns (StatusReply) {};
//修改文章
rpc ModifyPost(PostItem) returns (StatusReply) {};
//删除文章
rpc DeletePost(IdentRequest) returns (StatusReply) {};
// 文章点赞处理
rpc IncrPostLike(PostOpIdentityRequest) returns (StatusReply) {};
rpc DescPostLike(PostOpIdentityRequest) returns (StatusReply) {};
// 文章点踩处理
rpc IncrPostUnlike(PostOpIdentityRequest) returns (StatusReply) {};
rpc DescPostUnlike(PostOpIdentityRequest) returns (StatusReply) {};
//评论列表
rpc CommentList(CommentListRequest) returns (CommentListResponse) {};
//发布评论
rpc AddComment(CommentItem) returns (StatusReply) {};
//修改评论
rpc ModifyComment(CommentItem) returns (StatusReply) {};
//删除评论
rpc DeleteComment(DeleteCommentRequest) returns (StatusReply) {};
// 评论点赞处理
rpc IncrCommentLike(CommentOpIdentityRequest) returns (StatusReply) {};
rpc DescCommentLike(CommentOpIdentityRequest) returns (StatusReply) {};
// 评论点踩处理
rpc IncrCommentUnlike(CommentOpIdentityRequest) returns (StatusReply) {};
rpc DescCommentUnlike(CommentOpIdentityRequest) returns (StatusReply) {};
}
message DeleteCommentRequest{
string identity = 1; // 需要删除的评论的唯一标识
string post_identity = 2; // 文章唯一标识
}
message PostItem{
string identity = 1; // 文章唯一标识
int64 passport_id =2; // 作者ID
string passport_identity =3; // 作者唯一标识
repeated string category_identity_list = 4; //所属分类Identity 列表
repeated string tags_identity_list = 5; // 标签集
string title = 6;
string cover_path = 7; //封面
string author = 8;
string content = 9;
string target_url = 10;// 跳转目标地址
string source_url = 11; // 文章来源地址
int64 hits = 12; //点击量
repeated string accessory = 13; //附件列表
bool has_accessory = 14;//是否有附件,默认没有
string created_at=15;
string updated_at=16;
string description = 17;//简介
int64 like_hits = 18; //点赞量
int64 unlike_hits = 19; //点踩量
int64 comment_hits = 20; //评论量
int32 type = 22;// 用户自定义文章类型
string rights=23; //权限
}
message PostListRequest{
int64 page = 1; // 页码,默认第一页
int64 size = 2; // 单页显示数量,默认10,最多50
string author_identity = 3; //发布者唯一标识,可选
string category_identity = 4; // 文章类型,可选
string keyword = 5;// 根据文章名称模糊查找
int32 type = 6;// 根据用户自定义文章类型过滤,可选,默认0,全部查找
}
message PostListReply{
repeated PostItem data = 1;
int64 count = 2;
}
message GetPostRequest {
string identity = 1; // 必传
string author_identity = 2; // 必传
}
message CommentItem {
string identity = 1;
string Post_identity = 2;
string parent_identity = 3;
string content = 4;
string reply_identity = 5;// 回复者唯一 标识
string created_at = 6;
string updated_at = 7;
repeated CommentItem list = 8;//回复列表
int64 like_hits = 9; //点赞量
int64 unlike_hits = 10; //点踩量
int64 comment_hits = 11; //评论量
}
message CommentListRequest{
string Post_identity = 1;//必填
int64 page = 2; // 页码,默认第一页
int64 size = 3; // 单页显示数量,默认10,最多50
}
message CommentListResponse{
repeated CommentItem list =1;
int64 count = 2;
}
message PostOpIdentityRequest{
string post_identity = 1; //必传
string op_identity = 2; // 必传
}
message CommentOpIdentityRequest{
string comment_identity = 1; //必填
string op_identity = 2;//必填
}

34
proto/tags.proto Normal file
View File

@@ -0,0 +1,34 @@
syntax = "proto3";
package content;
option go_package = "./;content";
import "blocks.proto";
// 标签
service Tags {
//标签列表
rpc TagsList (IdentRequest) returns (TagsListReply) {};
//创建标签
rpc AddTags(TagsItem) returns (StatusReply) {};
//修改标签
rpc ModifyTags(TagsItem) returns (StatusReply) {};
//删除标签
rpc DeleteTags(IdentRequest) returns (StatusReply) {};
}
// 无限极标签
message TagsItem{
string identity = 1;
string parent_identity = 2; // 为空表示顶级主题
string title = 3;
string cover_path = 4;
string intro=5;
repeated TagsItem list = 9;
}
message TagsListReply {
repeated TagsItem list = 1;
int64 count = 2;
}