change xorm.io
This commit is contained in:
parent
1c9190e98f
commit
11e3c96d66
@ -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
17
response/json.go
Normal 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,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user