msg.go 902 B

123456789101112131415161718192021222324252627
  1. package e
  2. // MsgFlags 接口返回信息
  3. var MsgFlags = map[int]string{
  4. SUCCESS: "ok",
  5. ERROR: "fail",
  6. INVALID_PARAMS: "请求参数错误",
  7. ERROR_AUTH_CHECK_TOKEN_MISSING: "Token缺失",
  8. ERROR_AUTH_CHECK_TOKEN_FAIL: "Token鉴权失败",
  9. ERROR_QUERY_FAIL: "查询失败",
  10. ERROR_UPLOAD_SAVE_IMAGE_FAIL: "保存图片失败",
  11. ERROR_UPLOAD_CHECK_IMAGE_FAIL: "检查图片失败",
  12. ERROR_UPLOAD_CHECK_IMAGE_FORMAT: "校验图片错误,图片格式或大小有问题",
  13. ERROR_CFG_KEY_FAIL: "错误的KEY值",
  14. ERROR_CFG_FILE_FAIL: "读取配置文件失败",
  15. ERROR_CFG_JSON_FAIL: "配置文件格式错误",
  16. }
  17. // GetMsg get error information based on Code
  18. func GetMsg(code int) string {
  19. msg, ok := MsgFlags[code]
  20. if ok {
  21. return msg
  22. }
  23. return MsgFlags[ERROR]
  24. }