This commit is contained in:
suyl
2021-07-21 14:00:05 +08:00
parent 1e9ddfd5fb
commit 474d35b7e0
2 changed files with 10 additions and 6 deletions

View File

@@ -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(