完成用户名更新,粉丝数获取的基础功能
This commit is contained in:
15
pkg/exception/base.go
Normal file
15
pkg/exception/base.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package exception
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type BaseError struct {
|
||||
Code int
|
||||
Msg string
|
||||
ShortMsg string
|
||||
}
|
||||
|
||||
func (err BaseError) Error() string {
|
||||
return fmt.Sprintf("%d - 错误: %s - 原因:%s", err.Code, err.ShortMsg, err.Msg)
|
||||
}
|
||||
26
pkg/exception/business.go
Normal file
26
pkg/exception/business.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package exception
|
||||
|
||||
func InternalError(msg string) BaseError {
|
||||
shortMsg := "系统异常,请联系管理员"
|
||||
return BaseError{Code: 500, Msg: msg, ShortMsg: shortMsg}
|
||||
}
|
||||
|
||||
func ErrFetchUserInfo(msg string) BaseError {
|
||||
shortMsg := "用户信息获取失败"
|
||||
return BaseError{Code: 5001, Msg: msg, ShortMsg: shortMsg}
|
||||
}
|
||||
|
||||
func ErrFetchFurries(msg string) BaseError {
|
||||
shortMsg := "获取Furry列表失败"
|
||||
return BaseError{Code: 5002, Msg: msg, ShortMsg: shortMsg}
|
||||
}
|
||||
|
||||
func ErrUserMismatch(msg string) BaseError {
|
||||
shortMsg := "操作的两个用户不匹配"
|
||||
return BaseError{Code: 5003, Msg: msg, ShortMsg: shortMsg}
|
||||
}
|
||||
|
||||
func ErrFetchStat(msg string) BaseError {
|
||||
shortMsg := "获取用户统计信息失败"
|
||||
return BaseError{Code: 5004, Msg: msg, ShortMsg: shortMsg}
|
||||
}
|
||||
Reference in New Issue
Block a user