作者 tangxvhui

Merge branch 'dev' into test

@@ -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{
@@ -21,9 +21,10 @@ type MiniSearchArticlePageLogic struct { @@ -21,9 +21,10 @@ type MiniSearchArticlePageLogic struct {
21 21
22 func NewMiniSearchArticlePageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniSearchArticlePageLogic { 22 func NewMiniSearchArticlePageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniSearchArticlePageLogic {
23 return &MiniSearchArticlePageLogic{ 23 return &MiniSearchArticlePageLogic{
24 - Logger: logx.WithContext(ctx),  
25 - ctx: ctx,  
26 - svcCtx: svcCtx, 24 + Logger: logx.WithContext(ctx),
  25 + ctx: ctx,
  26 + svcCtx: svcCtx,
  27 + userCache: make(map[int64]*domain.User),
27 } 28 }
28 } 29 }
29 30