作者 tangxvhui

调整检查文章的查看权限

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