响应json
(isSuccess bool, msg string, data ...interface{})
| 132 | |
| 133 | //响应json |
| 134 | func (this *BaseController) ResponseJson(isSuccess bool, msg string, data ...interface{}) { |
| 135 | status := 0 |
| 136 | if isSuccess { |
| 137 | status = 1 |
| 138 | } |
| 139 | ret := map[string]interface{}{"status": status, "msg": msg} |
| 140 | if len(data) > 0 { |
| 141 | ret["data"] = data[0] |
| 142 | } |
| 143 | this.Data["json"] = ret |
| 144 | this.ServeJSON() |
| 145 | this.StopRun() |
| 146 | } |
| 147 | |
| 148 | //单页 |
| 149 | func (this *BaseController) Pages() { |
no outgoing calls
no test coverage detected