feat(app): update
This commit is contained in:
32
pkg/dto/response/Response.go
Normal file
32
pkg/dto/response/Response.go
Normal file
@ -0,0 +1,32 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user