This commit is contained in:
suyl
2021-07-21 14:30:08 +08:00
parent b5355149e7
commit 7aabe0b988
3 changed files with 4 additions and 5 deletions

View File

@@ -94,11 +94,8 @@ func Update(db *sqlx.DB, obj interface{}, fields ...string) (err error) {
if direct.Field(0).Int() == 0 {
return err
} else {
fmt.Println("11111111", direct.Field(0).Int())
sqlParams = append(sqlParams, direct.Field(0).Int())
}
fmt.Println(sql.String())
fmt.Println(sqlParams)
_, err = db.DB.Exec(sql.String(), sqlParams...)
return err
}

View File

@@ -1,6 +1,7 @@
package services
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/tibiotapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-print/dao"
@@ -51,6 +52,7 @@ func SimFlowDaySettle() (err error) {
} else {
if sumExpend, err := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd); err == nil {
cardFlow := putils.Flow2KB(putils.SplitFlowAndUnit(getCardInfoResultMonth.CardFlow))
fmt.Println("11111111111111111111", cardFlow, sumExpend.Flow)
flowExpend.Flow, flowExpend.FlowUnit = putils.FlowKB2Other(cardFlow - sumExpend.Flow)
}
}

View File

@@ -229,9 +229,9 @@ func Flow2KB(flow float64, unit string) (flowKB float64) {
if unit == "KB" {
return flow
} else if unit == "MB" {
return flow * 1024
return flow * float64(1024)
} else if unit == "GB" {
return flow * 1024 * 1024
return flow * float64(1024) * float64(1024)
}
return flowKB
}