Built files from Bizgaze WebServer
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

chatmanager.js 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3. return new (P || (P = Promise))(function (resolve, reject) {
  4. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  5. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  7. step((generator = generator.apply(thisArg, _arguments || [])).next());
  8. });
  9. };
  10. var Unibase;
  11. (function (Unibase) {
  12. let Platform;
  13. (function (Platform) {
  14. let Connect;
  15. (function (Connect) {
  16. let Managers;
  17. (function (Managers) {
  18. class ChatManager extends Platform.Core.BaseManager {
  19. static Instance() {
  20. if (this._instance === undefined)
  21. this._instance = new ChatManager();
  22. return this._instance;
  23. }
  24. saveChatGroup(obj) {
  25. return __awaiter(this, void 0, void 0, function* () {
  26. const url = 'apis/uniconnect/chats/savechatgroup';
  27. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  28. return response;
  29. });
  30. });
  31. }
  32. getChats() {
  33. return __awaiter(this, void 0, void 0, function* () {
  34. const url = 'apis/uniconnect/chats/getchats';
  35. return yield this.dataHelper().getAsync(url).then(function (response) {
  36. return response;
  37. });
  38. });
  39. }
  40. getChatsByGroupId(chatGroupId) {
  41. return __awaiter(this, void 0, void 0, function* () {
  42. const url = 'apis/uniconnect/chats/chatlist/chatgroupid/' + chatGroupId;
  43. return yield this.dataHelper().getAsync(url).then(function (response) {
  44. return response;
  45. });
  46. });
  47. }
  48. forwardmultiple(data) {
  49. return __awaiter(this, void 0, void 0, function* () {
  50. const url = 'apis/uniconnect/chats/multiforward';
  51. return yield this.dataHelper().postAsync(url, data).then(function (response) {
  52. return response;
  53. });
  54. });
  55. }
  56. Deletemultiple(array) {
  57. return __awaiter(this, void 0, void 0, function* () {
  58. const url = 'apis/uniconnect/chats/multidelete';
  59. return yield this.dataHelper().postAsync(url, array).then(function (response) {
  60. return response;
  61. });
  62. });
  63. }
  64. Starmultiple(array) {
  65. return __awaiter(this, void 0, void 0, function* () {
  66. const url = 'apis/uniconnect/chats/multistar';
  67. return yield this.dataHelper().postAsync(url, array).then(function (response) {
  68. return response;
  69. });
  70. });
  71. }
  72. MuteNotifications(chatgroupid) {
  73. return __awaiter(this, void 0, void 0, function* () {
  74. const url = 'apis/uniconnect/chats/mutenotification/chatgroupid/' + chatgroupid;
  75. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  76. return response;
  77. });
  78. });
  79. }
  80. getChatContacts() {
  81. return __awaiter(this, void 0, void 0, function* () {
  82. const url = 'apis/uniconnect/chats/getchatcontacts';
  83. return yield this.dataHelper().getAsync(url).then(function (response) {
  84. return response;
  85. });
  86. });
  87. }
  88. getChatMessages(chatId) {
  89. return __awaiter(this, void 0, void 0, function* () {
  90. const url = 'apis/uniconnect/chats/chatlist/conversation/' + chatId;
  91. return yield this.dataHelper().getAsync(url).then(function (response) {
  92. return response;
  93. });
  94. });
  95. }
  96. getLastMessage(chatId) {
  97. return __awaiter(this, void 0, void 0, function* () {
  98. const url = 'apis/uniconnect/chats/chatlist/conversation/' + chatId;
  99. return yield this.dataHelper().getAsync(url).then(function (response) {
  100. return response;
  101. });
  102. });
  103. }
  104. saveChat(obj) {
  105. return __awaiter(this, void 0, void 0, function* () {
  106. const url = 'apis/uniconnect/chats/savechat';
  107. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  108. return response;
  109. });
  110. });
  111. }
  112. getChatGroup(fromUserId, toUserId, isPrivate, groupName) {
  113. return __awaiter(this, void 0, void 0, function* () {
  114. const url = 'apis/uniconnect/chats/getchatgroup/fromuserid/' + fromUserId + '/touserid/' + toUserId + '/isprivate/' + isPrivate + '/groupname/' + groupName;
  115. return yield this.dataHelper().getAsync(url).then(function (response) {
  116. return response;
  117. });
  118. });
  119. }
  120. getChatRecipientsByGroupId(chatGroupId) {
  121. return __awaiter(this, void 0, void 0, function* () {
  122. const url = 'apis/uniconnect/chats/getchatrecipients/chatgroupid/' + chatGroupId;
  123. return yield this.dataHelper().getAsync(url).then(function (response) {
  124. return response;
  125. });
  126. });
  127. }
  128. getChatgroups(contactId) {
  129. return __awaiter(this, void 0, void 0, function* () {
  130. const url = 'apis/uniconnect/chats/getchatgroups/contactid/' + contactId;
  131. return yield this.dataHelper().getAsync(url).then(function (response) {
  132. return response;
  133. });
  134. });
  135. }
  136. updateLastSeen(RecipientId) {
  137. return __awaiter(this, void 0, void 0, function* () {
  138. const url = 'apis/uniconnect/chats/updatelastseen/recipientid/' + RecipientId;
  139. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  140. return response;
  141. });
  142. });
  143. }
  144. Delete(chatid, fromuserid) {
  145. return __awaiter(this, void 0, void 0, function* () {
  146. const url = 'apis/uniconnect/chats/deletemessage/chatid/' + chatid + '/fromuserid/' + fromuserid;
  147. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  148. return response;
  149. });
  150. });
  151. }
  152. DeleteForEveryone(chatid, chatgroupid) {
  153. return __awaiter(this, void 0, void 0, function* () {
  154. const url = 'apis/uniconnect/chats/deleteforeveryone/chatid/' + chatid + '/chatgroupid/' + chatgroupid;
  155. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  156. return response;
  157. });
  158. });
  159. }
  160. EditMessage(chatid, message) {
  161. return __awaiter(this, void 0, void 0, function* () {
  162. const url = 'apis/uniconnect/chats/editmessage/chatid/' + chatid + '/message/' + message;
  163. return yield this.dataHelper().postAsync(url, message).then(function (response) {
  164. return response;
  165. });
  166. });
  167. }
  168. StarMessage(chatid, currentUser) {
  169. return __awaiter(this, void 0, void 0, function* () {
  170. const url = 'apis/uniconnect/chats/starmessage/chatid/' + chatid + '/currentUser/' + currentUser;
  171. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  172. return response;
  173. });
  174. });
  175. }
  176. RemoveParticipant(chatgroupid, contactid) {
  177. return __awaiter(this, void 0, void 0, function* () {
  178. const url = 'apis/uniconnect/chats/removeparticipant/chatgroupid/' + chatgroupid + '/recipientid/' + contactid;
  179. return yield this.dataHelper().postAsync(url, null).then(function (reponse) {
  180. return reponse;
  181. });
  182. });
  183. }
  184. clearChat(chatgroupid, fromuserid) {
  185. return __awaiter(this, void 0, void 0, function* () {
  186. const url = 'apis/uniconnect/chats/clearchat/chatgroupid/' + chatgroupid + '/fromuserid/' + fromuserid;
  187. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  188. return response;
  189. });
  190. });
  191. }
  192. changeGroupName(chatgroupid, groupname) {
  193. return __awaiter(this, void 0, void 0, function* () {
  194. const url = 'apis/uniconnect/chats/changegroupname/chatgroupid/' + chatgroupid + '/groupname/' + groupname;
  195. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  196. return response;
  197. });
  198. });
  199. }
  200. updateAdminStatus(chatgroupid, recipientId, isadmin) {
  201. return __awaiter(this, void 0, void 0, function* () {
  202. const url = 'apis/uniconnect/chats/updateadminstatus/chatgroupid/' + chatgroupid + '/recipientid/' + recipientId + '/isadmin/' + isadmin;
  203. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  204. return response;
  205. });
  206. });
  207. }
  208. messageinfo(chatid) {
  209. return __awaiter(this, void 0, void 0, function* () {
  210. const url = 'apis/uniconnect/chats/messageinfo/chatid/' + chatid;
  211. return yield this.dataHelper().getAsync(url).then(function (response) {
  212. return response;
  213. });
  214. });
  215. }
  216. getChatRecipientInfo(chatgroupid, recipientid) {
  217. return __awaiter(this, void 0, void 0, function* () {
  218. const url = 'apis/uniconnect/chats/getchatrecipient/chatgroupid/' + chatgroupid + '/recipientid/' + recipientid;
  219. return yield this.dataHelper().getAsync(url).then(function (response) {
  220. return response;
  221. });
  222. });
  223. }
  224. draftMessage(message, chatgroupid) {
  225. return __awaiter(this, void 0, void 0, function* () {
  226. const url = 'apis/uniconnect/chats/draftMessage/chatgroupid/' + chatgroupid + '/message/' + message;
  227. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  228. return response;
  229. });
  230. });
  231. }
  232. getMediaCount(chatgroupid) {
  233. return __awaiter(this, void 0, void 0, function* () {
  234. const url = 'apis/uniconnect/chats/getMedia/chatgroupid/' + chatgroupid;
  235. return yield this.dataHelper().getAsync(url).then(function (response) {
  236. return response;
  237. });
  238. });
  239. }
  240. blockOrunBlock(chatgroupid) {
  241. return __awaiter(this, void 0, void 0, function* () {
  242. const url = 'apis/uniconnect/chats/blockUser/chatgroupid/' + chatgroupid;
  243. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  244. return response;
  245. });
  246. });
  247. }
  248. getUnreadChatCount() {
  249. return __awaiter(this, void 0, void 0, function* () {
  250. const url = 'apis/uniconnect/chats/getUnreadChatCount';
  251. return yield this.dataHelper().getAsync(url).then(function (response) {
  252. return response;
  253. });
  254. });
  255. }
  256. }
  257. Managers.ChatManager = ChatManager;
  258. })(Managers = Connect.Managers || (Connect.Managers = {}));
  259. })(Connect = Platform.Connect || (Platform.Connect = {}));
  260. })(Platform = Unibase.Platform || (Unibase.Platform = {}));
  261. })(Unibase || (Unibase = {}));