640 lines
19 KiB
Go
640 lines
19 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.10.1
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
ai "sundynix-micro-go/app/plant/api/internal/handler/ai"
|
|
banner "sundynix-micro-go/app/plant/api/internal/handler/banner"
|
|
callback "sundynix-micro-go/app/plant/api/internal/handler/callback"
|
|
complete "sundynix-micro-go/app/plant/api/internal/handler/complete"
|
|
config "sundynix-micro-go/app/plant/api/internal/handler/config"
|
|
exchange "sundynix-micro-go/app/plant/api/internal/handler/exchange"
|
|
legacy "sundynix-micro-go/app/plant/api/internal/handler/legacy"
|
|
myPlant "sundynix-micro-go/app/plant/api/internal/handler/myPlant"
|
|
ocr "sundynix-micro-go/app/plant/api/internal/handler/ocr"
|
|
post "sundynix-micro-go/app/plant/api/internal/handler/post"
|
|
topic "sundynix-micro-go/app/plant/api/internal/handler/topic"
|
|
userProfile "sundynix-micro-go/app/plant/api/internal/handler/userProfile"
|
|
wiki "sundynix-micro-go/app/plant/api/internal/handler/wiki"
|
|
"sundynix-micro-go/app/plant/api/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// AI问答
|
|
Method: http.MethodPost,
|
|
Path: "/ai/chat",
|
|
Handler: ai.AiChatHandler(serverCtx),
|
|
},
|
|
{
|
|
// 聊天历史
|
|
Method: http.MethodGet,
|
|
Path: "/ai/history",
|
|
Handler: ai.GetAiChatHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
// 清空聊天历史
|
|
Method: http.MethodPost,
|
|
Path: "/ai/history/clear",
|
|
Handler: ai.ClearAiChatHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除聊天历史
|
|
Method: http.MethodPost,
|
|
Path: "/ai/history/delete",
|
|
Handler: ai.DeleteAiChatHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
// 今日AI额度
|
|
Method: http.MethodGet,
|
|
Path: "/ai/quota",
|
|
Handler: ai.GetAiChatQuotaHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 微信支付回调
|
|
Method: http.MethodPost,
|
|
Path: "/callback/wechatpay",
|
|
Handler: callback.WechatPayCallbackHandler(serverCtx),
|
|
},
|
|
{
|
|
// 微信媒体安全回调
|
|
Method: http.MethodPost,
|
|
Path: "/callback/mediaCheck",
|
|
Handler: legacy.MediaCheckCallbackHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// AI聊天历史
|
|
Method: http.MethodPost,
|
|
Path: "/ai/history",
|
|
Handler: complete.GetAiChatHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
// 徽章配置树
|
|
Method: http.MethodGet,
|
|
Path: "/config/badge/tree",
|
|
Handler: complete.GetBadgeConfigTreeHandler(serverCtx),
|
|
},
|
|
{
|
|
// 等级配置详情
|
|
Method: http.MethodGet,
|
|
Path: "/config/level/:id",
|
|
Handler: complete.GetLevelConfigDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 兑换商品详情
|
|
Method: http.MethodGet,
|
|
Path: "/exchange/item/:id",
|
|
Handler: complete.GetExchangeItemDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 完成养护任务
|
|
Method: http.MethodPost,
|
|
Path: "/my/completeTask",
|
|
Handler: complete.CompleteTaskHandler(serverCtx),
|
|
},
|
|
{
|
|
// 百科分类详情
|
|
Method: http.MethodGet,
|
|
Path: "/wiki/class/:id",
|
|
Handler: complete.GetWikiClassDetailHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 创建徽章配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/badge/create",
|
|
Handler: config.CreateBadgeConfigHandler(serverCtx),
|
|
},
|
|
{Method: http.MethodPost, Path: "/config/badge/add", Handler: config.CreateBadgeConfigHandler(serverCtx)},
|
|
{
|
|
// 删除徽章配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/badge/delete",
|
|
Handler: config.DeleteBadgeConfigHandler(serverCtx),
|
|
},
|
|
{Method: http.MethodGet, Path: "/config/badge/delete", Handler: legacy.BadgeConfigDeleteHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/config/badge/find", Handler: legacy.BadgeConfigDetailHandler(serverCtx)},
|
|
{
|
|
// 徽章配置列表
|
|
Method: http.MethodPost,
|
|
Path: "/config/badge/list",
|
|
Handler: config.GetBadgeConfigListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新徽章配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/badge/update",
|
|
Handler: config.UpdateBadgeConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建等级配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/level/create",
|
|
Handler: config.CreateLevelConfigHandler(serverCtx),
|
|
},
|
|
{Method: http.MethodPost, Path: "/config/level/add", Handler: config.CreateLevelConfigHandler(serverCtx)},
|
|
{
|
|
// 删除等级配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/level/delete",
|
|
Handler: config.DeleteLevelConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
// 等级配置列表
|
|
Method: http.MethodPost,
|
|
Path: "/config/level/list",
|
|
Handler: config.GetLevelConfigListHandler(serverCtx),
|
|
},
|
|
{Method: http.MethodGet, Path: "/config/level/list", Handler: config.GetLevelConfigListHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/config/level/detail", Handler: legacy.LevelConfigDetailHandler(serverCtx)},
|
|
{
|
|
// 更新等级配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/level/update",
|
|
Handler: config.UpdateLevelConfigHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 创建兑换商品
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/item/create",
|
|
Handler: exchange.CreateExchangeItemHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除兑换商品
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/item/delete",
|
|
Handler: exchange.DeleteExchangeItemHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新兑换商品
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/item/update",
|
|
Handler: exchange.UpdateExchangeItemHandler(serverCtx),
|
|
},
|
|
{
|
|
// 兑换商品列表
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/list",
|
|
Handler: exchange.GetExchangeItemListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 我的兑换记录
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/myOrders",
|
|
Handler: exchange.GetMyExchangeOrdersHandler(serverCtx),
|
|
},
|
|
{
|
|
// 发起兑换
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/order",
|
|
Handler: exchange.CreateExchangeOrderHandler(serverCtx),
|
|
},
|
|
{
|
|
// 管理端订单列表
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/order/list",
|
|
Handler: exchange.GetExchangeOrderListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新订单状态
|
|
Method: http.MethodPost,
|
|
Path: "/exchange/order/update",
|
|
Handler: exchange.UpdateExchangeOrderHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 植物详情
|
|
Method: http.MethodGet,
|
|
Path: "/my/:id",
|
|
Handler: myPlant.GetPlantDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 添加养护计划
|
|
Method: http.MethodPost,
|
|
Path: "/my/carePlan",
|
|
Handler: myPlant.AddCarePlanHandler(serverCtx),
|
|
},
|
|
{
|
|
// 添加养护记录
|
|
Method: http.MethodPost,
|
|
Path: "/my/careRecord",
|
|
Handler: myPlant.AddCareRecordHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建植物
|
|
Method: http.MethodPost,
|
|
Path: "/my/create",
|
|
Handler: myPlant.CreatePlantHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除植物
|
|
Method: http.MethodPost,
|
|
Path: "/my/delete",
|
|
Handler: myPlant.DeletePlantHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除养护计划
|
|
Method: http.MethodPost,
|
|
Path: "/my/deletePlan",
|
|
Handler: myPlant.DeleteCarePlanHandler(serverCtx),
|
|
},
|
|
{
|
|
// 添加成长记录
|
|
Method: http.MethodPost,
|
|
Path: "/my/growthRecord",
|
|
Handler: myPlant.AddGrowthRecordHandler(serverCtx),
|
|
},
|
|
{
|
|
// 我的植物列表
|
|
Method: http.MethodPost,
|
|
Path: "/my/list",
|
|
Handler: myPlant.GetMyPlantListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 今日养护任务
|
|
Method: http.MethodGet,
|
|
Path: "/my/todayTask",
|
|
Handler: myPlant.GetTodayTaskListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新植物
|
|
Method: http.MethodPost,
|
|
Path: "/my/update",
|
|
Handler: myPlant.UpdatePlantHandler(serverCtx),
|
|
},
|
|
{
|
|
// 快捷养护
|
|
Method: http.MethodPost,
|
|
Path: "/my/quickCare",
|
|
Handler: myPlant.QuickCareHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// OCR植物识别
|
|
Method: http.MethodPost,
|
|
Path: "/ocr/classify",
|
|
Handler: ocr.OcrClassifyHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除识别记录
|
|
Method: http.MethodPost,
|
|
Path: "/ocr/deleteLog",
|
|
Handler: ocr.DeleteClassifyLogHandler(serverCtx),
|
|
},
|
|
{
|
|
// 我的识别记录
|
|
Method: http.MethodGet,
|
|
Path: "/ocr/myLog",
|
|
Handler: ocr.GetMyClassifyLogHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 帖子详情
|
|
Method: http.MethodGet,
|
|
Path: "/post/:id",
|
|
Handler: post.GetPostDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 评论帖子
|
|
Method: http.MethodPost,
|
|
Path: "/post/comment",
|
|
Handler: post.CommentPostHandler(serverCtx),
|
|
},
|
|
{
|
|
// 发布帖子
|
|
Method: http.MethodPost,
|
|
Path: "/post/create",
|
|
Handler: post.CreatePostHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除帖子
|
|
Method: http.MethodPost,
|
|
Path: "/post/delete",
|
|
Handler: post.DeletePostHandler(serverCtx),
|
|
},
|
|
{
|
|
// 点赞帖子
|
|
Method: http.MethodPost,
|
|
Path: "/post/like",
|
|
Handler: post.LikePostHandler(serverCtx),
|
|
},
|
|
{
|
|
// 帖子列表
|
|
Method: http.MethodPost,
|
|
Path: "/post/list",
|
|
Handler: post.GetPostListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 我的帖子
|
|
Method: http.MethodPost,
|
|
Path: "/post/my",
|
|
Handler: post.GetMyPostListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 收藏帖子
|
|
Method: http.MethodPost,
|
|
Path: "/post/star",
|
|
Handler: post.StarPostHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 话题详情
|
|
Method: http.MethodGet,
|
|
Path: "/topic/:id",
|
|
Handler: topic.GetTopicDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建话题
|
|
Method: http.MethodPost,
|
|
Path: "/topic/create",
|
|
Handler: topic.CreateTopicHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除话题
|
|
Method: http.MethodPost,
|
|
Path: "/topic/delete",
|
|
Handler: topic.DeleteTopicHandler(serverCtx),
|
|
},
|
|
{
|
|
// 话题列表
|
|
Method: http.MethodGet,
|
|
Path: "/topic/list",
|
|
Handler: topic.GetTopicListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新话题
|
|
Method: http.MethodPost,
|
|
Path: "/topic/update",
|
|
Handler: topic.UpdateTopicHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 我的徽章
|
|
Method: http.MethodGet,
|
|
Path: "/profile/badge",
|
|
Handler: userProfile.GetMyBadgesHandler(serverCtx),
|
|
},
|
|
{
|
|
// 获取用户资料
|
|
Method: http.MethodGet,
|
|
Path: "/profile/info",
|
|
Handler: userProfile.GetUserProfileHandler(serverCtx),
|
|
},
|
|
{Method: http.MethodGet, Path: "/profile/detail", Handler: userProfile.GetUserProfileHandler(serverCtx)},
|
|
{
|
|
// 我的收藏
|
|
Method: http.MethodPost,
|
|
Path: "/profile/star",
|
|
Handler: userProfile.GetMyStarsHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新用户资料
|
|
Method: http.MethodPost,
|
|
Path: "/profile/update",
|
|
Handler: userProfile.UpdateUserProfileHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 百科详情
|
|
Method: http.MethodGet,
|
|
Path: "/wiki/:id",
|
|
Handler: wiki.GetWikiDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建百科分类
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/class/create",
|
|
Handler: wiki.CreateWikiClassHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除百科分类
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/class/delete",
|
|
Handler: wiki.DeleteWikiClassHandler(serverCtx),
|
|
},
|
|
{
|
|
// 百科分类列表
|
|
Method: http.MethodGet,
|
|
Path: "/wiki/class/list",
|
|
Handler: wiki.GetWikiClassListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新百科分类
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/class/update",
|
|
Handler: wiki.UpdateWikiClassHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建百科
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/create",
|
|
Handler: wiki.CreateWikiHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除百科
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/delete",
|
|
Handler: wiki.DeleteWikiHandler(serverCtx),
|
|
},
|
|
{
|
|
// 百科列表
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/list",
|
|
Handler: wiki.GetWikiListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 收藏/取消收藏百科
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/star",
|
|
Handler: wiki.ToggleWikiStarHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新百科
|
|
Method: http.MethodPost,
|
|
Path: "/wiki/update",
|
|
Handler: wiki.UpdateWikiHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 创建Banner
|
|
Method: http.MethodPost,
|
|
Path: "/banner/create",
|
|
Handler: banner.CreateBannerHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除Banner
|
|
Method: http.MethodPost,
|
|
Path: "/banner/delete",
|
|
Handler: banner.DeleteBannerHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新Banner
|
|
Method: http.MethodPost,
|
|
Path: "/banner/update",
|
|
Handler: banner.UpdateBannerHandler(serverCtx),
|
|
},
|
|
{
|
|
// Banner列表(管理端)
|
|
Method: http.MethodPost,
|
|
Path: "/banner/list",
|
|
Handler: banner.GetBannerListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 启用的Banner列表(客户端)
|
|
Method: http.MethodGet,
|
|
Path: "/banner/activeList",
|
|
Handler: banner.GetActiveBannerListHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{Method: http.MethodPost, Path: "/add", Handler: myPlant.CreatePlantHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/page", Handler: myPlant.GetMyPlantListHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/detail", Handler: legacy.PlantDetailHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/update", Handler: myPlant.UpdatePlantHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/deletePlant", Handler: myPlant.DeletePlantHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/deletePlan", Handler: myPlant.DeleteCarePlanHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/plan/add", Handler: legacy.AddCarePlanHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/plan/delete", Handler: legacy.DeletePlanHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/todayTask", Handler: myPlant.GetTodayTaskListHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/completeTask", Handler: complete.CompleteTaskHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/growth/add", Handler: myPlant.AddGrowthRecordHandler(serverCtx)},
|
|
|
|
{Method: http.MethodPost, Path: "/wiki/add", Handler: wiki.CreateWikiHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/wiki/page", Handler: legacy.WikiPageHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/wiki/detail", Handler: legacy.WikiDetailHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/wiki/uploadImg", Handler: legacy.WikiUploadImgHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/wiki/sync-qdrant", Handler: legacy.WikiSyncQdrantHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/wiki/delete-qdrant", Handler: legacy.WikiDeleteQdrantHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/wiki/star", Handler: legacy.WikiStarHandler(serverCtx)},
|
|
|
|
{Method: http.MethodPost, Path: "/wiki-class/add", Handler: wiki.CreateWikiClassHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/wiki-class/update", Handler: wiki.UpdateWikiClassHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/wiki-class/page", Handler: wiki.GetWikiClassListHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/wiki-class/delete", Handler: wiki.DeleteWikiClassHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/wiki-class/list", Handler: wiki.GetWikiClassListHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/wiki-class/detail", Handler: complete.GetWikiClassDetailHandler(serverCtx)},
|
|
|
|
{Method: http.MethodPost, Path: "/post/publish", Handler: post.CreatePostHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/post/page", Handler: legacy.PostPageHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/post/myPost", Handler: legacy.MyPostPageHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/post/like", Handler: legacy.LikePostHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/post/star", Handler: legacy.StarPostHandler(serverCtx)},
|
|
|
|
{Method: http.MethodPost, Path: "/topic/add", Handler: topic.CreateTopicHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/topic/page", Handler: topic.GetTopicListHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/topic/detail", Handler: legacy.TopicDetailHandler(serverCtx)},
|
|
|
|
{Method: http.MethodPost, Path: "/classify/myClassifyLog", Handler: ocr.GetMyClassifyLogHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/classify/deleteClassifyLog", Handler: ocr.DeleteClassifyLogHandler(serverCtx)},
|
|
|
|
{Method: http.MethodGet, Path: "/exchange/list", Handler: exchange.GetExchangeItemListHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/exchange/detail", Handler: legacy.ExchangeItemDetailHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/exchange/redeem", Handler: exchange.CreateExchangeOrderHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/exchange/orders", Handler: exchange.GetMyExchangeOrdersHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/exchange/item/list", Handler: exchange.GetExchangeItemListHandler(serverCtx)},
|
|
|
|
{Method: http.MethodGet, Path: "/chat/history", Handler: ai.GetAiChatHistoryHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/chat/history/delete", Handler: ai.DeleteAiChatHistoryHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/chat/history/clear", Handler: ai.ClearAiChatHistoryHandler(serverCtx)},
|
|
{Method: http.MethodGet, Path: "/chat/quota", Handler: ai.GetAiChatQuotaHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/chat/sync", Handler: legacy.AiChatSyncHandler(serverCtx)},
|
|
|
|
// 快捷养护(旧版兼容)
|
|
{Method: http.MethodPost, Path: "/quickCare", Handler: myPlant.QuickCareHandler(serverCtx)},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
)
|
|
|
|
// SSE 流式问答 & 百度 OCR 识别:需要禁用 go-zero 默认超时(TimeoutHandler 会中断长连接)
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{Method: http.MethodGet, Path: "/chat/stream", Handler: legacy.AiChatStreamHandler(serverCtx)},
|
|
{Method: http.MethodPost, Path: "/classify/plant", Handler: legacy.ClassifyPlantHandler(serverCtx)},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/plant"),
|
|
rest.WithTimeout(0),
|
|
)
|
|
}
|