package statuscode var StatusCodeZh = map[int]string{ Success: "成功", AccountExisted: "账号已存在", AccountOrPasswordError: "账号或密码错误", PassWordNotMatch: "密码不一致", } var StatusCodeEn = map[int]string{ Success: "success", AccountExisted: "account already existed", AccountOrPasswordError: "account or password error", PassWordNotMatch: "password not match", } func GetMsg(code int, lang string) string { if lang == "zh" { return StatusCodeZh[code] } else { return StatusCodeEn[code] } } const ( Success = 200 //账号不存在 AccountNotFound = 10001 //账号已存在 AccountExisted = 10002 //密码错误 AccountOrPasswordError = 10003 //密码不一致 PassWordNotMatch = 10004 )