You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
605 B
34 lines
605 B
/**
|
|
* Created by GoLand.
|
|
* User: link1st
|
|
* Date: 2019-07-25
|
|
* Time: 12:11
|
|
*/
|
|
|
|
package common
|
|
|
|
type JsonResult struct {
|
|
Code uint32 `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data interface{} `json:"data"`
|
|
}
|
|
|
|
func Response(code uint32, message string, data interface{}) JsonResult {
|
|
|
|
message = GetErrorMessage(code, message)
|
|
jsonMap := grantMap(code, message, data)
|
|
|
|
return jsonMap
|
|
}
|
|
|
|
// 按照接口格式生成原数据数组
|
|
func grantMap(code uint32, message string, data interface{}) JsonResult {
|
|
|
|
jsonMap := JsonResult{
|
|
Code: code,
|
|
Msg: message,
|
|
Data: data,
|
|
}
|
|
return jsonMap
|
|
}
|