响应json
(isSuccess bool, msg string, data ...interface{})
| 142 | |
| 143 | //响应json |
| 144 | func (this *BaseController) ResponseJson(isSuccess bool, msg string, data ...interface{}) { |
| 145 | status := 0 |
| 146 | if isSuccess { |
| 147 | status = 1 |
| 148 | } |
| 149 | ret := map[string]interface{}{"status": status, "msg": msg} |
| 150 | if len(data) > 0 { |
| 151 | ret["data"] = data[0] |
| 152 | } |
| 153 | this.Data["json"] = ret |
| 154 | this.ServeJSON() |
| 155 | this.StopRun() |
| 156 | } |
| 157 | |
| 158 | //响应json |
| 159 | func (this *BaseController) Response(data map[string]interface{}) { |
no outgoing calls
no test coverage detected