Ver código fonte

修改redis 返回值

zhangyong 9 meses atrás
pai
commit
5f2e2380a6

+ 9 - 7
common/redis_db.py

@@ -19,6 +19,8 @@ class SyncRedisHelper:
                 port=6379,
                 db=2,
                 password="Wqsd@2019",
+                # password="Qingqu2019",
+
             )
         return self._pool
 
@@ -47,16 +49,16 @@ def get_data(platform, out_video_id):
     key = f"crawler:duplicate:{platform}:{out_video_id}"
     helper = SyncRedisHelper()
     client = helper.get_client()
-    value = client.get(key)
+    value = client.exists(key)
     return value
 
 
 # 示例:存储一个数据
-# store_data('xiaoniangao', '12345')
+# store_data('xiaoniangao', '123457')
 
 # 示例:获取一个数据
-value = get_data('xiaoniangao', '12345')
-if value is None:
-    print("Value does not exist")
-else:
-    print(f"Retrieved value: {value}")
+# value = get_data('xiaoniangao', '1234857')
+# if value is None:
+#     print("Value does not exist")
+# else:
+#     print(f"Retrieved value: {value}")

+ 1 - 1
xiaoniangao/xiaoniangao_author/xiaoniangao_author_v2.py

@@ -248,7 +248,7 @@ class XiaoNianGaoAuthor:
             "out_video_id": video_obj.get("vid", ""),
         }
         value = get_data(self.platform, video_obj.get("vid", ""))
-        if value:
+        if int(value) == 1:
             AliyunLogger.logging(
                 code="2004",
                 trace_id=trace_id,