|
|
|
@ -248,13 +248,18 @@ func (w *ResponseWriter) Error(err error) { |
|
|
|
|
if len(message) == 0 { |
|
|
|
|
message = http.StatusText(status) |
|
|
|
|
} |
|
|
|
|
w.Send(status, map[string]any{"code": code, "message": message}) |
|
|
|
|
w.Send(status, map[string]any{ |
|
|
|
|
"code": code, |
|
|
|
|
"message": message, |
|
|
|
|
"success": code == 0, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (w *ResponseWriter) Ok(data any, message ...string) { |
|
|
|
|
info := map[string]any{ |
|
|
|
|
"code": 0, |
|
|
|
|
"message": "ok", |
|
|
|
|
"success": true, |
|
|
|
|
"data": data, |
|
|
|
|
} |
|
|
|
|
if len(message) > 0 { |
|
|
|
|