/* Copyright (c) [2023] [pcm] [pcm-coordinator] is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. */ package xerr var message map[uint32]string func init() { message = make(map[uint32]string) message[OK] = "SUCCESS" message[SERVER_COMMON_ERROR] = "服务器开小差啦,稍后再来试一试" message[REUQEST_PARAM_ERROR] = "参数错误" message[TOKEN_EXPIRE_ERROR] = "token失效,请重新登陆" message[TOKEN_GENERATE_ERROR] = "生成token失败" message[DB_ERROR] = "数据库繁忙,请稍后再试" message[DB_UPDATE_AFFECTED_ZERO_ERROR] = "更新数据影响行数为0" } func MapErrMsg(errcode uint32) string { if msg, ok := message[errcode]; ok { return msg } else { return "服务器开小差啦,稍后再来试一试" } } func IsCodeErr(errcode uint32) bool { if _, ok := message[errcode]; ok { return true } else { return false } }