From 48fb7a00951f91bdc707e5dd2d196e5bccb752c3 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期三, 18 六月 2025 18:41:30 +0800
Subject: [PATCH] 异常保护

---
 utils/tool.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/utils/tool.py b/utils/tool.py
index 207e003..e191df7 100644
--- a/utils/tool.py
+++ b/utils/tool.py
@@ -21,6 +21,22 @@
     return wrapper
 
 
+def singleton(cls):
+    """
+    鍗曚緥瑁呴グ鍣�
+    @param cls:
+    @return:
+    """
+    instances = {}
+
+    def get_instance(*args, **kwargs):
+        if cls not in instances:
+            instances[cls] = cls(*args, **kwargs)
+        return instances[cls]
+
+    return get_instance
+
+
 def get_expire():
     now = int(t.time())
     end = int(t.time()) + 60 * 60 * 24

--
Gitblit v1.8.0