修改状态码
This commit is contained in:
parent
b8790b7f79
commit
ab9df9bc42
|
@ -35,7 +35,7 @@ func (l *GetTypeLogic) GetType(req *types.Request) (resp *types.Response) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.SetStatus(basic.StatusOK, "success", data)
|
resp.SetStatus(basic.CodeOK, "success", data)
|
||||||
|
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,6 @@ func (l *UserBasicInfoLogic) UserBasicInfo(req *types.Request, userinfo *auth.Us
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.SetStatus(basic.StatusOK, fsUserModel)
|
resp.SetStatus(basic.CodeOK, fsUserModel)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,10 @@ func (l *UserFontsLogic) UserFonts(req *types.Request) (resp *types.Response) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// panic(err)
|
// panic(err)
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
resp.SetStatus(basic.StatusOK, data)
|
resp.SetStatus(basic.CodeOK, data)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.SetStatus(basic.StatusOK)
|
resp.SetStatus(basic.CodeOK)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,12 +44,12 @@ func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin) (resp *types.Res
|
||||||
// log.Printf("%t %t %v", err, model.ErrNotFound, err == model.ErrNotFound)
|
// log.Printf("%t %t %v", err, model.ErrNotFound, err == model.ErrNotFound)
|
||||||
if err == model.ErrNotFound {
|
if err == model.ErrNotFound {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
resp.SetStatusWithMessage(basic.DefaultError, err.Error())
|
resp.SetStatusWithMessage(basic.CodeServiceErr, err.Error())
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
data := &types.DataUserLogin{
|
data := &types.DataUserLogin{
|
||||||
Token: userModel.PasswordResetToken.String,
|
Token: userModel.PasswordResetToken.String,
|
||||||
}
|
}
|
||||||
resp.SetStatus(basic.StatusOK, data)
|
resp.SetStatus(basic.CodeOK, data)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,6 @@ func (l *UserSaveBasicInfoLogic) UserSaveBasicInfo(req *types.RequestBasicInfoFo
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.SetStatus(basic.StatusOK, fsUserModel)
|
resp.SetStatus(basic.CodeOK, fsUserModel)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ type StatusResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
StatusOK = &StatusResponse{200, "success"} // 成功
|
CodeOK = &StatusResponse{200, "success"} // 成功
|
||||||
DefaultError = &StatusResponse{510, "unknown error"} // 错误
|
CodeServiceErr = &StatusResponse{510, "unknown error"} // 错误
|
||||||
|
CodeUnAuth = &StatusResponse{401, "unauthorized"} // 未授权
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user