正在显示
4 个修改的文件
包含
16 行增加
和
7 行删除
@@ -21,6 +21,7 @@ require ( | @@ -21,6 +21,7 @@ require ( | ||
21 | github.com/onsi/gomega v1.7.1 | 21 | github.com/onsi/gomega v1.7.1 |
22 | github.com/sergi/go-diff v1.1.0 // indirect | 22 | github.com/sergi/go-diff v1.1.0 // indirect |
23 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect | 23 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect |
24 | + github.com/shopspring/decimal v1.2.0 // indirect | ||
24 | github.com/smartystreets/goconvey v1.6.4 // indirect | 25 | github.com/smartystreets/goconvey v1.6.4 // indirect |
25 | github.com/valyala/fasthttp v1.9.0 // indirect | 26 | github.com/valyala/fasthttp v1.9.0 // indirect |
26 | github.com/xeipuuv/gojsonschema v1.2.0 // indirect | 27 | github.com/xeipuuv/gojsonschema v1.2.0 // indirect |
@@ -110,6 +110,8 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= | @@ -110,6 +110,8 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= | ||
110 | github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= | 110 | github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= |
111 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= | 111 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= |
112 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= | 112 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= |
113 | +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= | ||
114 | +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= | ||
113 | github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= | 115 | github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= |
114 | github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg= | 116 | github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg= |
115 | github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= | 117 | github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= |
@@ -255,7 +255,10 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC | @@ -255,7 +255,10 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC | ||
255 | "createTime": time.Now(), | 255 | "createTime": time.Now(), |
256 | }, nil | 256 | }, nil |
257 | } else { | 257 | } else { |
258 | + cashPools[0].Rate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cashPools[0].Rate), 64) | ||
258 | cashPools[0].LastRate = lastActivityRate | 259 | cashPools[0].LastRate = lastActivityRate |
260 | + cashPools[0].ExchangedCash, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cashPools[0].ExchangedCash), 64) | ||
261 | + cashPools[0].ExchangedSuMoney, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cashPools[0].ExchangedSuMoney), 64) | ||
259 | return cashPools[0], nil | 262 | return cashPools[0], nil |
260 | } | 263 | } |
261 | } | 264 | } |
1 | package domain | 1 | package domain |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "fmt" | ||
5 | - "strconv" | ||
6 | "time" | 4 | "time" |
7 | ) | 5 | ) |
8 | 6 | ||
@@ -31,19 +29,24 @@ func (cashPool *CashPool) Update(data map[string]interface{}) error { | @@ -31,19 +29,24 @@ func (cashPool *CashPool) Update(data map[string]interface{}) error { | ||
31 | cashPool.Cash = cash.(float64) | 29 | cashPool.Cash = cash.(float64) |
32 | } | 30 | } |
33 | if exchangedCash, ok := data["exchangedCash"]; ok { | 31 | if exchangedCash, ok := data["exchangedCash"]; ok { |
34 | - cashPool.ExchangedCash, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", exchangedCash.(float64)), 64) | 32 | + //cashPool.ExchangedCash, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", exchangedCash.(float64)), 64) |
33 | + cashPool.ExchangedCash = exchangedCash.(float64) | ||
35 | } | 34 | } |
36 | if unExchangeCash, ok := data["unExchangeCash"]; ok { | 35 | if unExchangeCash, ok := data["unExchangeCash"]; ok { |
37 | - cashPool.UnExchangeCash, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", unExchangeCash.(float64)), 64) | 36 | + //cashPool.UnExchangeCash, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", unExchangeCash.(float64)), 64) |
37 | + cashPool.UnExchangeCash = unExchangeCash.(float64) | ||
38 | } | 38 | } |
39 | if exchangedSuMoney, ok := data["exchangedSuMoney"]; ok { | 39 | if exchangedSuMoney, ok := data["exchangedSuMoney"]; ok { |
40 | - cashPool.ExchangedSuMoney, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", exchangedSuMoney.(float64)), 64) | 40 | + //cashPool.ExchangedSuMoney, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", exchangedSuMoney.(float64)), 64) |
41 | + cashPool.ExchangedSuMoney = exchangedSuMoney.(float64) | ||
41 | } | 42 | } |
42 | if unExchangeSuMoney, ok := data["unExchangeSuMoney"]; ok { | 43 | if unExchangeSuMoney, ok := data["unExchangeSuMoney"]; ok { |
43 | - cashPool.UnExchangeSuMoney, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", unExchangeSuMoney.(float64)), 64) | 44 | + //cashPool.UnExchangeSuMoney, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", unExchangeSuMoney.(float64)), 64) |
45 | + cashPool.UnExchangeSuMoney = unExchangeSuMoney.(float64) | ||
44 | } | 46 | } |
45 | if rate, ok := data["rate"]; ok { | 47 | if rate, ok := data["rate"]; ok { |
46 | - cashPool.Rate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", rate.(float64)), 64) | 48 | + //cashPool.Rate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", rate.(float64)), 64) |
49 | + cashPool.Rate = rate.(float64) | ||
47 | } | 50 | } |
48 | return nil | 51 | return nil |
49 | } | 52 | } |
-
请 注册 或 登录 后发表评论