优化下载次数统计代码

dependabot/npm_and_yarn/fir_admin/tmpl-1.0.5
youngS 3 years ago
parent 3ade1efadb
commit 4f0c8a302c
  1. 1
      fir_ser/api/utils/crontab/ctasks.py

@ -21,6 +21,7 @@ def sync_download_times():
key = "_".join([down_tem_key, '*']) key = "_".join([down_tem_key, '*'])
for app_download in cache.iter_keys(key): for app_download in cache.iter_keys(key):
count_hits = cache.get(app_download) count_hits = cache.get(app_download)
if count_hits:
app_id = app_download.split(down_tem_key)[1].strip('_') app_id = app_download.split(down_tem_key)[1].strip('_')
Apps.objects.filter(app_id=app_id).update(count_hits=count_hits) Apps.objects.filter(app_id=app_id).update(count_hits=count_hits)
logger.info(f"sync_download_times app_id:{app_id} count_hits:{count_hits}") logger.info(f"sync_download_times app_id:{app_id} count_hits:{count_hits}")

Loading…
Cancel
Save