xjconline 2 tahun lalu
induk
melakukan
753211a78c
2 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 1 1
      src/common/common_control.py
  2. 2 3
      src/weixin/controls.py

+ 1 - 1
src/common/common_control.py

@@ -215,7 +215,7 @@ def get_today_record(user_id,match_id,match_group,today):
 
             #仓位
             today_stock_total = 0
-            today_stock = json.loads(today_record["today_stock"])
+            today_stock = json.loads(today_record["today_stock"]) if today_record.get("today_stock") else []
             for ts in today_stock:
                 if ts["fund"]:
                     try:

+ 2 - 3
src/weixin/controls.py

@@ -2682,11 +2682,10 @@ def get_user_follows_v3(request):
             if item:
                 user_id = item["user_id"]
                 latest_key = "PLAYER_LATEST_%d"%user_id
-
-                today_stock = json.loads(item["today_stock"])
+                today_stock = json.loads(item["today_stock"]) if item.get("today_stock") else []
                 today_stock = filter(lambda x:x["name"] and x["fund"],today_stock)
                 item["today_stock"] = today_stock
-                item["today_stock_img"] = json.loads(item["today_stock_img"])
+                item["today_stock_img"] = json.loads(item["today_stock_img"]) if item.get("today_stock_img") else []
 
                 win_rate = ccc.cache.hget(latest_key,"win_rate")
                 if win_rate: