Skip to content

Commit

Permalink
调整:改用dateTime类型
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Dec 10, 2023
1 parent aafebb5 commit 091d8ef
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/apiResponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package core

import (
"encoding/json"
"github.com/farseer-go/fs/dateTime"
"io"
"time"
)

// ApiResponse 标准的API Response结构
Expand All @@ -15,7 +15,7 @@ type ApiResponse[TData any] struct {
// 返回消息内容
StatusMessage string
// 接口返回时间
ServerAt time.Time
ServerAt dateTime.DateTime
// 耗时
ElapsedMilliseconds int64
// 链路追踪ID
Expand All @@ -27,7 +27,7 @@ type ApiResponse[TData any] struct {
// SetData 设置Data字段的值
func (receiver *ApiResponse[TData]) SetData(data TData) {
receiver.Data = data
receiver.ServerAt = time.Now()
receiver.ServerAt = dateTime.Now()
}

// ToJson 转成Json
Expand All @@ -49,7 +49,7 @@ func Success[TData any](statusMessage string, data TData) ApiResponse[TData] {
StatusMessage: statusMessage,
StatusCode: 200,
Data: data,
ServerAt: time.Now(),
ServerAt: dateTime.Now(),
}
}

Expand All @@ -59,7 +59,7 @@ func Error[TData any](statusMessage string, statusCode int) ApiResponse[TData] {
Status: false,
StatusMessage: statusMessage,
StatusCode: statusCode,
ServerAt: time.Now(),
ServerAt: dateTime.Now(),
}
}

Expand All @@ -69,7 +69,7 @@ func Error403[TData any](statusMessage string) ApiResponse[TData] {
Status: false,
StatusMessage: statusMessage,
StatusCode: 403,
ServerAt: time.Now(),
ServerAt: dateTime.Now(),
}
}

Expand Down

0 comments on commit 091d8ef

Please sign in to comment.