This commit is contained in:
@@ -31,7 +31,7 @@ func (r *Response) Success(data interface{}) {
|
||||
}
|
||||
|
||||
// 失败 统一处理
|
||||
func (r *Response) Error(code int32, msg string) {
|
||||
func (r *Response) Error(code int, msg string) {
|
||||
res := serializer.Response{
|
||||
Code: code,
|
||||
Msg: msg,
|
||||
@@ -45,15 +45,11 @@ func (r *Response) Error(code int32, msg string) {
|
||||
}
|
||||
|
||||
// 参数类型错误
|
||||
func (r *Response) ErrInvalidParamType() (err error) {
|
||||
res := serializer.Response{
|
||||
Code: http.StatusBadRequest,
|
||||
Msg: "参数类型错误",
|
||||
Data: nil,
|
||||
}
|
||||
_, err = r.Ctx.JSON(res)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
func (r *Response) ErrBadRequest() {
|
||||
r.Error(http.StatusBadRequest, "请求参数错误")
|
||||
}
|
||||
|
||||
// 未登录/未授权错误
|
||||
func (r *Response) ErrUnauthorized() {
|
||||
r.Error(http.StatusUnauthorized, "未登录")
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"drive-linked/pkg/model"
|
||||
"drive-linked/model"
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ type UserProfile struct {
|
||||
Roles string `json:"roles"`
|
||||
}
|
||||
|
||||
type QueryUser struct {
|
||||
type QueryUserParams struct {
|
||||
Method string `json:"method"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user