From bbf2849a196bb7cd5ae1145ebdd550fe014841eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 8 Jan 2021 16:29:39 +0800 Subject: [PATCH] aa --- business/model/dao/dao_order.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index dc5f27206..18c1eef62 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -1,7 +1,6 @@ package dao import ( - "math" "time" "git.rosy.net.cn/baseapi/utils" @@ -451,14 +450,18 @@ func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs [ WHERE a.id = t5.id )t6 ` - err = GetRow(db, &getManageStatisticsResult, sql, sqlParams) + GetRow(db, &getManageStatisticsResult, sql, sqlParams) if getManageStatisticsResult == nil { return &GetManageStatisticsResult{ Date: jobTime, }, err } else { getManageStatisticsResult.Date = jobTime - getManageStatisticsResult.InversionRate = math.Round(float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount)) + if getManageStatisticsResult.BrowseCount == 0 { + getManageStatisticsResult.InversionRate = 0 + } else { + getManageStatisticsResult.InversionRate = float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount) + } return getManageStatisticsResult, err } }