Files
mir-godot/service/framework/utils/order.go

32 lines
587 B
Go
Raw Normal View History

2024-03-06 10:47:22 +08:00
/**
#*****************************************************************************
2024-08-06 18:30:21 +08:00
# @author MakerYang
# @site mir2.makeryang.com
2024-03-06 10:47:22 +08:00
#*****************************************************************************
*/
2024-03-03 22:59:18 +08:00
package Utils
import (
"math/rand"
"time"
)
func CreateOrderNum() string {
2024-08-06 18:30:21 +08:00
2024-03-03 22:59:18 +08:00
str := "0123456789"
2024-08-06 18:30:21 +08:00
2024-03-03 22:59:18 +08:00
bytes := []byte(str)
result := make([]byte, 0)
2024-08-06 18:30:21 +08:00
2024-03-03 22:59:18 +08:00
r := rand.New(rand.NewSource(time.Now().UnixNano()))
2024-08-06 18:30:21 +08:00
2024-03-03 22:59:18 +08:00
for i := 0; i < 8; i++ {
result = append(result, bytes[r.Intn(len(bytes))])
}
2024-08-06 18:30:21 +08:00
2024-03-03 22:59:18 +08:00
order := time.Now().Format("20060102150405") + string(result)
2024-08-06 18:30:21 +08:00
2024-03-03 22:59:18 +08:00
return order
}