fix: 修复自定义指标创建时间异常存储错误
This commit is contained in:
@@ -42,11 +42,11 @@ func (k *KpiCReport) Get(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if querys.StartTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) >= ?")
|
||||
conditions = append(conditions, "created_at >= ?")
|
||||
params = append(params, querys.StartTime)
|
||||
}
|
||||
if querys.EndTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) <= ?")
|
||||
conditions = append(conditions, "created_at <= ?")
|
||||
params = append(params, querys.EndTime)
|
||||
}
|
||||
conditions = append(conditions, "kpi_values != 'null'")
|
||||
@@ -109,11 +109,11 @@ func (k *KpiCReport) GetReport2FE(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if querys.StartTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) >= ?")
|
||||
conditions = append(conditions, "created_at >= ?")
|
||||
params = append(params, querys.StartTime)
|
||||
}
|
||||
if querys.EndTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) <= ?")
|
||||
conditions = append(conditions, "created_at <= ?")
|
||||
params = append(params, querys.EndTime)
|
||||
}
|
||||
conditions = append(conditions, "kpi_values != 'null'")
|
||||
@@ -150,8 +150,8 @@ func (k *KpiCReport) GetReport2FE(c *gin.Context) {
|
||||
// 支持的排序字段映射
|
||||
fieldGetters := map[string]func(*KpiCReport) any{
|
||||
"id": func(row *KpiCReport) any { return row.ID },
|
||||
"timeGroup": func(row *KpiCReport) any { return row.CreatedAt.Unix() },
|
||||
"created_at": func(row *KpiCReport) any { return row.CreatedAt.Unix() },
|
||||
"timeGroup": func(row *KpiCReport) any { return row.CreatedAt },
|
||||
"created_at": func(row *KpiCReport) any { return row.CreatedAt },
|
||||
// 可添加更多支持的字段
|
||||
}
|
||||
|
||||
@@ -234,11 +234,11 @@ func (k *KpiCReport) GetTotalList(c *gin.Context) {
|
||||
dbg := dborm.DefaultDB().Table(tableName)
|
||||
|
||||
if querys.StartTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) >= ?")
|
||||
conditions = append(conditions, "created_at >= ?")
|
||||
params = append(params, querys.StartTime)
|
||||
}
|
||||
if querys.EndTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) <= ?")
|
||||
conditions = append(conditions, "created_at <= ?")
|
||||
params = append(params, querys.EndTime)
|
||||
}
|
||||
conditions = append(conditions, "kpi_values != 'null'")
|
||||
@@ -303,11 +303,11 @@ func (k *KpiCReport) Total(c *gin.Context) {
|
||||
dbg := dborm.DefaultDB().Table(tableName)
|
||||
|
||||
if querys.StartTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) >= ?")
|
||||
conditions = append(conditions, "created_at >= ?")
|
||||
params = append(params, querys.StartTime)
|
||||
}
|
||||
if querys.EndTime != "" {
|
||||
conditions = append(conditions, "(UNIX_TIMESTAMP(created_at) * 1000) <= ?")
|
||||
conditions = append(conditions, "created_at <= ?")
|
||||
params = append(params, querys.EndTime)
|
||||
}
|
||||
conditions = append(conditions, "kpi_values != 'null'")
|
||||
|
||||
Reference in New Issue
Block a user