22 lines
308 B
Go
22 lines
308 B
Go
|
package tools
|
||
|
|
||
|
import (
|
||
|
"crypto/md5"
|
||
|
"encoding/hex"
|
||
|
"github.com/satori/go.uuid"
|
||
|
)
|
||
|
|
||
|
//生成uuid
|
||
|
func Uuid() string {
|
||
|
u2 := uuid.NewV4()
|
||
|
return u2.String()
|
||
|
}
|
||
|
|
||
|
//生成uuid,并且md5一下
|
||
|
func Uuid2() string {
|
||
|
m := md5.New()
|
||
|
m.Write([]byte(Uuid()))
|
||
|
res := hex.EncodeToString(m.Sum(nil))
|
||
|
return res
|
||
|
}
|