feat 结构调整
This commit is contained in:
22
Server/common/net/http/http_resp/response.go
Normal file
22
Server/common/net/http/http_resp/response.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package http_resp
|
||||
|
||||
type RespJsonData struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func Success(data interface{}) *RespJsonData {
|
||||
return &RespJsonData{
|
||||
Code: OK.Code(),
|
||||
Msg: OK.Error(),
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
func Error(code int, message string) *RespJsonData {
|
||||
return &RespJsonData{
|
||||
Code: code,
|
||||
Msg: message,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user