|
@@ -1,6 +1,7 @@
|
|
|
"""
|
|
|
@author: luojunhui
|
|
|
"""
|
|
|
+import random
|
|
|
import time
|
|
|
|
|
|
from uuid import uuid4
|
|
@@ -161,12 +162,12 @@ class AccountArticleRank(object):
|
|
|
else:
|
|
|
ranked_1 = []
|
|
|
# rank2
|
|
|
- if article_list2_ori:
|
|
|
- for item in article_list2_ori:
|
|
|
- item['score'] = 100
|
|
|
- ranked_2 = sorted(article_list2_ori, key=lambda x: x['crawlerViewCount'], reverse=True)
|
|
|
- else:
|
|
|
- ranked_2 = []
|
|
|
+ # if article_list2_ori:
|
|
|
+ # for item in article_list2_ori:
|
|
|
+ # item['score'] = 100
|
|
|
+ # ranked_2 = sorted(article_list2_ori, key=lambda x: x['crawlerViewCount'], reverse=True)
|
|
|
+ # else:
|
|
|
+ ranked_2 = []
|
|
|
|
|
|
# rank3
|
|
|
if article_list3_ori:
|
|
@@ -207,7 +208,8 @@ class AccountArticleRank(object):
|
|
|
try:
|
|
|
L = []
|
|
|
if ranked_1:
|
|
|
- L.append(ranked_1[0])
|
|
|
+ target = random.choice(ranked_1[:5])
|
|
|
+ L.append(target)
|
|
|
if ranked_2:
|
|
|
L.append(ranked_2[0])
|
|
|
else:
|
|
@@ -217,9 +219,10 @@ class AccountArticleRank(object):
|
|
|
L.append(i)
|
|
|
else:
|
|
|
L.append(ranked_2[0])
|
|
|
+ # L only 1
|
|
|
for item in ranked_3:
|
|
|
L.append(item)
|
|
|
-
|
|
|
+ # L 1 and 3
|
|
|
result = {
|
|
|
"accountId": self.accountId,
|
|
|
"accountName": self.accountName,
|