parent
ee15a99b9e
commit
e439ada75a
@ -1,11 +0,0 @@
|
|||||||
package tools
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Money(m float64) float64 {
|
|
||||||
f, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", m), 64)
|
|
||||||
return f
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package tools
|
|
||||||
|
|
||||||
func Struct2Map(obj interface{}) map[string]interface{} {
|
|
||||||
bs, err := json.Marshal(obj)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// json字符转化为map
|
|
||||||
var data = make(map[string]interface{})
|
|
||||||
err = json.Unmarshal(bs, &data)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return data
|
|
||||||
}
|
|
Loading…
Reference in new issue