This commit is contained in:
suyl
2021-07-21 18:56:27 +08:00
parent e813ceaf48
commit a6cdea6610
2 changed files with 11 additions and 13 deletions

View File

@@ -23,14 +23,14 @@ func AddApp(c *gin.Context, code, name, mobile, userID string) (err error) {
db = globals.GetDB() db = globals.GetDB()
now = time.Now() now = time.Now()
) )
if rcode := putils.GetKey(mobile); rcode == "" { //if rcode := putils.GetKey(mobile); rcode == "" {
putils.DelKey(mobile) // putils.DelKey(mobile)
return fmt.Errorf("验证码错误!") // return fmt.Errorf("验证码错误!")
} else if code != rcode { //} else if code != rcode {
putils.DelKey(mobile) // putils.DelKey(mobile)
return fmt.Errorf("验证码错误!") // return fmt.Errorf("验证码错误!")
} //}
putils.DelKey(mobile) //putils.DelKey(mobile)
if apps, _ := dao.GetApps(db, 0, userID, ""); len(apps) > 2 { if apps, _ := dao.GetApps(db, 0, userID, ""); len(apps) > 2 {
return fmt.Errorf("同一个账号最多只能建3个app") return fmt.Errorf("同一个账号最多只能建3个app")

View File

@@ -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"
@@ -53,9 +52,6 @@ func SimFlowDaySettle() (err error) {
if sumExpend, err := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd); err == nil { if sumExpend, err := dao.GetSimFlowExpendSum(db, v.IccID, monthBegin, monthEnd); err == nil {
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)
if flowExpend.Flow < 0 {
err = fmt.Errorf("流量计算有问题!")
}
} }
} }
} }
@@ -63,7 +59,9 @@ func SimFlowDaySettle() (err error) {
flowExpend.Flow, flowExpend.FlowUnit = putils.SplitFlowAndUnit(getCardInfoResult.CardFlow) flowExpend.Flow, flowExpend.FlowUnit = putils.SplitFlowAndUnit(getCardInfoResult.CardFlow)
} }
} }
err = dao.Insert(db, flowExpend) if flowExpend.Flow > 0 && flowExpend.FlowUnit != "" {
err = dao.Insert(db, flowExpend)
}
//算是否超了一个月的流量了 //算是否超了一个月的流量了
//一个月总的收入流量 - 一个月总的支出流量 <= 0 //一个月总的收入流量 - 一个月总的支出流量 <= 0
sumIncome, _ := dao.GetSimFlowIncomeSum(db, v.IccID, monthBegin, monthEnd) sumIncome, _ := dao.GetSimFlowIncomeSum(db, v.IccID, monthBegin, monthEnd)