refactor: reorganize modules and add Linux build tooling
This commit is contained in:
14
module/ec/order/internal/logic/common/no.go
Normal file
14
module/ec/order/internal/logic/common/no.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 订单号:2位年份,月,日,时,分,秒,6位随机数共18位
|
||||
func CreateOrderNo() string {
|
||||
t := time.Now().Local()
|
||||
rand := fmt.Sprintf("%06v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000))
|
||||
return fmt.Sprintf("%d%d%d%d%d%d%s", t.Year()-2000, t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), rand)
|
||||
}
|
||||
Reference in New Issue
Block a user