fix: 查询UPF总流量时间改为时间戳避免时间转换时区问题
This commit is contained in:
@@ -46,12 +46,11 @@ func (r *PerfKPIImpl) SelectGoldKPITitle(neType string) []model.GoldKPITitle {
|
||||
|
||||
// SelectUPFTotalFlow 查询UPF总流量 N3上行 N6下行
|
||||
func (r *PerfKPIImpl) SelectUPFTotalFlow(neType, rmUID string, day int) map[string]any {
|
||||
// 获取当前日期
|
||||
now := time.Now()
|
||||
endDate := now.Format("2006-01-02")
|
||||
// 获取当前日期
|
||||
endDate := fmt.Sprint(now.UnixMilli())
|
||||
// 将当前日期前几天数
|
||||
afterDays := now.AddDate(0, 0, -day)
|
||||
startDate := afterDays.Format("2006-01-02")
|
||||
startDate := fmt.Sprint(now.AddDate(0, 0, -day).Truncate(24 * time.Hour).UnixMilli())
|
||||
|
||||
var info map[string]any
|
||||
|
||||
@@ -61,14 +60,18 @@ func (r *PerfKPIImpl) SelectUPFTotalFlow(neType, rmUID string, day int) map[stri
|
||||
if infoStr != "" {
|
||||
json.Unmarshal([]byte(infoStr), &info)
|
||||
expireSecond, _ := redis.GetExpire("", key)
|
||||
expireMinute := (time.Duration(int64(expireSecond)) * time.Second)
|
||||
if expireMinute > 2*time.Minute {
|
||||
if expireSecond > 120 {
|
||||
return info
|
||||
}
|
||||
}
|
||||
|
||||
//info = r.perfKPIRepository.SelectUPFTotalFlow(neType, rmUID, startDate, endDate)
|
||||
info = r.perfKPIRepository.SelectUPFThroughput(neType, rmUID, startDate, endDate)
|
||||
info = r.perfKPIRepository.SelectUPFTotalFlow(neType, rmUID, startDate, endDate)
|
||||
if v, ok := info["up"]; ok && v == nil {
|
||||
info["up"] = 0
|
||||
}
|
||||
if v, ok := info["down"]; ok && v == nil {
|
||||
info["down"] = 0
|
||||
}
|
||||
|
||||
// 保存到缓存
|
||||
infoJSON, _ := json.Marshal(info)
|
||||
|
||||
Reference in New Issue
Block a user