endpoints.js 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * REST API v2,以端点的形式提供。
  3. */
  4. const APIv2 = {
  5. Application: {
  6. Base: '/api/v2/application',
  7. BadgeNo: '/badge_no' //获取角标
  8. },
  9. Management: {
  10. Base: '/api/v2/management',
  11. Health: '/health',
  12. DbStatus: '/db'
  13. },
  14. Message: {
  15. Base: '/api/v2/message',
  16. Send: '/send', //发送消息,和会话无关,内外网通信
  17. DataMessage: '/dataMessage',
  18. CleanMessageToRedis: '/cleanMessageToRedis',
  19. DoctorSystemMessage: '/doctorSystemMessage',
  20. DoctorSystemMessageD: '/doctorSystemMessageD',
  21. CleanMessageLastFetchTimeToRedis: '/cleanMessageLastFetchTimeToRedis'
  22. },
  23. Users: {
  24. Base: '/api/v2/users',
  25. Login: '/login', //用户登录
  26. Logout: '/logout', //用户退出
  27. User: '/:user_id', //用户信息
  28. UserStatus: '/:user_id/status', //用户状态
  29. UserConsultTime:'/:user_id/consult/time' //用户咨询时间
  30. },
  31. Sessions: {
  32. Base: '/api/v2/sessions', //创建会话
  33. Session: '/:session_id/session', // 获取会话
  34. SessionListByType: '/sessionListByType', // 按会话类型获取会话
  35. SessionCountByType: '/sessionCountByType', // 按会话类型获取会话数量
  36. SessionSticky: '/:session_id/sticky', // 会话置顶,置顶使用PUT,取消置顶使用DELETE
  37. SessionStatus: '/:session_id/status', // 更新状态
  38. SessionName: '/:session_id/name', // 更新会话名称
  39. FixSessionToRedis: '/fixSessionToRedis', // 把会话写入redis
  40. RecentSessions: '/recent', // 最近会话,使用类型过滤出'患者'或'医生'会话
  41. IsExist: '/isExist', // 判断会话是否存在(i健康发送muc的im消息会话前会先调用创建会话的方法,这个方法会更新redis中每个成员的最后获取时间,导致未读消息不准)
  42. Topics: '/:topic_id/topics', // 获取单个议题
  43. Topic: '/topics/:topic_id', // 议题,指定ID的议题将返回其信息
  44. TopicEnded: '/:session_id/topics/:topic_id/ended', // 议题是否已结束,若top_id为current,则检查最后一个议题的状态
  45. TopicInto: '/:session_id/topics/:topic_id/into', // 居民进入议题
  46. TopicList:'/topics', //获取议题列表
  47. HealthTopicList:'/healthTopics', //健康咨询
  48. TopicListByType:'/topicListByType', //按类型查找咨询(未回复,进行中,已回复)
  49. TopicListCountByType:'/topicListCountByType', //按类型查找咨询(未回复,进行中,已回复)的数量
  50. HealthTeamTopicList:'/healthTeamTopics', //健康咨询(区分团队)
  51. TopicReplyCount:"/topics/count/reply", //议题回复数统计
  52. TopicMessages:'/topic/:topic_id/messages', //议题消息
  53. Messages: '/:session_id/messages', // 会话消息
  54. MessagesByTopic: '/:session_id/topics/:topic_id/messages', // 议题消息
  55. Message: '/:session_id/messages/:message_id', // 单条消息
  56. MessageUpdate: '/:session_id/messages/:message_id/update', // 更新消息内容(消息里有i健康业务状态时)
  57. SessionsUnreadMessageCount: '/unread_message_count', // 所有会话的未读消息数
  58. SessionsUnreadMessageCountByType: '/unread_message_count_type', // 按会话类型查找未读消息数
  59. SessionUnreadMessageCount: '/:session_id/unread_message_count', // 指定会话的未读消息数
  60. SessionUnreadMessages: '/:session_id/messages/unread', // 会话未读消息
  61. ParticipantUpdate:'/:session_id/participant/update', //更新成员=删除旧成员,新增新成员
  62. Participants: '/:session_id/participants', // 会话所有成员
  63. ParticipantsAvatar: '/:session_id/participants/avatars', // 会话所有成员头像
  64. Participant: '/:session_id/participants/:participant_id', // 会话单个成员(多个participant_id 用英文逗号间隔)
  65. ParticipantAvatar: '/:session_id/participants/:participant_id/avatars' // 会话单个成员头像
  66. },
  67. Search: {
  68. Base: '/api/v2/search' // 搜索,下一版本的语法使用ElasticSearch
  69. },
  70. Demo:{
  71. Base:'/api/v2/demo',
  72. sendWXTemplate: '/sendWXTemplate' // 获取会话
  73. }
  74. };
  75. const pages = {
  76. Home: {
  77. Index: '/'
  78. },
  79. Socket: {
  80. Index: '/socket',
  81. Test: '/test'
  82. }
  83. };
  84. module.exports.PAGES = pages;
  85. module.exports.APIv2 = APIv2;