Initial commit

This commit is contained in:
2025-11-18 03:36:49 +08:00
commit d17c7efb3c
7078 changed files with 831480 additions and 0 deletions

View File

@@ -0,0 +1,270 @@
# PostService
> 文章管理服务
---
## countPosts
> 计算文章数量
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/PostService/countPosts`
- RPC`rpc countPosts(CountPostsRequest) returns (RPCCountResponse);`
**请求对象 (`CountPostsRequest`)**
```json
{
"postCategoryId": "int64 // 分类ID",
"productCode": "string // 产品代号",
"publishedOnly": "bool // 只列出已发布的"
}
```
**响应对象 (`RPCCountResponse`)**
```json
{
"count": "int64 // 数量"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/PostService/countPosts" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## createPost
> 创建文章
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/PostService/createPost`
- RPC`rpc createPost(CreatePostRequest) returns (CreatePostResponse);`
**请求对象 (`CreatePostRequest`)**
```json
{
"postCategoryId": "int64 // 文章分类ID",
"type": "string // 类型normal, url",
"productCode": "string // 产品代号",
"subject": "string // 标题",
"url": "string // 跳转的URLtype=url",
"body": "string // 文章内容type=normal"
}
```
**响应对象 (`CreatePostResponse`)**
```json
{
"postId": "int64 // 文章ID"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/PostService/createPost" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## deletePost
> 删除文章
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/PostService/deletePost`
- RPC`rpc deletePost(DeletePostRequest) returns (RPCSuccess);`
**请求对象 (`DeletePostRequest`)**
```json
{
"postId": "int64 // 文章ID"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/PostService/deletePost" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## findPost
> 查询单篇文章
- 角色:`admin`, `user`
- HTTP`POST https://backend.dooki.cloud/PostService/findPost`
- RPC`rpc findPost(FindPostRequest) returns (FindPostResponse);`
**请求对象 (`FindPostRequest`)**
```json
{
"postId": "int64 // 文章ID"
}
```
**响应对象 (`FindPostResponse`)**
```json
{
"post": "Post // 文章信息"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/PostService/findPost" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## listPosts
> 列出单页文章
- 角色:`admin`, `user`
- HTTP`POST https://backend.dooki.cloud/PostService/listPosts`
- RPC`rpc listPosts(ListPostsRequest) returns (ListPostsResponse);`
**请求对象 (`ListPostsRequest`)**
```json
{
"offset": "int64 // 读取位置",
"size": "int64 // 数量通常不能小于0",
"productCode": "string // 产品代号",
"postCategoryId": "int64 // 分类ID",
"postCategoryCode": "string // 分类代号",
"excludingPostCategoryCode": "string // 排除的分类代号",
"publishedOnly": "bool // 只列出已发布的",
"containsBody": "bool // 是否包含文章内容"
}
```
**响应对象 (`ListPostsResponse`)**
```json
{
"posts": "[]Post // 文章列表"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/PostService/listPosts" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## publishPost
> 发布文章
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/PostService/publishPost`
- RPC`rpc publishPost(PublishPostRequest) returns (RPCSuccess);`
**请求对象 (`PublishPostRequest`)**
```json
{
"postId": "int64 // 文章ID"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/PostService/publishPost" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## updatePost
> 修改文章
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/PostService/updatePost`
- RPC`rpc updatePost(UpdatePostRequest) returns (RPCSuccess);`
**请求对象 (`UpdatePostRequest`)**
```json
{
"postId": "int64 // 文章ID",
"postCategoryId": "int64 // 文章分类ID",
"productCode": "string // 产品代号",
"subject": "string // 标题",
"type": "string // 类型normal, url",
"url": "string // 跳转的URLtype=url",
"body": "string // 文章内容type=normal"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/PostService/updatePost" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---