增加用户系统门户页、文章相关管理

This commit is contained in:
刘祥超
2024-01-09 10:20:29 +08:00
parent ea991f5a97
commit 6a671f67bc
16 changed files with 3481 additions and 3 deletions
+22
View File
@@ -0,0 +1,22 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_post_category.proto";
// 文章
message Post {
int64 id = 1; // ID
int64 postCategoryId = 2; // 分类ID
string productCode = 3; // 产品代号
string type = 4; // 类型:normal, url
string subject = 5; // 标题
string url = 6; // URL
string body = 7; // 内容
int64 createdAt = 8; // 创建时间
bool isPublished = 9; // 是否已发布
int64 publishedAt = 10; // 发布时间
PostCategory postCategory = 30; // 分类信息
}
@@ -0,0 +1,12 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
// 文章分类
message PostCategory {
int64 id = 1; // ID
string name = 2; // 名称
string code = 3; // 文章代号
bool isOn = 4; // 是否启用
}
+99
View File
@@ -0,0 +1,99 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_post.proto";
import "models/rpc_messages.proto";
// 文章管理服务
service PostService {
// 创建文章
rpc createPost(CreatePostRequest) returns (CreatePostResponse);
// 修改文章
rpc updatePost(UpdatePostRequest) returns (RPCSuccess);
// 删除文章
rpc deletePost(DeletePostRequest) returns (RPCSuccess);
// 发布文章
rpc publishPost(PublishPostRequest) returns (RPCSuccess);
// 计算文章数量
rpc countPosts(CountPostsRequest) returns (RPCCountResponse);
// 列出单页文章
rpc listPosts(ListPostsRequest) returns (ListPostsResponse);
// 查询单篇文章
rpc findPost(FindPostRequest) returns (FindPostResponse);
}
// 创建文章
message CreatePostRequest {
int64 postCategoryId = 1; // 文章分类ID
string type = 2; // 类型:normal, url
string productCode = 3; // 产品代号
string subject = 4; // 标题
string url = 5; // 跳转的URLtype=url
string body = 6; // 文章内容(type=normal
}
message CreatePostResponse {
int64 postId = 1; // 文章ID
}
// 修改文章
message UpdatePostRequest {
int64 postId = 1; // 文章ID
int64 postCategoryId = 2; // 文章分类ID
string productCode = 3; // 产品代号
string subject = 4; // 标题
string type = 5; // 类型:normal, url
string url = 6; // 跳转的URLtype=url
string body = 7; // 文章内容(type=normal
}
// 删除文章
message DeletePostRequest {
int64 postId = 1; // 文章ID
}
// 发布文章
message PublishPostRequest {
int64 postId = 1; // 文章ID
}
// 计算文章数量
message CountPostsRequest {
int64 postCategoryId = 1; // 分类ID
string productCode = 2; // 产品代号
bool publishedOnly = 3; // 只列出已发布的
}
// 列出单页文章
message ListPostsRequest {
int64 offset = 1;
int64 size = 2;
string productCode = 3; // 产品代号
int64 postCategoryId = 4; // 分类ID
string postCategoryCode = 5; // 分类代号
string excludingPostCategoryCode = 6; // 排除的分类代号
bool publishedOnly = 7; // 只列出已发布的
bool containsBody = 8; // 是否包含文章内容
}
message ListPostsResponse {
repeated Post posts = 1; // 文章列表
}
// 查询单篇文章
message FindPostRequest {
int64 postId = 1; // 文章ID
}
message FindPostResponse {
Post post = 1; // 文章信息
}
@@ -0,0 +1,86 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_post_category.proto";
import "models/rpc_messages.proto";
// 文章分类管理服务
service PostCategoryService {
// 创建分类
rpc createPostCategory(CreatePostCategoryRequest) returns (CreatePostCategoryResponse);
// 修改分类
rpc updatePostCategory(UpdatePostCategoryRequest) returns (RPCSuccess);
// 删除分类
rpc deletePostCategory(DeletePostCategoryRequest) returns (RPCSuccess);
// 列出所有分类
rpc findAllPostCategories(FindAllPostCategoriesRequest) returns (FindAllPostCategoriesResponse);
// 列出所有可用分类
rpc findAllAvailablePostCategories(FindAllAvailablePostCategoriesRequest) returns (FindAllAvailablePostCategoriesResponse);
// 查询单个分类
rpc findPostCategory(FindPostCategoryRequest) returns (FindPostCategoryResponse);
// 对分类进行排序
rpc sortPostCategories(SortPostCategoriesRequest) returns (RPCSuccess);
}
// 创建分类
message CreatePostCategoryRequest {
string name = 1; // 分类名称
string code = 2; // 分类代号
}
message CreatePostCategoryResponse {
int64 postCategoryId = 1; // 分类ID
}
// 修改分类
message UpdatePostCategoryRequest {
int64 postCategoryId = 1; // 分类ID
string name = 2; // 分类名称
string code = 3; // 分类代号
bool isOn = 4; // 是否启用
}
// 删除分类
message DeletePostCategoryRequest {
int64 postCategoryId = 1; // 分类ID
}
// 列出所有分类
message FindAllPostCategoriesRequest {
}
message FindAllPostCategoriesResponse {
repeated PostCategory postCategories = 1; // 分类列表
}
// 列出所有可用分类
message FindAllAvailablePostCategoriesRequest {
}
message FindAllAvailablePostCategoriesResponse {
repeated PostCategory postCategories = 1; // 分类列表
}
// 查询单个分类
message FindPostCategoryRequest {
int64 postCategoryId = 1; // 分类ID
}
message FindPostCategoryResponse {
PostCategory postCategory = 1; // 分类信息
}
// 对分类进行排序
message SortPostCategoriesRequest {
repeated int64 postCategoryIds = 1; // 分类ID列表
}