From 915424730f27445da2e8de13b62e77179cc1a15a Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 18 八月 2025 17:07:39 +0800
Subject: [PATCH] fix: 关闭移动充值渠道,打开电信充值渠道
---
apps/h5/src/utils/storage/storage.ts | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/apps/h5/src/utils/storage/storage.ts b/apps/h5/src/utils/storage/storage.ts
new file mode 100644
index 0000000..50f5804
--- /dev/null
+++ b/apps/h5/src/utils/storage/storage.ts
@@ -0,0 +1,46 @@
+interface ProxyStorage {
+ getItem(key: string): any;
+ setItem(Key: string, value: string): void;
+ removeItem(key: string): void;
+ clear(): void;
+}
+
+//sessionStorage operate
+class sessionStorageProxy implements ProxyStorage {
+ protected storage: ProxyStorage;
+
+ constructor(storageModel: ProxyStorage) {
+ this.storage = storageModel;
+ }
+
+ // 瀛�
+ public setItem(key: string, value: any): void {
+ this.storage.setItem(key, JSON.stringify(value));
+ }
+
+ // 鍙�
+ public getItem<T = any>(key: string): null | T {
+ return JSON.parse(this.storage.getItem(key));
+ }
+
+ // 鍒�
+ public removeItem(key: string): void {
+ this.storage.removeItem(key);
+ }
+
+ // 娓呯┖
+ public clear(): void {
+ this.storage.clear();
+ }
+}
+
+//localStorage operate
+class localStorageProxy extends sessionStorageProxy implements ProxyStorage {
+ constructor(localStorage: ProxyStorage) {
+ super(localStorage);
+ }
+}
+
+export const storageSession = new sessionStorageProxy(sessionStorage);
+
+export const storageLocal = new localStorageProxy(localStorage);
--
Gitblit v1.9.1