commons.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * 此文件内容为常用的系统枚举及变量。
  3. */
  4. /**
  5. * 系统部署时的配置文件。
  6. *
  7. * @type {string}
  8. */
  9. "use strict";
  10. let configFile = "config.";
  11. if (process.env.IM_PROFILE === "prod") {
  12. configFile += "prod";
  13. } else if (process.env.IM_PROFILE === "test") {
  14. configFile += "test";
  15. } else {
  16. configFile += "dev";
  17. }
  18. exports.CONFIG_FILE = configFile;
  19. /**
  20. * 消息内容类型。
  21. */
  22. exports.CONTENT_TYPE = {
  23. PlainText: 1, // 信息
  24. Image: 2, // 图片信息
  25. Audio: 3, // 语音信息
  26. Article: 4, // 文章信息
  27. GoTo: 5, // 跳转信息
  28. SessionBegin: 6,// 咨询开始
  29. SessionEnd: 7, // 咨询结束
  30. commaValues: function () {
  31. return "1,2,3,4,5,6,7";
  32. }
  33. };
  34. /**
  35. * 客户端平台。
  36. */
  37. exports.PLATFORM = {
  38. iOS: 0,
  39. Android: 1
  40. };
  41. /**
  42. * 组类型。
  43. */
  44. exports.GROUP_TYPE = {
  45. AdminTeam: 1,
  46. DiscussionGroup: 2
  47. };
  48. /**
  49. * 模型事件。
  50. *
  51. * @type {{Error: string, DataNotFound: string, OK: string}}
  52. */
  53. exports.MODEL_EVENTS = {
  54. Error: "error", // 数据库访问出错
  55. DataNotFound: "no_data", // 找不到指定的数据
  56. OK: "ok" // 操作结束或有数据返回
  57. };
  58. /**
  59. * 默认整型最大值。
  60. * @type {number}
  61. */
  62. exports.MAX_INT = 9007199254740992;
  63. /**
  64. * 默认分页大小。
  65. *
  66. * @type {number}
  67. */
  68. exports.DEFAULT_PAGE_SIZE = 100;
  69. /**
  70. * Redis Key列表。
  71. */
  72. exports.REDIS_KEYS = {
  73. Users: "users:"
  74. };