aa
This commit is contained in:
@@ -164,9 +164,9 @@ type SimFlowExpend struct {
|
|||||||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||||||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||||||
LastOperator string `json:"last_operator" db:"last_operator"`
|
LastOperator string `json:"last_operator" db:"last_operator"`
|
||||||
IccID string `json:"iccid" db:"icc_id"` //sim卡iccid
|
IccID string `json:"iccid" db:"icc_id"` //sim卡iccid
|
||||||
Flow float64 `json:"flow"` //流量数
|
Flow float64 `json:"flow"` //流量数
|
||||||
FlowUnit string `json:"flowUnit"` //流量单位
|
FlowUnit string `json:"flowUnit" db:"flow_unit"` //流量单位
|
||||||
}
|
}
|
||||||
|
|
||||||
//流量划入
|
//流量划入
|
||||||
@@ -175,8 +175,8 @@ type SimFlowIncome struct {
|
|||||||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||||||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||||||
LastOperator string `json:"last_operator" db:"last_operator"`
|
LastOperator string `json:"last_operator" db:"last_operator"`
|
||||||
IccID string `json:"iccid" db:"icc_id"` //sim卡iccid
|
IccID string `json:"iccid" db:"icc_id"` //sim卡iccid
|
||||||
Flow float64 `json:"flow"` //流量数
|
Flow float64 `json:"flow"` //流量数
|
||||||
FlowUnit string `json:"flowUnit"` //流量单位
|
FlowUnit string `json:"flowUnit" db:"flow_unit"` //流量单位
|
||||||
IncomeType int `json:"incomeType"` //1 表示系统每月自动划转,2 表示商户自己冲的
|
IncomeType int `json:"incomeType" db:"income_type"` //1 表示系统每月自动划转,2 表示商户自己冲的
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ func SimFlowDaySettle() (err error) {
|
|||||||
flowExpend.Flow, flowExpend.FlowUnit = putils.SplitFlowAndUnit(getCardInfoResult.CardFlow)
|
flowExpend.Flow, flowExpend.FlowUnit = putils.SplitFlowAndUnit(getCardInfoResult.CardFlow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dao.Insert(db, flowExpend)
|
err = dao.Insert(db, flowExpend)
|
||||||
//算是否超了一个月的流量了
|
//算是否超了一个月的流量了
|
||||||
//一个月总的收入流量 - 一个月总的支出流量 <= 0
|
//一个月总的收入流量 - 一个月总的支出流量 <= 0
|
||||||
sumIncome, _ := dao.GetSimFlowIncomeSum(db, v.IccID, monthBegin, monthEnd)
|
sumIncome, _ := dao.GetSimFlowIncomeSum(db, v.IccID, monthBegin, monthEnd)
|
||||||
sumExpend, _ := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd)
|
sumExpend, _ := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd)
|
||||||
if sumExpend.Flow-sumIncome.Flow <= 0 {
|
if sumExpend.Flow-sumIncome.Flow <= 0 {
|
||||||
v.FlowFlag = 1
|
v.FlowFlag = 1
|
||||||
dao.Update(db, v, "flow_flag")
|
err = dao.Update(db, v, "flow_flag")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user