U.F.N.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. /*
  2. 好友消息
  3. //消息接口
  4. //0 好友或者群聊天消息
  5. //1 2 添加好友获取群友进群消息提示
  6. //3 用户给拉入群处理
  7. //4 用户确定添加进入群消息
  8. */
  9. Namespace.register("U.F.N"); //好友消息命名空间
  10. U.F.N.UXFN = []; //消息盒子
  11. U.F.N.MSE = []; //好友消息同步推
  12. /**
  13. * 用户消息模块
  14. *
  15. * @param {string} 用户id
  16. */
  17. U.F.N.GNM = function (userid) {
  18. U.A.Request(US.Auth, ["GetAllUnreadMessage", userid, US.userInfo.LoginId, US.PageId], U.F.N.AsynGNM, [""]); //获取好友未读消息
  19. }
  20. //--------------------------------------------------------------------------获取好友消息------------------------------------------------------------------------------
  21. //这个是消息的异步处理
  22. U.F.N.AsynGNM = function (r, UTF) {
  23. if ((r = r.value)) {//获取信息异步
  24. var i, _UIF = US.userInfo,
  25. _UDE = r[0],
  26. _UTE = r[1];
  27. (UTF !== true) && (U.D.LocalStorage.set("fm", U.MS.jsonToStr({ value: r, uid: _UIF.UserId })));
  28. if (typeof _UTE == "string") {
  29. U.F.N.DL(_UTE);
  30. }
  31. else {
  32. U.F.N.ST(_UTE); //用户上下线设置
  33. // if (_UTE[2]) { //聊天室消息
  34. // U.D.BC.ZMXXJS[_UTE[5], r[2][3], _UTE[3]];
  35. // }
  36. U.F.N.CKJSXX(r);
  37. U.F.N.Distribute(r);
  38. }
  39. }
  40. }
  41. //消息盒子分发
  42. U.F.N.Distribute = function (UDE) {
  43. if (U.F && U.F.N && U.F.N.UXFN) {
  44. for (var i = 0; i < U.F.N.UXFN.length; i++) { //消息盒子发送
  45. if (U.F.N.UXFN[i]) {
  46. U.F.N.UXFN[i](UDE);
  47. }
  48. else {
  49. delete U.F.N.UXFN[i];
  50. }
  51. }
  52. }
  53. }
  54. //消息查看
  55. U.F.N.CKJSXX = function (UDE) {
  56. (UDE[0]) && (U.F.N.CKHFXT(UDE[0])); //好友消息查看
  57. (UDE[1]) && (U.F.N.CKHFXTPB(UDE[1])); //即时消息查看
  58. U.F.N.ZMTS(UDE); //发送消息到浏览器中
  59. }
  60. //发送消息到桌面提示
  61. U.F.N.ZMTS = function (UDE) {
  62. var i, j, k, _UKE, _USE,
  63. _UET = window.external,
  64. _UTF = [], _UCE = [[], []];
  65. for (i = 0; i < UDE.length; i++) {
  66. if (i) {
  67. _USE = UDE[i][4]; for (j = 0; j < _USE.length; j++) {
  68. _UTF[0] = true;
  69. _UKE = _USE[j];
  70. _UCE[1].push({ "UsImag": _UKE.UserThumbnailImageHead !== undefined ? U.M.GetImgU(_UKE.UserThumbnailImageHead) : US.ms + "img/getface.jpg", "UsSYSUN": "", "UsSYScontent": _UKE["NEWC"] || _UKE["ET"], "UsName": _UKE.UserName, "UsType": _UKE["NEWTYPE"] });
  71. }
  72. }
  73. else { //属于闪烁消息
  74. for (j = 0; j < UDE[i].length; j++) {
  75. _USE = UDE[i][j];
  76. if (_USE && _USE.length) {
  77. for (k = 0; k < _USE.length; k++) {
  78. _UTF[1] = true;
  79. _UKE = _USE[k];
  80. _UCE[0].push({ "UsImag": _UKE.UserThumbnailImageHead != null ? U.M.GetImgU(_UKE.UserThumbnailImageHead) : US.ms + "img/getface.jpg", "UsSYSUN": "", "UsSYScontent": _UKE, "UsName": _UKE.FriendsDescript || _UKE.UserNickName || _UKE.GroupManageName, "UsType": _UKE.MessageIsVerify || 0 });
  81. }
  82. }
  83. }
  84. }
  85. }
  86. try { //云端浏览器
  87. if (_UET) {
  88. if (_UTF[0]) { _UET.news(U.MS.jsonToStr(_UCE[1])); }
  89. if (_UTF[1]) { _UET.ftpshow(U.MS.jsonToStr(_UCE[0])); } else { _UET.QXftpshow(); } //属于普通消息 //闪烁消息
  90. _UCE[0] = _UCE[1] = null; CollectGarbage(); return null;
  91. }
  92. } catch (e) { } //html5消息查看
  93. // if ((_UET = U.MN.Noti({ t: 3000 }))) {
  94. // for (i = 0; i < _UCE.length; i++) {
  95. // for (j = 0; j < _UCE[i].length; j++) {
  96. // _UKE = _UCE[i][j].UsSYScontent;
  97. // _USE = $$("div", { "innerHTML": _UKE.MessageContent });
  98. // (_UKE.MessageIsVerify === 0) && (_UET.create("来自" + _UKE.UserNickName, { body: _USE.innerText ? _USE.innerText : "图片分享", icon: U.M.GetImgU(_UKE.UserThumbnailImageHead) },
  99. // { oc: U.M.apply(null, [[U.F.N.ZMTSOC, [_UCE[i][j].UsType, _UKE]]]) }));
  100. // }
  101. // }
  102. // }
  103. }
  104. //本地应用点击处理
  105. U.F.N.ZMTSOC = function (UTP, UDE) {
  106. window.focus();
  107. YDHJH(UTP, UDE);
  108. }
  109. //点击查看消息
  110. U.F.N.CKHFXT = function (UDE) {
  111. var i, j, _UTF, _UT, _UDM, _UKE, _UFE, _UMV, //变量定义
  112. _UCE = U.F.N.MSE; //还有消息数组
  113. for (j = 0; j < UDE.length; j++) { //循环消息数组 0 好友消息, 1群消息
  114. _UFE = UDE[j];
  115. if (_UFE) { //判断是否存在
  116. for (i = 0; i < _UFE.length; i++) { //好友消息或者群消息循环处理 由于好友或者群消息有多种消息 如添加还有消息、好友聊天消息,进入群消息,群聊天消息等,
  117. _UDM = _UFE[i]; //消息内容
  118. _UTF = _UDM.UserId == null;
  119. _UT = true;
  120. _UMV = _UDM.MessageIsVerify || 0;
  121. (!_UCE[_UMV]) && (_UCE[_UMV] = []);
  122. switch (_UMV) {
  123. case 0: case undefined: //好友或者群聊天消息
  124. _UKE = U.F.W.IsCreateForm(_UDM.UserId || _UDM.GroupManageID); //判断好友消息窗口是否打开
  125. if (_UKE[1]) { //显示消息
  126. //U.F.FM.SendChatMessageToDb
  127. U.F.FM.SendChatMessageToDb(_UDM.UserId || _UDM.GroupManageID, "", U.M.apply(this, [[U.F.FM.AsynReceiveMessages, [_UTF, [_UDM, _UKE[1][1]]]]]), _UTF);
  128. }
  129. else { //消息提示区域
  130. _UDM.MessageSendTime = _UDM.MessageSendTime || _UDM.GroupMessageSendTime;
  131. }
  132. U.F.FM.RecentContacts(_UDM); //生成最近联系人
  133. break;
  134. case 1: case 2: case 4: //添加好友获取群友进群消息提示 //确定通过好友申请
  135. (!_UCE[_UMV]) && (_UCE[_UMV] = []); _UCE[_UMV].push(_UDM);
  136. break;
  137. case 3: //用户给拉入群处理 这里不做处理下面统一处理
  138. break;
  139. case 5: //群文档消息 这里不做处理,下面统一处理
  140. break;
  141. }
  142. _UKE = _$(_UCE[_UMV]).Where({ "$or": { "$e": { GroupManageID: _UFE[i].GroupManageID, UserId: _UFE[i].UserId } }, "$ne": { GroupManageID: null, UserId: null } })[0]; //获取消息是否已经存在 存在直接就添加消息数字
  143. if (_UMV != 3 && _UMV != 5 && _UKE) { //消息存在数量添加
  144. if (_UFE[i].GroupManageID) {
  145. _UKE.UCN = _UFE[i].UCN;
  146. }
  147. else {
  148. _UKE.UCN += _UFE[i].UCN;
  149. }
  150. }
  151. else { //互动消息设置
  152. _UCE[_UMV].push(_UFE[i]);
  153. }
  154. }
  155. }
  156. }
  157. U.F.N.CKAGQYH(_UCE); //添加好友消息提醒
  158. }
  159. //消息移除处理
  160. U.F.N.XXYCCL = function (UDE, UIE) {
  161. var _USE,
  162. i = UIE || U.Ut.isObject(UDE) ? (UIE = (UDE.MessageIsVerify || 0)) : 0,
  163. _UL = U.Ut.isNumber(UIE) ? UIE + 1 : UIE,
  164. _UAE = U.F.N.MSE;
  165. for (; i < _UL; i++) { //删除消息
  166. _$(_UAE[i]).Delete({ GroupManageID: UDE.GroupManageID, UserId: UDE.UserId });
  167. }
  168. }
  169. //用户给拉入群处理
  170. U.F.N.CKHFXTQX = function (UDE) {
  171. var _UTF = _$(US.Friend[2]).Select({ "GroupManageID": UDE.MessageContent })[0];
  172. if (!_UTF) { //添加进入群同时加载
  173. U.Alert("您给" + UDE.UserNickName + "加入讨论组");
  174. U.F.N.LYHJQCL(UDE);
  175. }
  176. else { //删除群消息
  177. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteMessageById", US.userInfo.userid, UDE.MessageID], U.M.apply(), [""]);
  178. }
  179. }
  180. //#region 追随者消息
  181. //添加好友或者进入群消息提示
  182. U.F.N.CKAGQYH = function (UDE) {
  183. for (var i = 0; i < 6; i++) { //消息处理
  184. U.F.N.ZSHFXT(UDE[i], i); //弹出消息框
  185. }
  186. }
  187. //追随者消息提醒
  188. U.F.N.ZSHFXT = function (UDE, UTF) {
  189. var i, _UFN, _UDND, _UDTD, _UDCD, _UDPD, _UDMD, _UDAD, _UN, _PDW,
  190. _UDSD = $$("frag");
  191. if ($("#UD_SYSSRXAFT")[0] != undefined) {
  192. if ($("#U_Boom_NCT")[0] == null) {
  193. _UDND = U.UI.From({
  194. id: "U_Boom_NCT", style: {
  195. width: "300px", height: "209px",
  196. background: "#ffffff", padding: "0", border: "0", "display": "none", maxWidth: "300px"
  197. },
  198. content: $("#UD_SYSSRXAFT")[0], min: false, draw: false, title: "系统消息",
  199. hst: { style: { "padding": "0 0 0 10px" } }
  200. })
  201. }
  202. var _UDOD = $("#UD_SYSSRXOA")[0];
  203. //清空消息内容
  204. if (UTF == 0) {
  205. _UDOD.innerText = "";
  206. }
  207. if (_UDOD && UDE && UDE.length) {
  208. _UDPD = $(_UDOD).Parent();
  209. _UDMD = $(_UDPD).Parent();
  210. _UDAD = $(_UDPD).Child();
  211. for (i = 0; i < UDE.length; i++) {
  212. //消息内容设置
  213. $(".UD_SYSSRXT")[0].innerHTML = UDE[i].UCN
  214. _UN = UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName;
  215. switch (UTF) {
  216. case 0: //聊天消息处理
  217. _UFN = null;
  218. _PDW = "您有" + UDE[i].UCN + "消息未读";
  219. break;
  220. case 1:
  221. _UFN = [_UN + "添加您为好友", [U.F.N.TJZSHFXT, [UDE, UDE[i], _UDTD]]];
  222. _PDW = "添加您为好友";
  223. break;
  224. case 2:
  225. _UFN = [_UN + "请求加入该群", [U.F.N.CGAddGroup, [UDE, UDE[i], _UDTD]]]
  226. _PDW = "请求加入该群";
  227. break;
  228. case 3:
  229. _UFN = [_UN + "邀请您加入讨论组", [U.F.N.LYHJQCL, [UDE[i]]]];
  230. _PDW = "邀请您加入讨论组";
  231. break;
  232. case 4:
  233. _UFN = [_UN + "同意添加你为好友", [U.F.N.AsynTJZSHFXT, [UDE, UDE[i], _UDTD]]];
  234. _PDW = "同意添加你为好友";
  235. break;
  236. case 5:
  237. var _group = _$(US.Friend[2]).Select({ GroupManageID: UDE[i].MessageContent.split(",")[0] });
  238. _UFN = [[[U.F.W.PopupFriendsForm, [_group[0]]], [U.F.N.QZSHFXT, [UDE[i].MessageID || UDE[i].GroupMessageID, UDE, "this"]], [U.F.N.AsynQW, [UDE[i]]]]];
  239. _PDW = "在群上上传文件";
  240. break;
  241. }
  242. if (_UFN == null) {
  243. _UDTD = $$("div", { "className": "UD_SYSSRXOO", "title": "消息" }, _UDSD);
  244. _UDTD.onclick = U.M.apply(_UDTD, [[U.F.W.PopupFriendsForm, [UDE[i]]], [U.F.N.QZSHFXT, [UDE[i].MessageID || UDE[i].GroupMessageID, UDE, _UDTD]]]);
  245. }
  246. else if (_UFN.length == 1) {
  247. _UDTD = $$("div", { "className": "UD_SYSSRXOO", "title": "消息" }, _UDSD);
  248. _UDTD.onclick = U.M.apply(_UDTD, _UFN[0]);
  249. }
  250. else {
  251. _UDTD = $$("div", { "className": "UD_SYSSRXOO", "title": UTF ? "好友消息" : "群消息" }, _UDSD);
  252. _UDTD.onclick = U.M.apply(_UDTD, [[U.UI.Confirm, _UFN], [U.F.N.QZSHFXT, [UDE[i].MessageID, UDE, _UDTD]]]); //添加好友
  253. }
  254. _UDCD = $$("div", { "className": "UD_SYSSRXOOI" }, _UDTD);
  255. //群头像
  256. if (UDE[i].GroupManageID) {
  257. var _UDNDS = $$("div", { "className": "UD_SYHRCOONTw" }, _UDTD);
  258. U.F.PrintGroupHeadImage(UDE[i], _UDNDS, 4, [35, 35]);
  259. }
  260. else {
  261. $$("img", {
  262. "onerror": U.M.ImgError, "alt": UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName,
  263. "src": U.M.GetImgU(UDE[i].UserThumbnailImageHead)
  264. }, _UDCD);
  265. }
  266. $$("div", { "className": "UD_SYSSRXOON UTDF", "innerHTML": _UN }, _UDTD);
  267. $$("div", { "className": "UD_SYSSRXOONT UTDF", "innerHTML": _PDW }, _UDTD);
  268. $$("div", { "className": "UD_SYSSRXOOC", "style": { "cssText": "float:right" }, "innerHTML": "查看", "onclick": [[U.M.StopBubble], [U.U.I.ViewOtherUserInfo, [UDE[i].UserId]], /*[U.F.N.QZSHFXT, [UDE[i].MessageID, UDE, _UDTD]]*/] }, _UDTD); //查看消息
  269. }
  270. _UDMD.onclick = null;
  271. _UDOD.appendChild(_UDSD);
  272. U.F.N.NCTFU();
  273. }
  274. }
  275. return _UDOD;
  276. }
  277. /**
  278. * 判断字符串是否为Guid
  279. *
  280. * @param {object} 群的数据
  281. * @return {element} 需要显示框的内容
  282. */
  283. U.F.N.AsynQW = function (UDE) {
  284. var _groupid = UDE.MessageContent.split(",")[0]; //获取群id
  285. var _group = _$(US.Friend[2]).Select({ GroupManageID: _groupid }); //根据前段数组US.Friend[2]里所有的用户群里获取当前群id等于指定id的群数据
  286. var _news = { //聊天消息的数据
  287. FriendsDescript: "由" + UDE.MessageContent.split(",")[1] + "发起的互联办公群组。",
  288. IsLogin: 0,
  289. MessageSendTime: "" + UDE.MessageContent.split(",")[2] + "",
  290. UserId: "" + UDE.MessageContent.split(",")[0] + "", UserImageHead: null,
  291. UserIndividualitysignature: "", UserName: "" + UDE.MessageContent.split(",")[1] + "", UserNickName: "" + UDE.MessageContent.split(",")[1] + "",
  292. UserThumbnailImageHead: null, tf: 1
  293. };
  294. var _files = { // 需要弹出uw文件的文件信息
  295. P: 1,
  296. UseFilesServerThumbnailName: null,
  297. UserDirectoryEncrypt: _groupid,
  298. UserDirectoryID: _groupid,
  299. UserFilesDescript: null,
  300. UserFilesExtendName: "" + UDE.MessageContent.split(",")[4].split(".")[1] + "",
  301. UserFilesID: "" + UDE.MessageContent.split(",")[3] + "",
  302. UserFilesModifyTime: "" + UDE.MessageSendTime + "",
  303. UserFilesName: "" + UDE.MessageContent.split(",")[1] + "", UserFilesServerName: "",
  304. UserId: "" + UDE.UserId + ""
  305. };
  306. if (_group[0]) {
  307. var _UKE = U.F.W.IsCreateForm(_group[0].GroupManageID); //判断群是否给打开
  308. if (_UKE[1]) { //如果群给打开直接写入一个文件聊天消息
  309. var First = $$("div", { "className": "UD_QWJCSS" }, $("div.UD_SYFC", _UKE[1][1])[0]); // $(".UD_SYFCA")[1]
  310. $$("div", { "className": "UD_QWJCSS_O", "innerHTML": UDE.MessageContent.split(",")[2] }, First);
  311. var kInner = $$("div", { "className": "UD_QWJCSS_T" }, First);
  312. $$("div", { "className": "UD_QWJCSS_T_O", "innerHTML": "" + UDE.MessageDescript + "邀请您参与编辑文档,快去看看吧" }, kInner);
  313. var BS = $$("div", { "className": "UD_QWJCSS_T_T", "onclick": [[U.D.Office.Word, [US.userInfo, _files]]] }, kInner);
  314. $$("div", { "className": "UD_QWJCSS_T_T_O" }, BS);
  315. $$("div", { "className": "UD_QWJCSS_T_T_T", "innerHTML": UDE.MessageContent.split(",")[4] }, BS);
  316. $$("div", { "className": "UD_QWJCSS_T_T_S", "innerHTML": "....." }, BS);
  317. }
  318. U.F.FM.RecentContacts(_news); //生成最近联系人
  319. }
  320. }
  321. U.F.N.NCTFU = function () {
  322. if ($("#U_Boom_NCT")[0].style.display == "none") {
  323. $("#U_Boom_NCT")[0].style.top = document.body.offsetHeight - 210 + "px";
  324. $("#U_Boom_NCT")[0].style.left = document.body.offsetWidth - 360 + "px";
  325. }
  326. $("#U_Boom_NCT")[0].style.display = "block";
  327. // $(".UD_SYSSRXT")[0].style.display = "block"
  328. }
  329. U.F.N.NCTBlock = function () {
  330. $("#U_Boom_NCT")[0].style.display = "block"
  331. }
  332. //成功添加用户进入群
  333. U.F.N.CGAddGroup = function (UGE, UDE, UDOD) {
  334. var _UFID = Guid.newGuid(),
  335. _UFE = _$(US.Friend[3]).Select({ "GroupManageID": UDE.MessageContent, "UserId": UDE.UserId }, null, 1)[0];
  336. if (_UFE) {
  337. U.Alert("添加成功");
  338. }
  339. else {
  340. U.A.Request(US.Auth, ["AddUsrsToGroup", US.userInfo.userid, UDE.MessageID, UDE.UserId, UDE.MessageContent.toUpperCase(), _UFID, UDE.MessageDescript]), U.F.N.AsynCGAddGroup, ["", UDE, _UFID];
  341. }
  342. U.F.N.QZSHFXT(UDE.MessageID, UGE, UDOD, true); //清除
  343. }
  344. //添加群进入
  345. U.F.N.AsynCGAddGroup = function (r) {
  346. var context = r.context,
  347. _UDE = context[1],
  348. _UFID = context[2];
  349. US.Friend[3].push(U.F.T.GroupUserEntity(_UDE.UserId, _UDE.UserImageHead, _UDE.UserNickName, _UDE.UserNickName, _UDE.UserThumbnailImageHead, _UDE.MessageContent.toUpperCase(), _UDE.MessageID, 1));
  350. }
  351. //确定添加好友处理
  352. U.F.N.TJZSHFXT = function (UGE, UDE, UDOD) {
  353. var _UFE = _$(US.Friend[1]).Select({ "UserId": UDE.UserId }, null, 1)[0]; //判断用户是否在好友分组里
  354. if (!_UFE) { //好友不存在自己的列表
  355. U.F.M.AddFriend(UDE, null, "0"); //添加他人进入群
  356. return false;
  357. }
  358. else { //判断是否需要添加用户
  359. U.F.W.PopupFriendsForm(_UFE);
  360. }
  361. U.F.N.QZSHFXT(UDE.MessageID, UGE, UDOD); //清除
  362. }
  363. /**
  364. * 异步处理确定添加好友
  365. *
  366. * @param {object} 确定添加对方为好友
  367. */
  368. U.F.N.AsynTJZSHFXT = function (UGE, UDE, UDOD) {
  369. var _UFID = Guid.newGuid(),
  370. _UFE = _$(US.Friend[1]).Select({ "UserId": UDE.UserId })[0];
  371. if (!_UFE) { //如果好友没有添加处理
  372. U.A.Request(US.Auth, ["AddFriend", UIF.UserId, _UFID, UDE.MessageContent, UDE.MessageDescript], U.F.N.AsynAddFriend, [null, UDE, UDE.MessageContent, _UFID]); //添加好友到默认分组
  373. }
  374. else {
  375. U.F.W.PopupFriendsForm(_UFE);
  376. }
  377. U.F.N.QZSHFXT(UDE.MessageID, UGE, UDOD); //清除消息
  378. }
  379. /**
  380. * 异步处理确定添加好友
  381. *
  382. * @param {object} 确定添加对方为好友
  383. */
  384. U.F.N.AsynAddFriend = function (r) {
  385. var context = r.context,
  386. _UDE = context[1],
  387. _UGID = context[2],
  388. _UFID = context[3];
  389. r = r.value;
  390. U.F.M.DisplayAddFriend(r[0][0], _UFID, _UGID, r); //确定添加好友到好友分组里
  391. }
  392. //清除所有的的添加好友信息
  393. U.F.N.QZSHFXT = function (UMID, UDE, UDOD, UTF) {
  394. var _UDPD = $(UDOD).Parent();
  395. U.F.N.XXYCCL(UDE);
  396. if (UMID) {
  397. _$(UDE).Delete({ "MessageID": UMID });
  398. if (_UDPD) {
  399. $(UDOD).remove();
  400. //_UDPD = $(_UDPD).Parent();
  401. //$(_UDPD).parentg().childg(0, 0).html(UDE.length);
  402. //$(_UDPD).Child()[2].innerText = "有" + UDE.length + "个新追随者";
  403. }
  404. } //单个消息移除
  405. //消息清空 隐藏消息
  406. (!UTF) && (U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteMessageById", UMID || _$(UDE).pluck("MessageID").join(",")]), U.M.apply(), []); //清除所有追随者添加的信息
  407. // (!UTF) && (U.A.Request(US.Auth,"UseStudioManage.canceluseraddtogrouprequest", [US.userInfo.userid, UMID || _$(UDE).pluck("MessageID").join(",") ]), U.M.apply(), [""]); //清除所有追随者添加的信息
  408. }
  409. //#endregion
  410. //好友和群消息
  411. U.F.N.XXHFXT = function (UDE) {
  412. var i, _UDSD, _UDND, _UDTDr,
  413. _UDOD = $("#UD_SYHRC")[0],
  414. _UDTD = $("div", _UDOD)[0],
  415. _UDFD = $$("frag");
  416. _UDTD.innerText = "";
  417. //_UDFDF = $$("fragg");
  418. _UDODT = $("#UD_SYSSRXOA")[0];
  419. if (UDE && UDE.length) {
  420. for (i = 0; i < UDE.length; i++) {
  421. (_UDTDr = $$("div", { "className": "UD_SYSSRXOO", "title": "消息", "onclick": [[U.M.StopBubble], [U.F.W.PopupFriendsForm, [UDE[i]]], [U.F.N.QZSHFXT, [UDE[i].MessageID || UDE[i].GroupMessageID, UDE, _UDTDr]]] }))//.onclick = U.M.apply(_UDTDr, [[U.UI.Confirm, _UFN], [U.F.N.QZSHFXT, [UDE[i].MessageID, UDE, _UDTD]]]); //添加好友
  422. _UDCD = $$("div", { "className": "UD_SYSSRXOOI" }, _UDTDr);
  423. if (UDE[i].GroupManageID) {
  424. _UDNDS = $$("div", { "className": "UD_SYHRCOONTw" }, _UDTDr);
  425. U.F.PrintGroupHeadImage(UDE[i], _UDNDS, 4, [35, 35]);
  426. } //群头像
  427. else { $$("img", { "onerror": U.M.ImgError, "alt": UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName, "src": U.M.GetImgU(UDE[i].UserThumbnailImageHead) }, _UDCD); }
  428. $$("div", { "className": "UD_SYSSRXOON UTDF", "innerHTML": UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName }, _UDTDr);
  429. $$("div", { "className": "UD_SYSSRXOONT UTDF", "innerHTML": "您有" + UDE[i].UCN + "消息未读" }, _UDTDr);
  430. $$("div", { "className": "UD_SYSSRXOOC", "style": { "cssText": "float:right" }, "innerHTML": "查看" }, _UDTDr); //查看消息
  431. _UDODT.appendChild(_UDTDr);
  432. }
  433. //_UDTD.appendChild(_UDFD);
  434. }
  435. }
  436. /**
  437. * 提供好友和群统一接口实现信息回调
  438. *
  439. * @param {bool} 接收的消息类型
  440. * true 群消息
  441. * false 好友消息
  442. * @param {string} 好友或者群消息
  443. * @param {object} 获取查看的好友消息
  444. */
  445. U.F.FM.AsynReceiveMessages = function (isgroup, chatform, r) {
  446. //如果是群消息查看
  447. if (isgroup) {
  448. U.F.W.PrintGroupChatMessage($("div.UD_SYFC", chatform)[0], r); //打印群消息
  449. }
  450. //好友消息的查看
  451. else {
  452. U.F.W.PrintFriendChatMessage($("div.UD_SYFC", chatform)[0], r); //打印好友消息
  453. }
  454. }
  455. //拉用户进入群处理
  456. U.F.N.LYHJQCL = function (UDE) {
  457. U.A.Request(US.Auth, ["GetJoinGroupNews", US.userInfo.userid, UDE.MessageID, UDE.MessageContent], U.F.N.AsynLYHJQCL, ["", UDE]); //拉用户进入群组
  458. }
  459. //拉用户进入群组异步
  460. U.F.N.AsynLYHJQCL = function (r) {
  461. if (r.value != "") {
  462. var i, _UFE, _UAE,
  463. _userid = US.userInfo.userid,
  464. context = r.context,
  465. UDE = context[1],
  466. _UGE = US.Disk.Disks[_userid];
  467. r = r.value;
  468. _UFE = r[0];
  469. US.Friend[2].unshift((_UAE = new U.F.T.GroupEntity(UDE.MessageContent.toLocaleLowerCase(), UDE.MessageDescript, U.MT.toTimeStamp(new Date()), UDE.UserId, "", null))); //创建群
  470. U.Dk.M.Entity.Add(r[1], _UGE);
  471. U.Dk.M.Entity.Add([new U.Dk.M.Entity([_UAE.GroupManageID, 0, _userid, _UAE.GroupManageName, _UAE.GroupManageName, "folder", null, new Date(), U.UP.FFT("folder")[1], 1, null, null, 0, "", _UAE.GroupManageID])], _UGE, true);
  472. for (i = 0; i < _UFE.length; i++) {
  473. if (!_$(US.Friend[3]).Select({ "GroupManageID": _UFE[i].GroupManageID || _UFE[i].MessageContent, "UserId": _UFE[i].UserId || _UFE[i].UserId })[0]) {
  474. US.Friend[3].push(new U.F.T.GroupUserEntity((_UFE[i].UserId || _UFE[i].MessageSendUserID, U.M.GetImgU(_UFE[i].UserImageHead), _UFE[i].UserNickName || _UFE[i].UserName, _UFE[i].UserName, U.M.GetImgU(_UFE[i].UserThumbnailImageHead), _UFE[i].GroupUsersDescript || _UFE[i].UserNickName, _UFE[i].GroupManageID || _UFE[i].MessageContent, 1)));
  475. }
  476. } //添加群友
  477. $($("#UD_SYHZLTA").Child()[2]).Child()[0].onclick(); return US.Friend[2][0]; //直接切换到群
  478. }
  479. }
  480. //#endregion
  481. //#region
  482. //查看即时消息
  483. U.F.N.CKHFXTPB = function (UDE) {
  484. var i, j, _ULE, _UTF, _UPE, _UCE, _UKE, _UME, _UNE, _UDOD,
  485. _userid = US.userInfo.userid;
  486. if ((UDE = UDE[4])) {
  487. for (i = 0; i < UDE.length; i++) {
  488. _UCE = UDE[i];
  489. if (_UCE.UserId != _userid) {
  490. switch (_UCE["NEWTYPE"]) {
  491. case "UPBR": //学习系统回复信息或者blog回复信息
  492. eval("0,_UKE =" + _UCE["ET"]);
  493. _UNE = US.PB.News[0];
  494. _UME = (_UCE["ET"] = _$(_UNE).Select({ "ArticleID": _UKE["ArticleID"], "ReplyAddUserID": _UCE["UserId"] })[0]);
  495. if (_UME) { _UME.UCN++; }
  496. else {
  497. _UTF = _UKE.NewsType == 2;
  498. _UNE.push((_UCE["ET"] = { "PublishedDirectoryID": _UTF ? null : _UKE["PublishedDirectoryID"], "ReplyAddUserID": _UTF ? _UKE["ReplyAddUserID"] : _UCE["UserId"], "NF": _UTF ? US.NU : (_UKE["PublishedDirectoryID"] == US.PID ? null : US.PID), "ArticleContentBrief": _UTF ? _UKE["UserDirectoryName"] : _UKE["ArticleContentBrief"], "ReplyContent": _UCE["NEWC"], "UserName": _UCE["UserName"], "ArticleID": _UKE["ArticleID"], "UserThumbnailImageHead": _UCE["UserThumbnailImageHead"], "ArticleTitle": _UTF ? _UKE.ReplyContentBrief : _UKE.ArticleTitle, "UCN": _UCE["NEWT"] || 0 }));
  499. } //添加学习系统消息
  500. U.D.Blog.N.PNXX(); //打印学习系统和blog消息
  501. break;
  502. case "UD_DiskCon": case "DDisk": //Disk添加删除文件
  503. _UKE = U.Dk.DiskOperatingSwitch(US.userInfo.userid);
  504. _UPE = [];
  505. _ULE = _UKE[4][_UKE[1][1]].Child.length;
  506. if (_UKE) {
  507. _UDOD = $("#UD_SYWRZ", _UKE.pdiv)[0]; // US.Disk.UserDisk
  508. if (_UCE["NEWTYPE"] == "UD_DiskCon") {//添加文件处理
  509. eval("0,_UNE =" + _UCE["NEWC"]);
  510. _UCE["NEWC"] = (_UNE = _UNE.length == null ? [_UNE] : _UNE);
  511. _UME = _UNE[0].UserDirectoryParentID || _UNE[0].UserDirectoryID
  512. for (j = 0; j < _UNE.length; j++) {
  513. _UTF = U.Dk.M.RUS(new U.Dk.M.Entity(_UNE[j].UserFilesID || _UNE[j].UserDirectoryID, _UNE[j].UserFilesSize || 0, _UNE[j].UserDirectoryParentID || _UNE[j].UserDirectoryID, _UNE[j].UserDirectoryName || _UNE[j].UserFilesName, _UNE[j].UserDirectoryName || _UNE[j].UserFilesName, _UNE[j].UserDirectoryExtendType || _UNE[j].UserFilesExtendName, _UNE[j].UserFilesServerName, new Date(), _UNE[j].UseFilesServerThumbnailName || _UNE[j].UserDirectoryExtendType || _UNE[j].UserFilesExtendName, _UNE[j].UserDirectoryDeep || "9999.00", null, null, _UNE[j].UserDirectoryExtendType ? 0 : 1, _UNE[j].UserDirectoryDescript || _UNE[j].UserFilesDescript, _UNE[j].GroupID || _UNE[j].UserDirectoryEncrypt, "", _UCE.UserId, _UCE.UserName, _UCE.UserName, _UCE.UserThumbnailImageHead)); _UPE.push(_UTF); (_UKE[4][_UME]) && (_UKE[4][_UME].Child = _UKE[4][_UME].Child || [], _UKE[4][_UME].Child.push(_UTF)); _UKE[0].push(_UTF);
  514. }
  515. (!_ULE) && (_UDOD.innerText = "");
  516. (_userid == _UKE[1][2] && _UME == _UKE[1][1]) && (U.Dk.VW.XWPDY(_UPE, _UDOD)); //添加文件
  517. }
  518. else {//删除文件处理
  519. _UNE = _UCE["NEWC"].split(",");
  520. _UME = _UCE["NEWT"];
  521. for (j = 0; j < _UNE.length; j++) {
  522. _UTF = _$(_UKE[0]).Delete({ "UserDirectoryID": _UNE[j] })[0];
  523. (_UTF) && (_UPE.push(_UTF));
  524. } //删除文件
  525. (_userid == _UKE[1][2] && _UPE[0].UserDirectoryParentID == _UKE[1][1]) && (U.Dk.RE.AsynWPSCWJ(_UPE, US.userInfo.userid)); //删除文件提示
  526. }
  527. }
  528. break; //Disk更新目录
  529. }
  530. }
  531. }
  532. }
  533. }
  534. //下线通知区域
  535. U.F.N.DL = function (UTF) {
  536. //其它地方登录
  537. if (UTF == "upline") {
  538. U.UI.Confirm("警告", { "width": "300px", "height": "140px" }, null, null,
  539. $$("div", {
  540. "style": { "textAlign": "center", "marginTop": "25px", "padding": "10px 0", "fontSize": "14px", "color": "red" },
  541. "innerHTML": "您好, 您的账号在别处有登录!"
  542. }));
  543. U.U.L.TCUL();
  544. }
  545. //超时重新连接
  546. else {
  547. //, US.userInfo.LoginId, US.SystemId
  548. U.A.Request(US.Auth, ["UserStateLogin", US.userInfo.username, US.userInfo.UserPassword], U.M.apply(), []);
  549. }
  550. }
  551. //上线
  552. U.F.N.ST = function (UDE, UTF) {
  553. var i, j, _UAID, _UDTD,
  554. _UDOD = $("#UD_SYHZLZ")[0],
  555. _userid = US.userInfo.userid,
  556. _UFE = US.Friend;
  557. for (i = 0; i < UDE.length; i++) {
  558. if (UDE[i].length) {
  559. _UAID = UDE[i].join(",");
  560. for (j = 0; j < 3; j++) {
  561. _$(_$(_UFE[(j ? j + 2 : 1)]).Like({ "UserId": _UAID })).Change({ "IsLogin": i });
  562. } //设置用户在线状态
  563. for (j = 0; j < UDE[i].length; j++) {
  564. _UAID = $("@TID='" + UDE[i][j] + "'", _UDOD);
  565. (_UAID[0]) && (_UDTD = $(_UAID.Parent())).append(_UAID, null, i ? _UDTD[0].firstChild : null);
  566. }
  567. }
  568. }
  569. for (j = 0; j < 3; j++) {
  570. _$(US.Friend[(j ? j + 2 : 1)]).Reset({ "IsLogin": 1 });
  571. } //排序
  572. }
  573. //#endregion