...
|
...
|
@@ -72,13 +72,24 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int |
|
|
if data == nil {
|
|
|
data = []interface{}{}
|
|
|
}
|
|
|
// controller.Data["json"] = protocol.ResponseData{
|
|
|
// Code: 0,
|
|
|
// Msg: "ok",
|
|
|
// Data: map[string]map[string]interface{}{
|
|
|
// "gridResult": map[string]interface{}{
|
|
|
// "lists": data,
|
|
|
// "totalRow": totalRow,
|
|
|
// "pageNumber": pageNumber,
|
|
|
// },
|
|
|
// },
|
|
|
// }
|
|
|
controller.Data["json"] = protocol.ResponseData{
|
|
|
Code: 0,
|
|
|
Msg: "ok",
|
|
|
Data: map[string]map[string]interface{}{
|
|
|
"gridResult": map[string]interface{}{
|
|
|
"lists": data,
|
|
|
"totalRow": totalRow,
|
|
|
"grid": {
|
|
|
"list": data,
|
|
|
"total": totalRow,
|
|
|
"pageNumber": pageNumber,
|
|
|
},
|
|
|
},
|
...
|
...
|
@@ -86,7 +97,7 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int |
|
|
controller.ServeJSON()
|
|
|
}
|
|
|
|
|
|
//Finish 重写 beego.Controller 的Finish 方法
|
|
|
// Finish 重写 beego.Controller 的Finish 方法
|
|
|
func (controller *BaseController) Finish() {
|
|
|
strByte, _ := json.Marshal(controller.Data["json"])
|
|
|
length := len(strByte)
|
...
|
...
|
@@ -97,7 +108,7 @@ func (controller *BaseController) Finish() { |
|
|
}
|
|
|
}
|
|
|
|
|
|
////Prepare 重写 beego.Controller 的Prepare方法
|
|
|
// //Prepare 重写 beego.Controller 的Prepare方法
|
|
|
func (controller *BaseController) Prepare() {
|
|
|
logs.Info("====>Recv Request:", controller.Ctx.Input.URI())
|
|
|
if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() {
|
...
|
...
|
|