This commit is contained in:
suyl
2021-07-21 18:56:27 +08:00
parent e813ceaf48
commit a6cdea6610
2 changed files with 11 additions and 13 deletions

View File

@@ -1,7 +1,6 @@
package services
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/tibiotapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-print/dao"
@@ -53,9 +52,6 @@ func SimFlowDaySettle() (err error) {
if sumExpend, err := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd); err == nil {
cardFlow := putils.Flow2KB(putils.SplitFlowAndUnit(getCardInfoResultMonth.CardFlow))
flowExpend.Flow, flowExpend.FlowUnit = putils.FlowKB2Other(cardFlow - sumExpend.Flow)
if flowExpend.Flow < 0 {
err = fmt.Errorf("流量计算有问题!")
}
}
}
}
@@ -63,7 +59,9 @@ func SimFlowDaySettle() (err error) {
flowExpend.Flow, flowExpend.FlowUnit = putils.SplitFlowAndUnit(getCardInfoResult.CardFlow)
}
}
err = dao.Insert(db, flowExpend)
if flowExpend.Flow > 0 && flowExpend.FlowUnit != "" {
err = dao.Insert(db, flowExpend)
}
//算是否超了一个月的流量了
//一个月总的收入流量 - 一个月总的支出流量 <= 0
sumIncome, _ := dao.GetSimFlowIncomeSum(db, v.IccID, monthBegin, monthEnd)