change xorm.io

This commit is contained in:
liangzy 2020-07-09 15:01:25 +08:00
parent 1c9190e98f
commit 11e3c96d66
2 changed files with 24 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package mvc
import (
"github.com/astaxie/beego"
"golib.gaore.com/GaoreGo/beegoinit/response"
"strings"
)
@ -24,7 +25,12 @@ func (this *BaseController) Prepare() {
}
func (this *BaseController) RespJson(status bool, code int, msg string, data interface{}) {
this.Data["json"] = &map[string]interface{}{"status": status, "code": code, "msg": msg, "data": data}
this.Data["json"] = &response.Json{
Code: code,
Data: data,
Msg: msg,
Status: status,
}
this.ServeJSON()
}

17
response/json.go Normal file
View File

@ -0,0 +1,17 @@
package response
type Json struct {
Code int `json:"code"`
Data interface{} `json:"data"`
Msg string `json:"msg"`
Status bool `json:"status"`
}
func GetDefaultJsonResponse() *Json {
return &Json{
Code: 0,
Data: nil,
Msg: "ok",
Status: true,
}
}