package controller

import (
	"github.com/astaxie/beego"
)

type Response struct {
	Errcode int    `json:"errCode"`
	Msg     string `json:"msg"`
}

type ObjectResp struct {
	Response
	Data interface{} `json:"data"`
}

func TxObjectResponse(o beego.Controller, i interface{}) {
	o.Data["json"] = ObjectResp{Response: Response{Errcode: 0, Msg: "操作成功"}, Data: i}
	o.ServeJSON()
}
func ErrResponse(o beego.Controller, i interface{}) {
	o.Data["json"] = ObjectResp{Response: Response{Errcode: 1001, Msg: "操作失败"}, Data: i}
	o.ServeJSON()
}
