forked from free-lancers/electricity_bill_calc_service
		
	enhance(response):调整基础响应构建功能。
This commit is contained in:
		| @@ -15,6 +15,12 @@ type BaseResponse struct { | ||||
| 	Message string `json:"message"` | ||||
| } | ||||
|  | ||||
| type PagedResponse struct { | ||||
| 	Page  int `json:"page"` | ||||
| 	Size  int `json:"pageSize"` | ||||
| 	Total int `json:"total"` | ||||
| } | ||||
|  | ||||
| func NewResult(ctx *gin.Context) *Result { | ||||
| 	return &Result{Ctx: ctx} | ||||
| } | ||||
| @@ -77,7 +83,7 @@ func (r *Result) NotFound(msg string) { | ||||
|  | ||||
| // 快速自由JSON格式响应 | ||||
| // ! 注意,给定的map中,同名的键会被覆盖。 | ||||
| func (r *Result) QuickJson(status, code int, msg string, payloads ...map[string]interface{}) { | ||||
| func (r *Result) Json(status, code int, msg string, payloads ...map[string]interface{}) { | ||||
| 	var finalPayload = make(map[string]interface{}, 0) | ||||
| 	finalPayload["code"] = code | ||||
| 	finalPayload["message"] = &msg | ||||
|   | ||||
		Reference in New Issue
	
	Block a user