作者 tangxvhui

调整查看权限判定

@@ -39,17 +39,25 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( @@ -39,17 +39,25 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
39 return nil, xerr.NewErrMsg("没有查看权限") 39 return nil, xerr.NewErrMsg("没有查看权限")
40 } 40 }
41 41
42 - inWhoRead := false  
43 -  
44 if len(articleInfo.WhoRead) > 0 { 42 if len(articleInfo.WhoRead) > 0 {
  43 + inWhoRead := false
45 for _, val := range articleInfo.WhoRead { 44 for _, val := range articleInfo.WhoRead {
46 if req.UserId == int(val) { 45 if req.UserId == int(val) {
47 inWhoRead = true 46 inWhoRead = true
48 } 47 }
49 } 48 }
  49 + if !inWhoRead {
  50 + // 文章内容不显示
  51 + resp = &types.MiniArticleGetResponse{
  52 + Id: articleInfo.Id,
  53 + Title: articleInfo.Title,
  54 + Show: int(domain.ArticleShowDisable),
  55 + }
  56 + return resp, nil
  57 + }
50 } 58 }
51 59
52 - if articleInfo.Show == domain.ArticleShowDisable || !inWhoRead { 60 + if articleInfo.Show == domain.ArticleShowDisable {
53 // 文章内容不显示 61 // 文章内容不显示
54 resp = &types.MiniArticleGetResponse{ 62 resp = &types.MiniArticleGetResponse{
55 Id: articleInfo.Id, 63 Id: articleInfo.Id,