From aaa8b1b2fca572d6a989179d568991ce4bd48cfb Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 04 三月 2025 17:30:32 +0800
Subject: [PATCH] -

---
 src/common/utils/util.js |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/src/common/utils/util.js b/src/common/utils/util.js
index f16ad85..da3cfb9 100644
--- a/src/common/utils/util.js
+++ b/src/common/utils/util.js
@@ -153,7 +153,7 @@
 		const hours = date.getHours().toString().padStart(2, '0');
 		const minutes = date.getMinutes().toString().padStart(2, '0');
 		if (type) {
-			return `${year}-${month}-${day} ${hours}:${minutes}`;
+			return type=='riqi' ? `${month}-${day}`: `${year}-${month}-${day} ${hours}:${minutes}`;
 		}
 		return `${year}-${month}-${day}`;
 	},
@@ -867,4 +867,32 @@
 			}
 		});
 	},
+	//鐢熸垚鏃堕棿鎴�+闅忔満鏁�
+	// 鐢熸垚鏃堕棿鎴�+闅忔満鏁扮殑鍑芥暟
+	generateTimestampWithRandom(filename) {
+		// 鑾峰彇褰撳墠鏃ユ湡鍜屾椂闂�
+		const now = new Date();
+		// 鑾峰彇骞翠唤锛岀‘淇濅负鍥涗綅鏁�
+		const year = now.getFullYear();
+		// 鑾峰彇鏈堜唤锛岀‘淇濅负涓や綅鏁�
+		const month = String(now.getMonth() + 1).padStart(2, '0');
+		// 鑾峰彇鏃ユ湡锛岀‘淇濅负涓や綅鏁�
+		const day = String(now.getDate()).padStart(2, '0');
+		// 鑾峰彇灏忔椂锛岀‘淇濅负涓や綅鏁�
+		const hours = String(now.getHours()).padStart(2, '0');
+		// 鑾峰彇鍒嗛挓锛岀‘淇濅负涓や綅鏁�
+		const minutes = String(now.getMinutes()).padStart(2, '0');
+		// 鑾峰彇绉掓暟锛岀‘淇濅负涓や綅鏁�
+		const seconds = String(now.getSeconds()).padStart(2, '0');
+		// 鎷兼帴鏃堕棿鎴�
+		const timestamp = `${year}${month}${day}${hours}${minutes}${seconds}`;
+		// 鐢熸垚涓�涓� 0 鍒� 9999 涔嬮棿鐨勯殢鏈烘暟锛屽苟鏍煎紡鍖栦负鍥涗綅鏁�
+		const randomNumber = String(Math.floor(Math.random() * 10000)).padStart(4, '0');
+		// 鎷兼帴鏃堕棿鎴冲拰闅忔満鏁�
+		return `cylsg/${timestamp}_${randomNumber}` + filename.match(/\.[^.]+$/);
+	},
+	getFileExtensionWithDotRegex(filename) {
+		const match = filename.match(/\.[^.]+$/);
+		return match ? match[0] : '';
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.1