diff --git a/dao/sim_dao.go b/dao/sim_dao.go index 60736d8..40b92eb 100644 --- a/dao/sim_dao.go +++ b/dao/sim_dao.go @@ -7,14 +7,20 @@ import ( "time" ) +type FlowSum struct { + Flow float64 `json:"flow" db:"flow"` + IccID string `json:"icc_id" db:"icc_id"` + FlowUnit string `json:"flow_unit" db:"flow_unit"` +} + func GetSimFlowExpend(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd time.Time) (simFlowExpnd []*model.SimFlowExpend, err error) { return simFlowExpnd, err } -func GetSimFlowExpendSum(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd time.Time) (simFlowExpnd *model.SimFlowExpend, err error) { +func GetSimFlowExpendSum(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd time.Time) (simFlowExpnd *FlowSum, err error) { var ( - simFlowExpnds []*model.SimFlowExpend + simFlowExpnds []*FlowSum ) sql := ` SELECT SUM( @@ -47,9 +53,9 @@ func GetSimFlowExpendSum(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd return simFlowExpnd, err } -func GetSimFlowIncomeSum(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd time.Time) (simFlowIncome *model.SimFlowIncome, err error) { +func GetSimFlowIncomeSum(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd time.Time) (simFlowIncome *FlowSum, err error) { var ( - simFlowIncomes []*model.SimFlowIncome + simFlowIncomes []*FlowSum ) sql := ` SELECT SUM( diff --git a/services/sim.go b/services/sim.go index 2426815..b30991a 100644 --- a/services/sim.go +++ b/services/sim.go @@ -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" @@ -51,7 +50,6 @@ func SimFlowDaySettle() (err error) { //api.TibiotAPI.BatchQueryCardInfo(1) } else { sumExpend, _ := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd) - fmt.Println("qqqqqqqqqqqqqqqqqqqqqqqqq", utils.Format4Output(sumExpend, true)) cardFlow := putils.Flow2KB(putils.SplitFlowAndUnit(getCardInfoResultMonth.CardFlow)) flowExpend.Flow, flowExpend.FlowUnit = putils.FlowKB2Other(cardFlow - sumExpend.Flow) }