package utils import ( "math/rand" ) func OrderIdRange(OrderId int64) (int64, int64) { minOrderId := OrderId //后面有几个零 var maxStep int64 = 1 currValue := minOrderId for { if currValue%10 == 0 { currValue = currValue / 10 maxStep = maxStep * 10 } else { break } } maxOrderId := minOrderId + maxStep - 1 return minOrderId, maxOrderId } // 长度为62 var bytes []byte = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890") func RandName(n int) string { result := make([]byte, n) for i := 0; i < n; i++ { result[i] = bytes[rand.Int31()%62] } return string(result) }