IMConversationInfo.swift 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. //
  2. // IMConversation.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2020/6/4.
  6. // Copyright © 2020 zoneland. All rights reserved.
  7. //
  8. import HandyJSON
  9. class IMConversationInfo: NSObject, DataModel {
  10. @objc var id: String?
  11. @objc var title: String?
  12. @objc var type: String? //会话类型 单人 、 群.
  13. @objc var personList: [String]?
  14. @objc var adminPerson: String?
  15. @objc var note: String?
  16. @objc var lastMessageTime: String?
  17. @objc var createTime: String?
  18. @objc var updateTime: String?
  19. var unreadNumber: Int?
  20. var isTop: Bool?
  21. @objc var lastMessage: IMMessageInfo?
  22. required override init() { }
  23. func mapping(mapper: HelpingMapper) {
  24. }
  25. }
  26. class IMConversationUpdateForm: NSObject, DataModel {
  27. @objc var id: String?
  28. @objc var title: String?
  29. @objc var personList: [String]?
  30. @objc var adminPerson: String?
  31. @objc var note: String?
  32. required override init() { }
  33. func mapping(mapper: HelpingMapper) {
  34. }
  35. }
  36. class IMMessageRequestForm: NSObject, DataModel {
  37. @objc var conversationId: String?
  38. required override init() { }
  39. func mapping(mapper: HelpingMapper) {
  40. }
  41. }
  42. class IMMessageInfo: NSObject, DataModel {
  43. @objc var id: String?
  44. @objc var conversationId: String?
  45. @objc var body: String?
  46. @objc var createPerson: String?
  47. @objc var createTime: String?
  48. @objc var updateTime: String?
  49. required override init() { }
  50. func mapping(mapper: HelpingMapper) {
  51. }
  52. }
  53. class IMMessageBodyInfo: NSObject, DataModel {
  54. @objc var id: String?
  55. @objc var type: String?
  56. @objc var body: String?
  57. @objc var fileId: String? //文件id
  58. @objc var fileName: String? //文件名称
  59. @objc var fileExtension: String? //文件扩展
  60. @objc var fileTempPath: String? //本地临时文件地址
  61. @objc var audioDuration: String? // 音频文件时长
  62. @objc var address: String? //type=location的时候位置信息
  63. @objc var addressDetail: String?
  64. var latitude: Double?//type=location的时候位置信息
  65. var longitude: Double?//type=location的时候位置信息
  66. @objc var title: String? // 流程工作标题
  67. @objc var work: String?// 流程工作id
  68. @objc var process: String?// 流程id
  69. @objc var processName: String?// 流程名称
  70. @objc var application: String?// 流程应用id
  71. @objc var applicationName: String?// 流程应用名称
  72. @objc var job: String?// 流程工作jobId
  73. required override init() { }
  74. func mapping(mapper: HelpingMapper) {
  75. }
  76. }
  77. class IMUploadBackModel: NSObject, DataModel {
  78. public override var description: String {
  79. return "IMUploadBackModel"
  80. }
  81. @objc var id:String?
  82. @objc var fileExtension: String? //文件扩展
  83. @objc var fileName: String? //文件名称
  84. required override init() { }
  85. func mapping(mapper: HelpingMapper) {
  86. }
  87. }
  88. //websocket 消息对象
  89. class WsMessage: NSObject, DataModel {
  90. @objc var type: String? //im_create
  91. @objc var body: IMMessageInfo? //这个对象只有 type=im_create的时候才是这个对象
  92. required override init() { }
  93. func mapping(mapper: HelpingMapper) {
  94. }
  95. }
  96. //其他消息
  97. class InstantMessage: NSObject, DataModel {
  98. @objc var id: String?
  99. @objc var title: String?
  100. @objc var type: String?
  101. @objc var body: String?
  102. @objc var consumerList: [String]?
  103. @objc var person: String?
  104. var consumed: Bool?
  105. @objc var createTime: String?
  106. @objc var updateTime: String?
  107. required override init() { }
  108. func mapping(mapper: HelpingMapper) {
  109. }
  110. }
  111. struct O2LocationData {
  112. var address: String?
  113. var addressDetail: String?
  114. var latitude: Double?
  115. var longitude: Double?
  116. }
  117. /// IM聊天的配置文件
  118. open class IMConfig: NSObject, HandyJSON, NSCoding {
  119. open var enableClearMsg: Bool?
  120. open var enableRevokeMsg: Bool?
  121. public func encode(with aCoder: NSCoder) {
  122. if enableClearMsg != nil {
  123. aCoder.encode(enableClearMsg, forKey: "enableClearMsg")
  124. }
  125. if enableRevokeMsg != nil {
  126. aCoder.encode(enableRevokeMsg, forKey: "enableRevokeMsg")
  127. }
  128. }
  129. public required init?(coder aDecoder: NSCoder) {
  130. enableClearMsg = aDecoder.decodeObject(forKey: "enableClearMsg") as? Bool
  131. enableRevokeMsg = aDecoder.decodeObject(forKey: "enableRevokeMsg") as? Bool
  132. }
  133. required public override init() {}
  134. open override var description: String {
  135. return toJSONString(prettyPrint: true) ?? ""
  136. }
  137. }