39 lines
625 B
Go
39 lines
625 B
Go
package code
|
|
|
|
import (
|
|
_ "embed"
|
|
|
|
"mini-chat/configs"
|
|
)
|
|
|
|
//go:embed code.go
|
|
var ByteCodeFile []byte
|
|
|
|
// Failure 错误时返回结构
|
|
type Failure struct {
|
|
Code int `json:"code"` // 业务码
|
|
Message string `json:"message"` // 描述信息
|
|
}
|
|
|
|
const (
|
|
ServerError = 10101
|
|
ParamBindError = 10102
|
|
JWTAuthVerifyError = 10103
|
|
|
|
AdminLoginError = 20101
|
|
CreateAppError = 20201
|
|
DeleteAppError = 20202
|
|
ListAppError = 20203
|
|
ModifyAppError = 20204
|
|
)
|
|
|
|
func Text(code int) string {
|
|
lang := configs.Get().Language.Local
|
|
|
|
if lang == configs.ZhCN {
|
|
return zhCNText[code]
|
|
}
|
|
|
|
return zhCNText[code]
|
|
}
|