作者 陈志颖

fix:创建现金池

... ... @@ -578,3 +578,4 @@
2020/11/24 16:04:59.355 [D] [server.go:1925] | 127.0.0.1| 200 | 3.731193052s| match| POST  /cash-pool/activity/exchange-list/import r:/cash-pool/activity/exchange-list/import
2020/11/24 16:21:47.937 [I] [???:0] http server Running on http://:8082
2020/11/24 16:39:53.712 [I] [???:0] http server Running on http://:8082
2020/11/24 17:29:36.935 [I] [???:0] http server Running on http://:8082
... ...
... ... @@ -97,13 +97,13 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 平台已兑换素币
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 平台未兑换素币
// 获取当前公司现金池
count, cashPools, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(createCashPoolCommand))
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
cashPoolExchangeCash := cashPools[0].ExchangedCash
cashPoolUnExchangeCash := cashPools[0].UnExchangeCash
// 不存在现金池
if count == 0 { // 新增现金池
... ... @@ -132,6 +132,9 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
return cashPool, nil
}
} else { // 更新现金池
cashPoolExchangeCash := cashPools[0].ExchangedCash
cashPoolUnExchangeCash := cashPools[0].UnExchangeCash
if createCashPoolCommand.Cash < cashPoolExchangeCash {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "投入的现金值必须大于当前已兑换现金值")
}
... ...