Explorar o código

add position log

liqian hai 1 ano
pai
achega
c079a16a6f
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      recommend.py

+ 4 - 0
recommend.py

@@ -1642,6 +1642,8 @@ def video_homepage_recommend(request_id, mid, uid, size, app_type, algo_type,
     # })
     recommend_result['recommendOperation'] = result
     rank_result = result.get('rankResult')
+    for i, item in enumerate(rank_result):
+        item['position'] = i + 1
     recommend_result['videos'] = rank_result
     recommend_result['getRecommendResultTime'] = (time.time() - get_result_st) * 1000
 
@@ -1770,6 +1772,8 @@ def video_relevant_recommend(request_id, video_id, mid, uid, size, app_type, ab_
     # })
     recommend_result['recommendOperation'] = result
     rank_result = result.get('rankResult')
+    for i, item in enumerate(rank_result):
+        item['position'] = i+1
     recommend_result['videos'] = rank_result
     recommend_result['getRecommendResultTime'] = (time.time() - get_result_st) * 1000