作者 yangfu

快讯修改

@@ -44,6 +44,8 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * @@ -44,6 +44,8 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp *
44 ) 44 )
45 if req.AuthorId > 0 { 45 if req.AuthorId > 0 {
46 users = []int64{req.AuthorId} 46 users = []int64{req.AuthorId}
  47 + } else {
  48 + users = append(users, user.Id)
47 } 49 }
48 if _, articles, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, user.Id, req.LastArticleId, req.Size); err != nil { 50 if _, articles, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, user.Id, req.LastArticleId, req.Size); err != nil {
49 return nil, xerr.NewErrMsgErr("获取快讯异常", err) 51 return nil, xerr.NewErrMsgErr("获取快讯异常", err)
@@ -176,7 +176,7 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex @@ -176,7 +176,7 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex
176 queryFunc := func() (interface{}, error) { 176 queryFunc := func() (interface{}, error) {
177 tx = tx.Model(&ms). 177 tx = tx.Model(&ms).
178 Where("company_id=?", companyId). 178 Where("company_id=?", companyId).
179 - Where("author_id in (?)", append(authors, whoRead)). // 包含自己的文章 179 + Where("author_id in (?)", authors). // 包含自己的文章
180 Where(fmt.Sprintf("author_id = %d or target_user=0 or who_read @>'[%d]'", whoRead, whoRead)). 180 Where(fmt.Sprintf("author_id = %d or target_user=0 or who_read @>'[%d]'", whoRead, whoRead)).
181 Where("show = 1") 181 Where("show = 1")
182 if lastId > 0 { 182 if lastId > 0 {