Files
servicebase/pkg/dto/response/Response.go
2025-11-19 14:24:13 +08:00

33 lines
584 B
Go

package response
import (
"encoding/json"
)
const (
NeedLogin = "6018" // 登陆过期
)
type Response struct {
Code string
Result interface{}
Msg string
}
func Fail(msg string) BaseResponse {
response := BaseResponse{Code: ErrorCode, Msg: msg}
return response
}
func Invalid() string {
response := BaseResponse{Code: NeedLogin, Msg: "用户身份已过期,请重新登录!"}
str, _ := json.Marshal(response)
return string(str)
}
func Success(Result interface{}) BaseResponse {
response := BaseResponse{Code: SuccessCode, Result: Result}
return response
}