2023-02-27 18:21:41 +08:00
|
|
|
package apiresp
|
|
|
|
|
|
|
|
|
|
type ApiResponse struct {
|
|
|
|
|
ErrCode int `json:"errCode"`
|
|
|
|
|
ErrMsg string `json:"errMsg"`
|
|
|
|
|
ErrDlt string `json:"errDlt"`
|
|
|
|
|
Data any `json:"data"`
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-03 18:42:33 +08:00
|
|
|
func apiSuccess(data any) *ApiResponse {
|
2023-02-27 18:21:41 +08:00
|
|
|
return &ApiResponse{
|
|
|
|
|
Data: data,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-03 18:42:33 +08:00
|
|
|
func apiError(err error) *ApiResponse {
|
2023-03-03 18:14:48 +08:00
|
|
|
return &ApiResponse{ErrCode: 10000, ErrMsg: err.Error()}
|
2023-02-27 18:21:41 +08:00
|
|
|
}
|