|
@@ -1,5 +1,7 @@
|
|
|
import redis
|
|
|
|
|
|
+from common import Material
|
|
|
+
|
|
|
|
|
|
class SyncRedisHelper:
|
|
|
_pool: redis.ConnectionPool = None
|
|
@@ -33,7 +35,7 @@ class SyncRedisHelper:
|
|
|
self._pool.disconnect(inuse_connections=True)
|
|
|
|
|
|
|
|
|
-def get_data(name, data):
|
|
|
+def get_data(name, feishu_id, feishu_sheet):
|
|
|
task = f"task:{name}"
|
|
|
lock = f"lock:{name}"
|
|
|
helper = SyncRedisHelper()
|
|
@@ -42,10 +44,13 @@ def get_data(name, data):
|
|
|
acquire_lock = client.set(lock, 1, ex=60, nx=True)
|
|
|
if not acquire_lock:
|
|
|
return None
|
|
|
-
|
|
|
+ if name == 'pl-gjc':
|
|
|
+ data = Material.get_keyword_data(feishu_id, feishu_sheet)
|
|
|
+ else:
|
|
|
+ data = Material.get_task_data(feishu_id, feishu_sheet)
|
|
|
client.rpush(task, *data)
|
|
|
ret = client.lpop(task)
|
|
|
- if name == 'pl-gjc':
|
|
|
+ if name == 'pl-gjc' or name == 'dd-sp':
|
|
|
client.rpush(task, ret)
|
|
|
return ret
|
|
|
|