package commonus import ( "crypto/rand" "math/big" "strconv" "time" ) // import ( // "crypto/md5" // "exam_server/config" // "fmt" // ) // func Md5(str string, key ...string) string { // key_val := config.AppConfig.AppKey // if len(key) > 0 { // key_val = key[0] // } // str = str + key_val // data := []byte(str) // has := md5.Sum(data) // md5str1 := fmt.Sprintf("%x", has) //将[]byte转成16进制 // return md5str1 // } //获取编号(副本) func GetFileNumberEs() (num int64) { // esult, _ := rand.Int(rand.Reader, big.NewInt(100)) result, _ := rand.Int(rand.Reader, big.NewInt(1000)) result64 := result.Int64() // timeVal := time.Now().Unix() timeVal := time.Now().UnixNano() / 1e6 num, _ = strconv.ParseInt(strconv.FormatInt(timeVal, 10)+strconv.FormatInt(result64, 10), 10, 64) return }