You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
353 B
Go

package utils
import (
"fmt"
"math/rand"
"time"
)
type idUtil struct {
}
// Id 暴露接口
func Id() *idUtil {
return &idUtil{}
}
// GenOrderNo 生成订单Id
func (idUtil) GenOrderNo() string {
ss := time.Now().Format("20060102")
sss := time.Now().UnixNano() / 1e8
r := rand.Intn(1000)
n := fmt.Sprintf("%s%d%03d", ss, sss, r)
return n
}