58 lines
1.2 KiB
Go
58 lines
1.2 KiB
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
|
|
UploadError = 10104
|
|
|
|
AdminLoginError = 20101
|
|
CreateAppError = 20201
|
|
DeleteAppError = 20202
|
|
ListAppError = 20203
|
|
ModifyAppError = 20204
|
|
CreateAppUserError = 20205
|
|
ListAppUserError = 20206
|
|
CreateAdminError = 20207
|
|
ListAdminError = 20208
|
|
ModifyAdminError = 20209
|
|
DeleteAdminError = 20210
|
|
|
|
CreateKeywordError = 20301
|
|
ListKeywordError = 20302
|
|
ModifyKeywordError = 20303
|
|
DeleteKeywordError = 20304
|
|
CreateKeywordMaterialError = 20305
|
|
ListKeywordMaterialError = 20306
|
|
ModifyKeywordMaterialError = 20307
|
|
DeleteKeywordMaterialError = 20308
|
|
|
|
SendMessageError = 20401
|
|
ListMessageError = 20402
|
|
)
|
|
|
|
func Text(code int) string {
|
|
lang := configs.Get().Language.Local
|
|
|
|
if lang == configs.ZhCN {
|
|
return zhCNText[code]
|
|
}
|
|
|
|
return zhCNText[code]
|
|
}
|