This commit is contained in:
苏尹岚
2021-01-08 16:10:12 +08:00
parent cf9c58799c
commit d6021c6f28

View File

@@ -1,6 +1,7 @@
package dao
import (
"math"
"time"
"git.rosy.net.cn/baseapi/utils"
@@ -408,7 +409,9 @@ func getWhereSqlManage(cityCodes []int, jobTime, endTime time.Time, jobIDs []int
func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs []int) (getManageStatisticsResult *GetManageStatisticsResult, err error) {
endTime := jobTime.AddDate(0, 0, 1)
sqlParams := []interface{}{}
getManageStatisticsResult = &GetManageStatisticsResult{}
getManageStatisticsResult = &GetManageStatisticsResult{
Date: jobTime,
}
sql := `
SELECT t1.count accept_count, t2.count finish_count, t3.count cancel_count, t4.browse_count, t6.total_cash
FROM
@@ -452,11 +455,10 @@ func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs [
)t6
`
err = GetRow(db, &getManageStatisticsResult, sql, sqlParams)
getManageStatisticsResult.Date = jobTime
if getManageStatisticsResult.BrowseCount == 0 {
getManageStatisticsResult.InversionRate = 0
} else {
getManageStatisticsResult.InversionRate = float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount)
getManageStatisticsResult.InversionRate = math.Round(float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount))
}
return getManageStatisticsResult, err
}