16 lines
328 B
Go
16 lines
328 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"math/rand"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
// GenerateOrderSerial generate order serial
|
|
func GenerateOrderSerial(prefix string) string {
|
|
timestamp := time.Now().Format("20060102150405")
|
|
randomSuffix := rand.Intn(10000)
|
|
return fmt.Sprintf("%s%s%04d", strings.ToUpper(prefix), timestamp, randomSuffix)
|
|
}
|