From ac63eccda879d97fb2c4255fe9a888ec0c87fd9e Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Wed, 21 Jul 2021 09:52:06 +0800 Subject: [PATCH] aa --- model/model.go | 14 +++++++------- services/sim.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/model/model.go b/model/model.go index 7082785..93ba4d6 100644 --- a/model/model.go +++ b/model/model.go @@ -164,9 +164,9 @@ type SimFlowExpend struct { CreatedAt *time.Time `json:"created_at" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` LastOperator string `json:"last_operator" db:"last_operator"` - IccID string `json:"iccid" db:"icc_id"` //sim卡iccid - Flow float64 `json:"flow"` //流量数 - FlowUnit string `json:"flowUnit"` //流量单位 + IccID string `json:"iccid" db:"icc_id"` //sim卡iccid + Flow float64 `json:"flow"` //流量数 + FlowUnit string `json:"flowUnit" db:"flow_unit"` //流量单位 } //流量划入 @@ -175,8 +175,8 @@ type SimFlowIncome struct { CreatedAt *time.Time `json:"created_at" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` LastOperator string `json:"last_operator" db:"last_operator"` - IccID string `json:"iccid" db:"icc_id"` //sim卡iccid - Flow float64 `json:"flow"` //流量数 - FlowUnit string `json:"flowUnit"` //流量单位 - IncomeType int `json:"incomeType"` //1 表示系统每月自动划转,2 表示商户自己冲的 + IccID string `json:"iccid" db:"icc_id"` //sim卡iccid + Flow float64 `json:"flow"` //流量数 + FlowUnit string `json:"flowUnit" db:"flow_unit"` //流量单位 + IncomeType int `json:"incomeType" db:"income_type"` //1 表示系统每月自动划转,2 表示商户自己冲的 } diff --git a/services/sim.go b/services/sim.go index b54ef90..c97db9b 100644 --- a/services/sim.go +++ b/services/sim.go @@ -58,14 +58,14 @@ func SimFlowDaySettle() (err error) { flowExpend.Flow, flowExpend.FlowUnit = putils.SplitFlowAndUnit(getCardInfoResult.CardFlow) } } - dao.Insert(db, flowExpend) + err = dao.Insert(db, flowExpend) //算是否超了一个月的流量了 //一个月总的收入流量 - 一个月总的支出流量 <= 0 sumIncome, _ := dao.GetSimFlowIncomeSum(db, v.IccID, monthBegin, monthEnd) sumExpend, _ := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd) if sumExpend.Flow-sumIncome.Flow <= 0 { v.FlowFlag = 1 - dao.Update(db, v, "flow_flag") + err = dao.Update(db, v, "flow_flag") } } }