feat(response):增加新的用于表示用户未获得授权的响应方法。

This commit is contained in:
徐涛
2022-08-16 06:19:32 +08:00
parent 272847446d
commit 0bc2fd3152
3 changed files with 20 additions and 12 deletions

View File

@@ -42,6 +42,14 @@ func (r *Result) Error(code int, msg string) {
r.Ctx.JSON(http.StatusOK, res)
}
// 用户未获得授权)响应
func (r *Result) Unauthorized(msg string) {
res := BaseResponse{}
res.Code = http.StatusUnauthorized
res.Message = msg
r.Ctx.JSON(http.StatusOK, res)
}
// 简易操作成功信息
func (r *Result) Success(msg string) {
res := BaseResponse{}