29 lines
623 B
Go
29 lines
623 B
Go
|
|
package model
|
||
|
|
|
||
|
|
// CommonResponse 公共请求结果对象
|
||
|
|
type CommonResponse struct {
|
||
|
|
// 错误码
|
||
|
|
Code ResultStatus `json:"code"`
|
||
|
|
|
||
|
|
// 错误提示信息
|
||
|
|
Message string `json:"message"`
|
||
|
|
|
||
|
|
// 服务器生成的请求Id
|
||
|
|
RequestId string `json:"requestId"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// IsSuccess 请求结果是否成功
|
||
|
|
func (this *CommonResponse) IsSuccess() bool {
|
||
|
|
return this.Code == Success
|
||
|
|
}
|
||
|
|
|
||
|
|
// IsFailure 请求结果是否失败
|
||
|
|
func (this *CommonResponse) IsFailure() bool {
|
||
|
|
return this.Code != Success
|
||
|
|
}
|
||
|
|
|
||
|
|
// HasMessage 请求结果是否有信息
|
||
|
|
func (this *CommonResponse) HaveNoMessage() bool {
|
||
|
|
return this.Code == NoMessage
|
||
|
|
}
|