aa
This commit is contained in:
@@ -7,14 +7,20 @@ import (
|
|||||||
"time"
|
"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) {
|
func GetSimFlowExpend(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd time.Time) (simFlowExpnd []*model.SimFlowExpend, err error) {
|
||||||
|
|
||||||
return simFlowExpnd, err
|
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 (
|
var (
|
||||||
simFlowExpnds []*model.SimFlowExpend
|
simFlowExpnds []*FlowSum
|
||||||
)
|
)
|
||||||
sql := `
|
sql := `
|
||||||
SELECT SUM(
|
SELECT SUM(
|
||||||
@@ -47,9 +53,9 @@ func GetSimFlowExpendSum(db *sqlx.DB, iccid string, createdAtBegin, createdAtEnd
|
|||||||
return simFlowExpnd, err
|
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 (
|
var (
|
||||||
simFlowIncomes []*model.SimFlowIncome
|
simFlowIncomes []*FlowSum
|
||||||
)
|
)
|
||||||
sql := `
|
sql := `
|
||||||
SELECT SUM(
|
SELECT SUM(
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package services
|
package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tibiotapi"
|
"git.rosy.net.cn/baseapi/platformapi/tibiotapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-print/dao"
|
"git.rosy.net.cn/jx-print/dao"
|
||||||
@@ -51,7 +50,6 @@ func SimFlowDaySettle() (err error) {
|
|||||||
//api.TibiotAPI.BatchQueryCardInfo(1)
|
//api.TibiotAPI.BatchQueryCardInfo(1)
|
||||||
} else {
|
} else {
|
||||||
sumExpend, _ := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd)
|
sumExpend, _ := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd)
|
||||||
fmt.Println("qqqqqqqqqqqqqqqqqqqqqqqqq", utils.Format4Output(sumExpend, true))
|
|
||||||
cardFlow := putils.Flow2KB(putils.SplitFlowAndUnit(getCardInfoResultMonth.CardFlow))
|
cardFlow := putils.Flow2KB(putils.SplitFlowAndUnit(getCardInfoResultMonth.CardFlow))
|
||||||
flowExpend.Flow, flowExpend.FlowUnit = putils.FlowKB2Other(cardFlow - sumExpend.Flow)
|
flowExpend.Flow, flowExpend.FlowUnit = putils.FlowKB2Other(cardFlow - sumExpend.Flow)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user