瀏覽代碼

Merge branch 'feature/v1.2.6' of http://192.168.3.207:8080/jianyu/jy-docs into feature/v1.2.6

wenmenghao 2 年之前
父節點
當前提交
948f35dcab
共有 2 個文件被更改,包括 5 次插入6 次删除
  1. 0 6
      jydocs-back/rpc/stdDocRpc.go
  2. 5 0
      jydocs-back/servers/stdDoc.go

+ 0 - 6
jydocs-back/rpc/stdDocRpc.go

@@ -56,7 +56,6 @@ func GetDocQuery(userId, keyWord, tag string, pageNum, pageSize int64, sort stri
 		sortArr = append(sortArr, "-uploadDate")
 	}
 	param.Sort = sortArr
-
 	resp, err := jyStdDocStdlib.DocQuery(context.Background(), param)
 	if err != nil {
 		log.Printf("%s SetUserCollect call error %v\n", userId, err)
@@ -66,11 +65,6 @@ func GetDocQuery(userId, keyWord, tag string, pageNum, pageSize int64, sort stri
 		log.Printf("%s SetUserCollect fail Message %v\n", userId, resp.Msg)
 		return nil, -1, fmt.Errorf("查询失败")
 	}
-	for _, v := range resp.Docs {
-		if v.PreviewImgId != "" {
-			v.PreviewImgId = fmt.Sprintf("https://%s.%s/%s", config.JyDocsAppConfig.OssBucket.Priv, config.JyDocsAppConfig.OssAdmin, v.PreviewImgId)
-		}
-	}
 	return resp.Docs, resp.Total, nil
 }
 

+ 5 - 0
jydocs-back/servers/stdDoc.go

@@ -187,6 +187,11 @@ func (stdDoc *StdDoc) TopList() {
 			return nil, err
 		}
 		if len(list) > 0 { //存入redis缓存
+			for _, v := range list {
+				if v.PreviewImgId != "" {
+					v.PreviewImgId = fmt.Sprintf("https://%s.%s/%s", config.JyDocsAppConfig.OssBucket.Priv, config.JyDocsAppConfig.OssAdmin, v.PreviewImgId)
+				}
+			}
 			redis.Put("other", topKey, list, 60*5)
 		}
 		return list, nil