响应数据耗时使用float64

This commit is contained in:
白茶清欢 2022-07-15 00:05:26 +08:00
parent 53b9196970
commit 2a49316904

View File

@ -38,7 +38,7 @@ func Send(ctx *gin.Context, code interface{}, httpCode int, data interface{}) {
define.ResponseTraceIDField: ctx.GetString(define.TraceIDField),
define.ResponseRequestIDField: ctx.GetString(define.RequestIDField),
define.ResponseDataField: data,
define.HandleRequestCostField: (time.Now().UnixNano() - ctx.GetInt64(define.StartRequestTimeField)) / 1e9,
define.HandleRequestCostField: float64(time.Now().UnixNano()-ctx.GetInt64(define.StartRequestTimeField)) / 1e9,
}
responseException := exception.New(code, httpCode, responseData)
ctx.JSON(responseException.GetHttpCode(), responseException.GetData())