...
|
...
|
@@ -5,6 +5,8 @@ import ( |
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
...
|
...
|
@@ -24,7 +26,33 @@ func NewMiniSearchArticleDraftMeLogic(ctx context.Context, svcCtx *svc.ServiceCo |
|
|
}
|
|
|
|
|
|
func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.MiniArticleDraftSearchMeRequest) (resp *types.MiniArticleDraftSearchMeResponse, err error) {
|
|
|
// todo: add your logic here and delete this line
|
|
|
var conn = l.svcCtx.DefaultDBConn()
|
|
|
|
|
|
return
|
|
|
queryOption := domain.NewQueryOptions().
|
|
|
WithOffsetLimit(req.Page, req.Size).
|
|
|
MustWithKV("authorId", req.AuthorId)
|
|
|
|
|
|
cnt, draftList, err := l.svcCtx.ArticleDraftRepository.Find(l.ctx, conn, queryOption)
|
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("获取草稿列表失败", err)
|
|
|
}
|
|
|
resp = &types.MiniArticleDraftSearchMeResponse{
|
|
|
Total: cnt,
|
|
|
List: make([]types.MiniArticleDraftItem, len(draftList)),
|
|
|
}
|
|
|
|
|
|
for i := range draftList {
|
|
|
images := []string{}
|
|
|
for _, val := range draftList[i].Images {
|
|
|
images = append(images, val.Url)
|
|
|
}
|
|
|
resp.List[i] = types.MiniArticleDraftItem{
|
|
|
Id: draftList[i].Id,
|
|
|
Template: draftList[i].Template,
|
|
|
Content: draftList[i].Content,
|
|
|
Title: draftList[i].Title,
|
|
|
Images: images,
|
|
|
}
|
|
|
}
|
|
|
return resp, nil
|
|
|
} |
...
|
...
|
|