forked from free-lancers/electricity_bill_calc_service
feat(user):完成用户部分所有接口的迁移。
This commit is contained in:
@@ -61,7 +61,7 @@ func (r Result) UnableToParse(msg string) error {
|
||||
|
||||
// 用户未获得授权)响应
|
||||
func (r *Result) Unauthorized(msg string) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusUnauthorized, msg)
|
||||
return r.response(fiber.StatusUnauthorized, fiber.StatusUnauthorized, msg)
|
||||
}
|
||||
|
||||
// 简易操作成功信息
|
||||
@@ -71,37 +71,37 @@ func (r *Result) Success(msg string, payloads ...map[string]interface{}) error {
|
||||
|
||||
// 数据成功创建
|
||||
func (r Result) Created(msg string, payloads ...map[string]interface{}) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusCreated, msg, payloads...)
|
||||
return r.response(fiber.StatusCreated, fiber.StatusCreated, msg, payloads...)
|
||||
}
|
||||
|
||||
// 数据成功更新
|
||||
func (r Result) Updated(msg string) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusAccepted, msg)
|
||||
func (r Result) Updated(msg string, payloads ...map[string]interface{}) error {
|
||||
return r.response(fiber.StatusAccepted, fiber.StatusAccepted, msg, payloads...)
|
||||
}
|
||||
|
||||
// 数据已成功删除
|
||||
func (r Result) Deleted(msg string) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusNoContent, msg)
|
||||
return r.response(fiber.StatusNoContent, fiber.StatusNoContent, msg)
|
||||
}
|
||||
|
||||
// 指定操作未被接受
|
||||
func (r Result) BadRequest(msg string) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusBadRequest, msg)
|
||||
return r.response(fiber.StatusBadRequest, fiber.StatusBadRequest, msg)
|
||||
}
|
||||
|
||||
// 指定操作未被接受
|
||||
func (r Result) NotAccept(msg string) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusNotAcceptable, msg)
|
||||
return r.response(fiber.StatusNotAcceptable, fiber.StatusNotAcceptable, msg)
|
||||
}
|
||||
|
||||
// 数据未找到
|
||||
func (r Result) NotFound(msg string) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusNotFound, msg)
|
||||
return r.response(fiber.StatusNotFound, fiber.StatusNotFound, msg)
|
||||
}
|
||||
|
||||
// 数据存在冲突
|
||||
func (r Result) Conflict(msg string) error {
|
||||
return r.response(fiber.StatusOK, fiber.StatusConflict, msg)
|
||||
return r.response(fiber.StatusConflict, fiber.StatusConflict, msg)
|
||||
}
|
||||
|
||||
// 快速自由JSON格式响应
|
||||
|
Reference in New Issue
Block a user