common_const.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // common_const.h
  3. // RA TradeFiling
  4. //
  5. // Created by Rui Zhang on 11/18/20.
  6. //
  7. #ifndef common_const_h
  8. #define common_const_h
  9. #define DEBUGLOG 1
  10. #ifdef DEBUGLOG
  11. #ifdef DEBUG
  12. // #define DebugLog( s, ... ) fprintf(stderr,"%s\n",[[NSString stringWithFormat:s, ##__VA_ARGS__] UTF8String])//
  13. #define DebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
  14. #define blockDebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n",weakself, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
  15. #else
  16. #define DebugLog( s, ... )
  17. #define blockDebugLog( s, ... )
  18. #endif
  19. #else
  20. #define DebugLog( s, ... )
  21. #define blockDebugLog( s, ... )
  22. #endif
  23. #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
  24. #define UIColorFromRGBAlpha(rgbValue,alp) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(alp)]
  25. // 接口json 的result值
  26. #define RESULT_LOGIN_ON_OTHER_DEVICE -1
  27. #define RESULT_NO_RESPONSE -1024
  28. #define RESULT_NET_ERROR -3
  29. #define RESULT_NET_NOTAVAILABLE -4
  30. #define RESULT_ERROR -5
  31. #define RESULT_LOCALFILE_ERROR -7
  32. #define RESULT_USERAUTH_ERROR -9
  33. #define RESULT_VER_LOW -15
  34. //#define RESULT_FALSE 0
  35. #define RESULT_FALSE 1
  36. #define RESULT_TRUE 2
  37. #define RESULT_FAILED_WITH_MESSAGE 9
  38. #define RESULT_TIMEOUT 99
  39. // 对应接口状态的部分message
  40. #define MSG_NET_NOTAVAILABLE @"No available network, please check your network setting."
  41. #define MSG_NET_ERROR @"Net Error. Cannot connect to server for now. Please retry later."
  42. #define MSG_USERAUTH_ERROR @"Username or password is incorrect.Please check."
  43. #define MSG_VER_LOW @"Current App version is out of date, please update to the latest version."
  44. #define MSG_ERROR @"Connection failed with Server, please email your IT Admin."//@"Some error occured on server."
  45. #define MSG_SUCCESS @"Success."
  46. #define MSG_LOGIN_DEVICE @"You are currently signed in on another device. Please check."
  47. #define MSG_TIMEOUT @"Request timeout."
  48. #endif /* common_const_h */