Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b362a0

Browse files
committed
不需要的数据不返回,优化带宽占用
1 parent f546cb3 commit 7b362a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

logic/rank.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,31 +251,38 @@ func (RankLogic) findModelsByRank(resultSlice []interface{}, objtype, num int, n
251251
topics := DefaultTopic.FindByTids(objids)
252252
for i, topic := range topics {
253253
topic.RankView = viewNums[i]
254+
// 内容不需要
255+
topic.Content = ""
254256
}
255257
result = topics
256258
}
257259
case model.TypeResource:
258260
resources := DefaultResource.FindByIds(objids)
259261
for i, resource := range resources {
260262
resource.RankView = viewNums[i]
263+
resource.Content = ""
261264
}
262265
result = resources
263266
case model.TypeArticle:
264267
articles := DefaultArticle.FindByIds(objids)
265268
for i, article := range articles {
266269
article.RankView = viewNums[i]
270+
article.Content = ""
271+
article.Txt = ""
267272
}
268273
result = articles
269274
case model.TypeProject:
270275
projects := DefaultProject.FindByIds(objids)
271276
for i, project := range projects {
272277
project.RankView = viewNums[i]
278+
project.Desc = ""
273279
}
274280
result = projects
275281
case model.TypeBook:
276282
books := DefaultGoBook.FindByIds(objids)
277283
for i, book := range books {
278284
book.RankView = viewNums[i]
285+
book.Desc = ""
279286
}
280287
result = books
281288
}

0 commit comments

Comments
 (0)