29 lines
857 B
Go
29 lines
857 B
Go
package complete
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"sundynix-micro-go/app/plant/api/internal/svc"
|
|
"sundynix-micro-go/app/plant/api/internal/types"
|
|
plantPb "sundynix-micro-go/app/plant/rpc/plant"
|
|
)
|
|
|
|
type GetAiChatHistoryLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewGetAiChatHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAiChatHistoryLogic {
|
|
return &GetAiChatHistoryLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *GetAiChatHistoryLogic) GetAiChatHistory(req *types.PageReq) (*plantPb.AiChatHistoryResp, error) {
|
|
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
|
|
return l.svcCtx.PlantRpc.GetAiChatHistory(l.ctx, &plantPb.AiChatHistoryReq{
|
|
UserId: userId, Current: int32(req.Current), PageSize: int32(req.PageSize),
|
|
})
|
|
}
|