message

package
v0.0.0-...-2a383cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 5 Imported by: 13

Documentation

Overview

消息定义接口

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetError

func GetError(code ErrCode) error

GetError 获取错误信息(grpc)

Types

type ErrCode

type ErrCode int

错误消息类型

const (
	ServerMaintenance ErrCode = -1 // 服务器维护中 请稍后再试
	NormalMessageID   ErrCode = 0  // normal
	Canceled          ErrCode = 1  // 已取消
	UnknownError      ErrCode = 2  // 未知错误
	InvalidArgument   ErrCode = 3  // 无效参数
	AppidOverdue      ErrCode = 4  // appid过期

	AccountDisabled ErrCode = 101 // 帐号被禁用
	TokenFailure    ErrCode = 102 // token失效
	HTMLSuccess     ErrCode = 200 // 成功
	BlockingAcess   ErrCode = 405 // 禁止访问

	NewReport ErrCode = 201 // 新消息
	NewHeart  ErrCode = 202 // 心跳

	ParameterInvalid          ErrCode = 1001 // 参数无效
	AppidParameterInvalid     ErrCode = 1002 // appid参数无效
	EncryptCheckError         ErrCode = 1003 // 密文校验失败,aa
	UserNameDoNotExist        ErrCode = 1004 // 用户名不存在或密码错误
	DuplicateKeyError         ErrCode = 1005 // 键值对重复
	InValidOp                 ErrCode = 1007 // 无效操作
	NotFindError              ErrCode = 1006 // 未找到
	InValidAuthorize          ErrCode = 1008 // 授权码错误
	HasusedError              ErrCode = 1009 // 已被使用
	HasActvError              ErrCode = 1010 // 已被激活
	ActvFailure               ErrCode = 1011 // 激活码被禁止使用
	UserExisted               ErrCode = 1012 // 用户已存在
	VerifyTimeError           ErrCode = 1013 // 验证码请求过于频繁
	MailSendFaild             ErrCode = 1014 // 邮箱发送失败
	SMSSendFaild              ErrCode = 1015 // 手机发送失败
	PhoneParameterError       ErrCode = 1016 // 手机号格式有问题
	VerifyError               ErrCode = 1017 // 验证码错误
	UserNotExisted            ErrCode = 1018 // 用户不存在
	TopicExisted              ErrCode = 1019 // topic已经存在
	TopicNotExisted           ErrCode = 1020 // topic不存在
	BundleIDNotExisted        ErrCode = 1021 // bundle_id不存在
	TopicStartFail            ErrCode = 1022 // topic开启处理失败
	TopicTypeNotExisted       ErrCode = 1023 // topic处理类型不存在
	TopicIsNotNull            ErrCode = 1024 // topic不能为空
	DeviceNotExisted          ErrCode = 1025 // 设备不存在
	StateExisted              ErrCode = 1027 // 状态已存在
	LastMenuNotExisted        ErrCode = 1028 // 上级菜单不存在
	MenuNotExisted            ErrCode = 1029 // 菜单不存在
	UserMenuNotExisted        ErrCode = 1030 // 用户权限不存在
	DeviceIDNotExisted        ErrCode = 1031 // 设备ID不存在
	GoodsDealTypeNotExisted   ErrCode = 1032 // 商品处理类型不存在
	GoodsIDNotExisted         ErrCode = 1033 // 商品不存在
	GoodsBeInDiscount         ErrCode = 1034 // 商品正在打折
	GoodsPayTypeNotExisted    ErrCode = 1035 // 商品可支付类型不存在
	GoodsIDExisted            ErrCode = 1036 // 商品已存在
	OrderIDNotExisted         ErrCode = 1043 // 订单不存在
	GoodsBeNotInDiscount      ErrCode = 1044 // 商品未打折
	NotifyIsNotMatch          ErrCode = 1045 // 会话不匹配
	GoodsIsDiscountRecovery   ErrCode = 1046 // 商品已恢复原价
	InvitationUserNotExisted  ErrCode = 1047 // 邀请用户不存在
	InvitationUserLevelIsFull ErrCode = 1048 // 邀请用户级数已满
	UserNotAuthorize          ErrCode = 1049 // 用户未授权
	ApplicantIsExisted        ErrCode = 1050 // 申请人已存在
	ApplicantNotExisted       ErrCode = 1051 // 申请人不存在
	CreditOrderNotVaild       ErrCode = 1052 // 订单无效
	RepeatWxWithdraw          ErrCode = 1053 // 微信零钱重复提现
	WxWithdrawAmountError     ErrCode = 1054 // 提现金额错误
	WxWithdrawError           ErrCode = 1055 // 微信提现失败
	RepeatSubmission          ErrCode = 1056 // 重复提交
	BundleExisted             ErrCode = 1057 // bundle已存在
	AuthExisted               ErrCode = 1058 // 权限已存在
	AuthNotExisted            ErrCode = 1059 // 权限不存在
	RoomTypeNotExisted        ErrCode = 1060 // 房型不存在
	RoomTypeExisted           ErrCode = 1061 // 房型已存在
	RoomNoNotExisted          ErrCode = 1062 // 房间不存在
	RoomNoExisted             ErrCode = 1063 // 房间已存在
	RateTypeExisted           ErrCode = 1064 // 房价代码或房价名称已存在
	RateTypeNotExisted        ErrCode = 1065 // 房价代码不存在
	FileNotExisted            ErrCode = 1066 // 文件不存在
	RoomNoInvaild             ErrCode = 1067 // 房间未启用
	ClassExisted              ErrCode = 1068 // 班次已存在
	ClassNotExisted           ErrCode = 1069 // 班次不存在
	CheckTimeError            ErrCode = 1070 // 系统时间与营业时间不匹配
	CurrentClassIsShift       ErrCode = 1071 // 当前班次已交班
	PayPriceError             ErrCode = 1072 // 支付金额错误
	StockNotEnough            ErrCode = 1073 // 存量不足
	DBSaveError               ErrCode = 1074 // 数据存储错误
	DBAddError                ErrCode = 1075 // 数据添加错误
	DBUpdateError             ErrCode = 1076 // 数据更新错误
	DBDeleteError             ErrCode = 1077 // 数据删除错误
	TimeError                 ErrCode = 1078 // 时间错误
	OrderInfoError            ErrCode = 1079 // 预定信息错误
	NotVaildError             ErrCode = 1080 // 不允许
	Overdue                   ErrCode = 1081 // 已过期
	MaxOverError              ErrCode = 1082 // 超过最大值
	MinOverError              ErrCode = 1083 // 低于最小值
	ExistedError              ErrCode = 1084 // 已存在
	NotBindError              ErrCode = 1085 // 未绑定
	BindError                 ErrCode = 1086 // 绑定失败
	CalError                  ErrCode = 1087 // 计算错误
	TokenCheckError           ErrCode = 1088 // token校验失败
	AppidNotFind              ErrCode = 1089 // 应用id未找到
	HaveDeal                  ErrCode = 1090 // 已经处理
	ParseFilesError           ErrCode = 1091 // 解析文件错误
	CacheException            ErrCode = 1092 // 缓存异常
	TemplateExecuteError      ErrCode = 1093 // 模板执行错误
	OpTimeError               ErrCode = 1094 // 请不要平凡操作
	EmptyError                ErrCode = 1095 // 数据为空
	Unfollow                  ErrCode = 1096 // 用户已取消关注
	HaveLink                  ErrCode = 1097 // 存在关联
	StateError                ErrCode = 1098 // 状态错误
	LimitError                ErrCode = 1099 // 超限

	UserNameFormatError         ErrCode = 2001 // 用户名格式错误
	AvatarUsedError             ErrCode = 2002 // 无效操作,存在使用中的虚拟人
	TokenUsedError              ErrCode = 2003 // 被另外一个浏览器打开,请稍后再试
	NotFoundResourceError       ErrCode = 2004 // 资源未找到
	ProjectCodeExistedError     ErrCode = 2005 // 产品代码重复
	ExcelExportError            ErrCode = 2006 // Excel导出失败
	NotFoundPublishVersionError ErrCode = 2007 // 未找到发布版本
	SaveFileError               ErrCode = 2008 // 文件保存失败
	UnreleasedVersionError      ErrCode = 2009 // 已存在未发布的版本
	CheckResourceFailed         ErrCode = 2010 // 校验资源失败
	InvalidPublicationError     ErrCode = 2011 // 本次发布无效
	FailedPublication           ErrCode = 2012 // 本次发布失败
	LangSettingWarning          ErrCode = 2013 // 请至少完成一个语种的配置
	TrainError                  ErrCode = 2014 // 训练失败
	BusinessUsedError           ErrCode = 2015 // 无效操作,存在使用中的知识库
	CommandUsedError            ErrCode = 2016 // 无效操作,存在使用中的指令
	FAQOverdueError             ErrCode = 2017 // 训练数据已过期,请重新训练
	FAQTrainError               ErrCode = 2018 // 知识库训练错误,请稍后再试
	FAQSearchError              ErrCode = 2019 // 问答服务错误,请稍后再试
	FAQClusterError             ErrCode = 2020 // 知识库聚类错误,请稍后再试
	FAQIndicesError             ErrCode = 2021 // 获取索引异常
	FAQDeleteIndexError         ErrCode = 2022 // 索引删除异常
	NLUProcessError             ErrCode = 2023 // NLU测试异常, 请稍后再试
	NLUParseError               ErrCode = 2024 // NLU置信度获取异常, 请稍后再试
	NLUGenerateError            ErrCode = 2025 // NLU训练数据生成错误,请稍后再试
	NLUTrainError               ErrCode = 2026 // NLU训练失败,请稍后再试
	NLUPublishError             ErrCode = 2027 // NLU发布失败,请稍后再试
	FAQModelUsedError           ErrCode = 2028 // 无效操作,存在使用中的模型
	BusinessNotFoundError       ErrCode = 2029 // 未找到可用知识库
	AppNotFoundError            ErrCode = 2030 // 未找到应用信息
	AppUsedError                ErrCode = 2031 // 存在正在使用的应用信息
	CharacterNotFoundError      ErrCode = 2032 // 未找到可用的虚拟人模板
	AvatarNotFoundError         ErrCode = 2033 // 未找到可用的虚拟人
	DomainUsedError             ErrCode = 2034 // 无效操作,空间存在正在使用的数据
	DomainNotFoundError         ErrCode = 2035 // 未找到可用的租户空间
	CheckResourceIntactWarning  ErrCode = 2036 // 请上传完整的角色模型
	CheckSkeletonWarning        ErrCode = 2037 // 请上传角色骨骼
	CheckAnimWarning            ErrCode = 2038 // 请上传角色动画
	NotMatching                 ErrCode = 2039 // 未匹配到
	DeviceUnauthorized          ErrCode = 2040 // 设备未授权
	AICountIsZero               ErrCode = 2041 // 无AI扩写数据
	NoFAQQuestion               ErrCode = 2042 // 请先录入FAQ
	WordLimitError              ErrCode = 2043 // 字数超限
)

func (ErrCode) String

func (i ErrCode) String() string

type MessageBody

type MessageBody struct {
	State bool        `json:"state"`
	Code  int         `json:"code,omitempty"`
	Error string      `json:"error,omitempty"`
	Data  interface{} `json:"data,omitempty"`
}

MessageBody 消息头

func GetErrorMsg

func GetErrorMsg(errorCode ...interface{}) (msg MessageBody)

GetErrorMsg 获取错误消息 参数(int,string)

func GetErrorStrMsg

func GetErrorStrMsg(err error) (msg MessageBody)

GetErrorStrMsg 获取错误消息 参数(int,string)

func GetSuccessMsg

func GetSuccessMsg(codes ...ErrCode) (msg MessageBody)

GetSuccessMsg 成功消息

func (MessageBody) GetError

func (m MessageBody) GetError() error

GetError 获取错误信息(grpc)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL