diff --git a/gin/util/responsed.go b/gin/util/responsed.go index 9fbb27c..bfe0065 100644 --- a/gin/util/responsed.go +++ b/gin/util/responsed.go @@ -27,7 +27,7 @@ func Response(ctx *gin.Context, code interface{}, message string, data interface "message": message, "data": data, "trace_id": ctx.GetString("trace_id"), - "cost": time.Since(time.Unix(ctx.GetInt64("start_time"), 0)).Milliseconds(), + "cost": time.Now().UnixMilli() - ctx.GetInt64("start_time"), } ctx.JSON(http.StatusOK, responseData) }