msg.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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_QUERY_QUOTEMENU_FAIL: "查询交易端行情报价牌分类菜单失败",
  11. ERROR_QUERY_OPERATIONMENU_FAIL: "查询交易端功能菜单失败",
  12. ERROR_OPERATION_FAILED: "执行失败",
  13. ERROR_GET_GOODS_FAILED: "获取商品信息失败",
  14. ERROR_GET_MARKET_FAILED: "获取市场信息失败",
  15. ERROR_GET_MARKETRUN_FAILED: "获取市场运行参数失败",
  16. ERROR_GET_RUNSTEP_FAILED: "获取市场开休市计划失败",
  17. ERROR_UPLOAD_SAVE_IMAGE_FAIL: "保存图片失败",
  18. ERROR_UPLOAD_CHECK_IMAGE_FAIL: "检查图片失败",
  19. ERROR_UPLOAD_CHECK_IMAGE_FORMAT: "校验图片错误,图片格式或大小有问题",
  20. ERROR_CFG_KEY_FAIL: "错误的KEY值",
  21. ERROR_CFG_FILE_FAIL: "读取配置文件失败",
  22. ERROR_CFG_JSON_FAIL: "配置文件格式错误",
  23. }
  24. // GetMsg get error information based on Code
  25. func GetMsg(code int) string {
  26. msg, ok := MsgFlags[code]
  27. if ok {
  28. return msg
  29. }
  30. return MsgFlags[ERROR]
  31. }