修改部分逻辑

This commit is contained in:
2025-07-05 15:57:28 +08:00
parent 9f267927c6
commit 1706db2532
7 changed files with 533 additions and 56 deletions

18
utils/gen_call_id.go Normal file
View File

@@ -0,0 +1,18 @@
package utils
import (
"crypto/rand"
"encoding/hex"
"fmt"
"time"
)
// GenerateCallID 生成16字节的唯一通话ID
func GenerateCallID() string {
b := make([]byte, 8)
if _, err := rand.Read(b); err != nil {
// 如果随机数生成失败,使用时间戳作为后备
return fmt.Sprintf("%d", time.Now().UnixNano())
}
return hex.EncodeToString(b)
}