作者 tangxvhui

调整列表输出

@@ -72,13 +72,24 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int @@ -72,13 +72,24 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int
72 if data == nil { 72 if data == nil {
73 data = []interface{}{} 73 data = []interface{}{}
74 } 74 }
  75 + // controller.Data["json"] = protocol.ResponseData{
  76 + // Code: 0,
  77 + // Msg: "ok",
  78 + // Data: map[string]map[string]interface{}{
  79 + // "gridResult": map[string]interface{}{
  80 + // "lists": data,
  81 + // "totalRow": totalRow,
  82 + // "pageNumber": pageNumber,
  83 + // },
  84 + // },
  85 + // }
75 controller.Data["json"] = protocol.ResponseData{ 86 controller.Data["json"] = protocol.ResponseData{
76 Code: 0, 87 Code: 0,
77 Msg: "ok", 88 Msg: "ok",
78 Data: map[string]map[string]interface{}{ 89 Data: map[string]map[string]interface{}{
79 - "gridResult": map[string]interface{}{  
80 - "lists": data,  
81 - "totalRow": totalRow, 90 + "grid": {
  91 + "list": data,
  92 + "total": totalRow,
82 "pageNumber": pageNumber, 93 "pageNumber": pageNumber,
83 }, 94 },
84 }, 95 },
@@ -86,7 +97,7 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int @@ -86,7 +97,7 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int
86 controller.ServeJSON() 97 controller.ServeJSON()
87 } 98 }
88 99
89 -//Finish 重写 beego.Controller 的Finish 方法 100 +// Finish 重写 beego.Controller 的Finish 方法
90 func (controller *BaseController) Finish() { 101 func (controller *BaseController) Finish() {
91 strByte, _ := json.Marshal(controller.Data["json"]) 102 strByte, _ := json.Marshal(controller.Data["json"])
92 length := len(strByte) 103 length := len(strByte)
@@ -97,7 +108,7 @@ func (controller *BaseController) Finish() { @@ -97,7 +108,7 @@ func (controller *BaseController) Finish() {
97 } 108 }
98 } 109 }
99 110
100 -////Prepare 重写 beego.Controller 的Prepare方法 111 +// //Prepare 重写 beego.Controller 的Prepare方法
101 func (controller *BaseController) Prepare() { 112 func (controller *BaseController) Prepare() {
102 logs.Info("====>Recv Request:", controller.Ctx.Input.URI()) 113 logs.Info("====>Recv Request:", controller.Ctx.Input.URI())
103 if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() { 114 if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() {