chore: sync local changes (2026-03-12)

This commit is contained in:
2026-03-12 18:58:53 +08:00
parent 74f15c282e
commit d861a9937b
38 changed files with 3570 additions and 2926 deletions

View File

@@ -1,31 +1,31 @@
package utils
import (
"crypto/rand"
"encoding/hex"
"time"
)
// GenerateID 生成唯一ID
func GenerateID() string {
timestamp := time.Now().UnixNano()
randomBytes := make([]byte, 4)
rand.Read(randomBytes)
return hex.EncodeToString([]byte{
byte(timestamp >> 56),
byte(timestamp >> 48),
byte(timestamp >> 40),
byte(timestamp >> 32),
byte(timestamp >> 24),
byte(timestamp >> 16),
byte(timestamp >> 8),
byte(timestamp),
}) + hex.EncodeToString(randomBytes)
}
// GenerateShortID 生成短ID
func GenerateShortID() string {
randomBytes := make([]byte, 6)
rand.Read(randomBytes)
return hex.EncodeToString(randomBytes)
}
package utils
import (
"crypto/rand"
"encoding/hex"
"time"
)
// GenerateID 生成唯一ID
func GenerateID() string {
timestamp := time.Now().UnixNano()
randomBytes := make([]byte, 4)
rand.Read(randomBytes)
return hex.EncodeToString([]byte{
byte(timestamp >> 56),
byte(timestamp >> 48),
byte(timestamp >> 40),
byte(timestamp >> 32),
byte(timestamp >> 24),
byte(timestamp >> 16),
byte(timestamp >> 8),
byte(timestamp),
}) + hex.EncodeToString(randomBytes)
}
// GenerateShortID 生成短ID
func GenerateShortID() string {
randomBytes := make([]byte, 6)
rand.Read(randomBytes)
return hex.EncodeToString(randomBytes)
}