24 lines
498 B
Go
24 lines
498 B
Go
package res
|
|
|
|
import "encoding/json"
|
|
|
|
type response struct {
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
Uuid string `json:"uuid"`
|
|
Data interface{} `json:"data,omitempty"`
|
|
}
|
|
|
|
func Get_res_string(Code int, Message string, Uuid string, Data ...interface{}) string {
|
|
var res = new(response)
|
|
res.Code = Code
|
|
res.Message = Message
|
|
res.Uuid = Uuid
|
|
res.Data = Data
|
|
res_str, err := json.Marshal(res)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return string(res_str)
|
|
}
|