fusenapi/utils/id_generator/unique_number.go

14 lines
234 B
Go
Raw Normal View History

2023-06-27 07:26:23 +00:00
package id_generator
import (
"fmt"
"math/rand"
"strings"
"time"
)
2023-07-03 09:33:59 +00:00
func GenSnNum() string {
2023-08-24 10:28:01 +00:00
a := fmt.Sprintf("%s%.8d", time.Now().UTC().Format("20060102150405.000"), rand.Intn(1000000))
2023-06-27 07:26:23 +00:00
return strings.ReplaceAll(a, ".", "")
}