feat: 添加搜索收藏微服务
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/search/rpc/internal/svc"
|
||||
"juwan-backend/app/search/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DelFavoritesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDelFavoritesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelFavoritesLogic {
|
||||
return &DelFavoritesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DelFavoritesLogic) DelFavorites(in *pb.DelFavoritesReq) (*pb.DelFavoritesResp, error) {
|
||||
err := l.svcCtx.SearchModelRW.Favorites.DeleteOneID(in.GetId()).Exec(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("delFavorites err: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.DelFavoritesResp{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user