fixed: user rank project owner changed remove rank

This commit is contained in:
xxq250 2023-07-04 16:07:19 +08:00
parent 2b03ccc67c
commit 1b68e7c9d5
1 changed files with 11 additions and 5 deletions

View File

@ -25,12 +25,18 @@ if popular_project.blank?
json.project nil json.project nil
else else
popular_project_common = $redis_cache.hgetall("v2-project-common:#{popular_project[0]}") popular_project_common = $redis_cache.hgetall("v2-project-common:#{popular_project[0]}")
if popular_project_common["owner_id"].to_s == item[0].to_s
json.project do json.project do
json.id popular_project[0] json.id popular_project[0]
json.name popular_project_common["name"] json.name popular_project_common["name"]
json.identifier popular_project_common["identifier"] json.identifier popular_project_common["identifier"]
json.description popular_project_common["description"] json.description popular_project_common["description"]
end end
else
# owner changed remove rank
$redis_cache.zrem("v2-user-project-rank:#{item[0]}", popular_project[0])
json.project nil
end
end end
ids = $redis_cache.zrevrange("v2-user-project-rank:#{item[0]}", 0, 999, withscores: true).map{|a|a[0]} ids = $redis_cache.zrevrange("v2-user-project-rank:#{item[0]}", 0, 999, withscores: true).map{|a|a[0]}