This commit is contained in:
2026-06-09 17:11:59 +08:00
parent d27e123624
commit a651e08fff
+12
View File
@@ -311,6 +311,18 @@ async def trade(
) )
if not trade_data: if not trade_data:
# 去重:同一 trade_code 在 3600s 内不重复下发
dedup_key = f"jp_surugaya_trade_pending:{trade_code}"
dedup_exists = await container.session_store._redis.get(dedup_key)
if not dedup_exists:
await container.session_store._redis.setex(dedup_key, 3600, "1")
await container.session_store._redis.xadd(
name="jp_surugaya_trade_fetch",
fields={"payload": json.dumps({"trade_code": trade_code})},
maxlen=100,
approximate=True,
)
return ApiResponse[dict[str, Any]]( return ApiResponse[dict[str, Any]](
success=False, success=False,
msg="未找到该交易", msg="未找到该交易",