浏览代码

计算日均值

xyxie 1 年之前
父节点
当前提交
fe45a31104
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      models/edb_data_calculate_rjz.go

+ 1 - 2
models/edb_data_calculate_rjz.go

@@ -287,7 +287,7 @@ func GetRjzFrequencyDays(currDate time.Time, frequency string) (days int, err er
 		} else {
 			// 下旬,多种可能,最大天数可能存在8天,9天,10天,11天,
 			currT := time.Date(currDate.Year(), currDate.Month(), 20, 0, 0, 0, 0, time.Local)
-			nextT := time.Date(currDate.Year(), currDate.Month()+1, 1, 0, 0, 0, 0, time.Local)
+			nextT := time.Date(currDate.Year(), currDate.Month()+1, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
 			days = utils.GetTimeSubDay(currT, nextT)
 		}
 	case "月度":
@@ -331,7 +331,6 @@ func rjzDiv(a float64, b int) string {
 		af := decimal.NewFromFloat(a)
 		bf := decimal.NewFromFloat(float64(b))
 		val, _ := af.Div(bf).Float64()
-		val = val - 1
 		valStr = decimal.NewFromFloat(val).RoundCeil(4).String()
 	} else {
 		valStr = "0"