feat: 添加获取小红书首页 Feeds 列表的 HTTP 和 MCP 接口
- 在 service.go 中添加 ListFeeds 业务逻辑,复用 xiaohongshu 包功能 - 添加 HTTP 接口 GET /api/v1/feeds/list - 添加 MCP tool: list_feeds,支持通过 MCP 协议获取 Feeds - 返回结构化的 Feeds 数据,包含列表和数量统计 - 更新 .gitignore 忽略构建产物和测试脚本 - 更新项目配置,添加 chmod 权限 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
14
handlers.go
14
handlers.go
@@ -90,6 +90,20 @@ func publishHandler(c *gin.Context) {
|
||||
respondSuccess(c, result, "发布成功")
|
||||
}
|
||||
|
||||
// listFeedsHandler 获取Feeds列表
|
||||
func listFeedsHandler(c *gin.Context) {
|
||||
// 获取 Feeds 列表
|
||||
result, err := xiaohongshuService.ListFeeds(c.Request.Context())
|
||||
if err != nil {
|
||||
respondError(c, http.StatusInternalServerError, "LIST_FEEDS_FAILED",
|
||||
"获取Feeds列表失败", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
c.Set("account", "ai-report")
|
||||
respondSuccess(c, result, "获取Feeds列表成功")
|
||||
}
|
||||
|
||||
// healthHandler 健康检查
|
||||
func healthHandler(c *gin.Context) {
|
||||
respondSuccess(c, map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user