This commit is contained in:
苏尹岚
2021-01-08 16:16:18 +08:00
parent d6021c6f28
commit a7d1ef9e70

View File

@@ -409,9 +409,6 @@ 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{
Date: jobTime,
}
sql := `
SELECT t1.count accept_count, t2.count finish_count, t3.count cancel_count, t4.browse_count, t6.total_cash
FROM
@@ -455,12 +452,19 @@ func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs [
)t6
`
err = GetRow(db, &getManageStatisticsResult, sql, sqlParams)
if getManageStatisticsResult.BrowseCount == 0 {
getManageStatisticsResult.InversionRate = 0
if getManageStatisticsResult == nil {
return &GetManageStatisticsResult{
Date: jobTime,
}, err
} else {
getManageStatisticsResult.InversionRate = math.Round(float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount))
getManageStatisticsResult.Date = jobTime
if getManageStatisticsResult.BrowseCount == 0 {
getManageStatisticsResult.InversionRate = 0
} else {
getManageStatisticsResult.InversionRate = math.Round(float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount))
}
return getManageStatisticsResult, err
}
return getManageStatisticsResult, err
}
type GetManageStatisticsJobResult struct {