Browse Source

转换工具类调整

zhangjinkun 7 years ago
parent
commit
12692bc1cc
1 changed files with 9 additions and 0 deletions
  1. 9 0
      common/src/qfw/util/common.go

+ 9 - 0
common/src/qfw/util/common.go

@@ -243,6 +243,9 @@ func Int64All(num interface{}) int64 {
 	} else if i7, ok7 := num.(*big.Int); ok7 {
 	} else if i7, ok7 := num.(*big.Int); ok7 {
 		in, _ := strconv.ParseInt(fmt.Sprint(i7), 10, 64)
 		in, _ := strconv.ParseInt(fmt.Sprint(i7), 10, 64)
 		return int64(in)
 		return int64(in)
+	} else if i8, ok8 := num.(*big.Float); ok8 {
+		in, _ := strconv.ParseInt(fmt.Sprint(i8), 10, 64)
+		return int64(in)
 	} else {
 	} else {
 		return 0
 		return 0
 	}
 	}
@@ -279,6 +282,9 @@ func Float64All(num interface{}) float64 {
 	} else if i7, ok7 := num.(*big.Float); ok7 {
 	} else if i7, ok7 := num.(*big.Float); ok7 {
 		in, _ := strconv.ParseFloat(fmt.Sprint(i7), 64)
 		in, _ := strconv.ParseFloat(fmt.Sprint(i7), 64)
 		return float64(in)
 		return float64(in)
+	} else if i8, ok8 := num.(*big.Int); ok8 {
+		in, _ := strconv.ParseFloat(fmt.Sprint(i8), 64)
+		return float64(in)
 	} else {
 	} else {
 		return 0
 		return 0
 	}
 	}
@@ -305,6 +311,9 @@ func IntAllDef(num interface{}, defaultNum int) int {
 	} else if i7, ok7 := num.(*big.Int); ok7 {
 	} else if i7, ok7 := num.(*big.Int); ok7 {
 		in, _ := strconv.Atoi(fmt.Sprint(i7))
 		in, _ := strconv.Atoi(fmt.Sprint(i7))
 		return int(in)
 		return int(in)
+	} else if i8, ok8 := num.(*big.Float); ok8 {
+		in, _ := strconv.Atoi(fmt.Sprint(i8))
+		return int(in)
 	} else {
 	} else {
 		return defaultNum
 		return defaultNum
 	}
 	}