feat: 添加搜索收藏微服务

This commit is contained in:
zetaloop
2026-04-24 13:24:58 +08:00
parent 91fdd2a498
commit 53d0e791b4
58 changed files with 6239 additions and 57 deletions
@@ -0,0 +1,17 @@
package search
import "juwan-backend/app/search/api/internal/types"
func emptySearchResp(offset, limit int64) *types.SearchResp {
if limit <= 0 {
limit = 20
}
return &types.SearchResp{
Items: make([]interface{}, 0),
Meta: types.PageMeta{
Total: 0,
Offset: offset,
Limit: limit,
},
}
}
@@ -0,0 +1,32 @@
// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package search
import (
"context"
"juwan-backend/app/search/api/internal/svc"
"juwan-backend/app/search/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type RecommendationsLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
// 首页推荐
func NewRecommendationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecommendationsLogic {
return &RecommendationsLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *RecommendationsLogic) Recommendations(req *types.PageReq) (resp *types.SearchResp, err error) {
return emptySearchResp(req.Offset, req.Limit), nil
}
@@ -0,0 +1,32 @@
// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package search
import (
"context"
"juwan-backend/app/search/api/internal/svc"
"juwan-backend/app/search/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SearchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
// 统一搜索
func NewSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SearchLogic {
return &SearchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SearchLogic) Search(req *types.SearchReq) (resp *types.SearchResp, err error) {
return emptySearchResp(req.Offset, req.Limit), nil
}