This commit is contained in:
parent
681a1607c6
commit
cdb6cf7807
|
|
@ -948,12 +948,21 @@ func (m *BizCore) NewsAsyncBatch(ctx *itypes.Context, req *proto.NewsAsyncBatchR
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *BizCore) NewsPullNew(ctx *itypes.Context, req *proto.NewsPullNewReq) (resp *proto.NewsPullNewResp, total int64, code itypes.BizCode) {
|
func (m *BizCore) NewsPullNew(ctx *itypes.Context, req *proto.NewsPullNewReq) (resp *proto.NewsPullNewResp, total int64, code itypes.BizCode) {
|
||||||
|
// 1. 提取 OrgIDs
|
||||||
|
orgIDs := make([]int64, 0, len(req.List))
|
||||||
|
for _, item := range req.List {
|
||||||
|
orgIDs = append(orgIDs, item.OrgID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 调用 DAO 查询
|
||||||
dos, total, err := m.newsDAO.QueryPullNew(&dao.NewsPullNewCondition{
|
dos, total, err := m.newsDAO.QueryPullNew(&dao.NewsPullNewCondition{
|
||||||
OrgIDs: req.OrgIDs,
|
OrgIDs: orgIDs,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, itypes.NewBizCodeDatabaseError(err.Error())
|
return nil, 0, itypes.NewBizCodeDatabaseError(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. 返回结果
|
||||||
return &proto.NewsPullNewResp{
|
return &proto.NewsPullNewResp{
|
||||||
List: dos,
|
List: dos,
|
||||||
}, total, itypes.BizOK
|
}, total, itypes.BizOK
|
||||||
|
|
|
||||||
|
|
@ -293,10 +293,18 @@ type NewsAsyncResp struct {
|
||||||
List []*models.NewsDO `json:"list"`
|
List []*models.NewsDO `json:"list"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewsPullNewReq struct {
|
// type NewsPullNewReq struct {
|
||||||
OrgIDs []int64 `json:"org_ids"`
|
// OrgIDs []int64 `json:"org_ids"`
|
||||||
|
// Digest string `json:"digest"`
|
||||||
|
// }
|
||||||
|
|
||||||
|
type NewsPullNewItem struct {
|
||||||
|
OrgID int64 `json:"org_id"`
|
||||||
Digest string `json:"digest"`
|
Digest string `json:"digest"`
|
||||||
}
|
}
|
||||||
|
type NewsPullNewReq struct {
|
||||||
|
List []NewsPullNewItem `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
type NewsPullNewResp struct {
|
type NewsPullNewResp struct {
|
||||||
List []*models.NewsDO `json:"list"`
|
List []*models.NewsDO `json:"list"`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue