U.F.N.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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({ id: "U_Boom_NCT", style: { width: "300px", height: "209px",
  194. background: "#ffffff", padding: "0", border: "0", "display": "none", maxWidth: "300px"
  195. },
  196. content: $("#UD_SYSSRXAFT")[0], min: false, draw: false, title: "系统消息",
  197. hst: { style: { "padding": "0 0 0 10px"} }
  198. })
  199. }
  200. var _UDOD = $("#UD_SYSSRXOA")[0];
  201. //清空消息内容
  202. if (UTF == 0) {
  203. _UDOD.innerText = "";
  204. }
  205. if (_UDOD && UDE && UDE.length) {
  206. _UDPD = $(_UDOD).Parent();
  207. _UDMD = $(_UDPD).Parent();
  208. _UDAD = $(_UDPD).Child();
  209. for (i = 0; i < UDE.length; i++) {
  210. //消息内容设置
  211. $(".UD_SYSSRXT")[0].innerHTML = UDE[i].UCN
  212. _UN = UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName;
  213. switch (UTF) {
  214. case 0: //聊天消息处理
  215. _UFN = null;
  216. _PDW = "您有" + UDE[i].UCN + "消息未读";
  217. break;
  218. case 1:
  219. _UFN = [_UN + "添加您为好友", [U.F.N.TJZSHFXT, [UDE, UDE[i], _UDTD]]];
  220. _PDW = "添加您为好友";
  221. break;
  222. case 2:
  223. _UFN = [_UN + "请求加入该群", [U.F.N.CGAddGroup, [UDE, UDE[i], _UDTD]]]
  224. _PDW = "请求加入该群";
  225. break;
  226. case 3:
  227. _UFN = [_UN + "邀请您加入讨论组", [U.F.N.LYHJQCL, [UDE[i]]]];
  228. _PDW = "邀请您加入讨论组";
  229. break;
  230. case 4:
  231. _UFN = [_UN + "同意添加你为好友", [U.F.N.AsynTJZSHFXT, [UDE, UDE[i], _UDTD]]];
  232. _PDW = "同意添加你为好友";
  233. break;
  234. case 5:
  235. var _group = _$(US.Friend[2]).Select({ GroupManageID: UDE[i].MessageContent.split(",")[0] });
  236. _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]]]]];
  237. _PDW = "在群上上传文件";
  238. break;
  239. }
  240. if (_UFN == null) {
  241. _UDTD = $$("div", { "className": "UD_SYSSRXOO", "title": "消息" }, _UDSD);
  242. _UDTD.onclick = U.M.apply(_UDTD, [[U.F.W.PopupFriendsForm, [UDE[i]]], [U.F.N.QZSHFXT, [UDE[i].MessageID || UDE[i].GroupMessageID, UDE, _UDTD]]]);
  243. }
  244. else if (_UFN.length == 1) {
  245. _UDTD = $$("div", { "className": "UD_SYSSRXOO", "title": "消息" }, _UDSD);
  246. _UDTD.onclick = U.M.apply(_UDTD, _UFN[0]);
  247. }
  248. else {
  249. _UDTD = $$("div", { "className": "UD_SYSSRXOO", "title": UTF ? "好友消息" : "群消息" }, _UDSD);
  250. _UDTD.onclick = U.M.apply(_UDTD, [[U.UI.Confirm, _UFN], [U.F.N.QZSHFXT, [UDE[i].MessageID, UDE, _UDTD]]]); //添加好友
  251. }
  252. _UDCD = $$("div", { "className": "UD_SYSSRXOOI" }, _UDTD);
  253. //群头像
  254. if (UDE[i].GroupManageID) {
  255. var _UDNDS = $$("div", { "className": "UD_SYHRCOONTw" }, _UDTD);
  256. U.F.PrintGroupHeadImage(UDE[i], _UDNDS, 4, [35, 35]);
  257. }
  258. else {
  259. $$("img", { "onerror": U.M.ImgError, "alt": UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName,
  260. "src": U.M.GetImgU(UDE[i].UserThumbnailImageHead)
  261. }, _UDCD);
  262. }
  263. $$("div", { "className": "UD_SYSSRXOON UTDF", "innerHTML": _UN }, _UDTD);
  264. $$("div", { "className": "UD_SYSSRXOONT UTDF", "innerHTML": _PDW }, _UDTD);
  265. $$("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); //查看消息
  266. }
  267. _UDMD.onclick = null;
  268. _UDOD.appendChild(_UDSD);
  269. U.F.N.NCTFU();
  270. }
  271. }
  272. return _UDOD;
  273. }
  274. /**
  275. * 判断字符串是否为Guid
  276. *
  277. * @param {object} 群的数据
  278. * @return {element} 需要显示框的内容
  279. */
  280. U.F.N.AsynQW = function (UDE) {
  281. var _groupid = UDE.MessageContent.split(",")[0]; //获取群id
  282. var _group = _$(US.Friend[2]).Select({ GroupManageID: _groupid }); //根据前段数组US.Friend[2]里所有的用户群里获取当前群id等于指定id的群数据
  283. var _news = { //聊天消息的数据
  284. FriendsDescript: "由" + UDE.MessageContent.split(",")[1] + "发起的互联办公群组。",
  285. IsLogin: 0,
  286. MessageSendTime: "" + UDE.MessageContent.split(",")[2] + "",
  287. UserId: "" + UDE.MessageContent.split(",")[0] + "", UserImageHead: null,
  288. UserIndividualitysignature: "", UserName: "" + UDE.MessageContent.split(",")[1] + "", UserNickName: "" + UDE.MessageContent.split(",")[1] + "",
  289. UserThumbnailImageHead: null, tf: 1
  290. };
  291. var _files = { // 需要弹出uw文件的文件信息
  292. P: 1,
  293. UseFilesServerThumbnailName: null,
  294. UserDirectoryEncrypt: _groupid,
  295. UserDirectoryID: _groupid,
  296. UserFilesDescript: null,
  297. UserFilesExtendName: "" + UDE.MessageContent.split(",")[4].split(".")[1] + "",
  298. UserFilesID: "" + UDE.MessageContent.split(",")[3] + "",
  299. UserFilesModifyTime: "" + UDE.MessageSendTime + "",
  300. UserFilesName: "" + UDE.MessageContent.split(",")[1] + "", UserFilesServerName: "",
  301. UserId: "" + UDE.UserId + ""
  302. };
  303. if (_group[0]) {
  304. var _UKE = U.F.W.IsCreateForm(_group[0].GroupManageID); //判断群是否给打开
  305. if (_UKE[1]) { //如果群给打开直接写入一个文件聊天消息
  306. var First = $$("div", { "className": "UD_QWJCSS" }, $("div.UD_SYFC", _UKE[1][1])[0]); // $(".UD_SYFCA")[1]
  307. $$("div", { "className": "UD_QWJCSS_O", "innerHTML": UDE.MessageContent.split(",")[2] }, First);
  308. var kInner = $$("div", { "className": "UD_QWJCSS_T" }, First);
  309. $$("div", { "className": "UD_QWJCSS_T_O", "innerHTML": "" + UDE.MessageDescript + "邀请您参与编辑文档,快去看看吧" }, kInner);
  310. var BS = $$("div", { "className": "UD_QWJCSS_T_T", "onclick": [[U.D.Office.Word, [US.userInfo, _files]]] }, kInner);
  311. $$("div", { "className": "UD_QWJCSS_T_T_O" }, BS);
  312. $$("div", { "className": "UD_QWJCSS_T_T_T", "innerHTML": UDE.MessageContent.split(",")[4] }, BS);
  313. $$("div", { "className": "UD_QWJCSS_T_T_S", "innerHTML": "....." }, BS);
  314. }
  315. U.F.FM.RecentContacts(_news); //生成最近联系人
  316. }
  317. }
  318. U.F.N.NCTFU = function () {
  319. if ($("#U_Boom_NCT")[0].style.display == "none") {
  320. $("#U_Boom_NCT")[0].style.top = document.body.offsetHeight - 210 + "px";
  321. $("#U_Boom_NCT")[0].style.left = document.body.offsetWidth - 360 + "px";
  322. }
  323. $("#U_Boom_NCT")[0].style.display = "block";
  324. // $(".UD_SYSSRXT")[0].style.display = "block"
  325. }
  326. U.F.N.NCTBlock = function () {
  327. $("#U_Boom_NCT")[0].style.display = "block"
  328. }
  329. //成功添加用户进入群
  330. U.F.N.CGAddGroup = function (UGE, UDE, UDOD) {
  331. var _UFID = Guid.newGuid(),
  332. _UFE = _$(US.Friend[3]).Select({ "GroupManageID": UDE.MessageContent, "UserId": UDE.UserId }, null, 1)[0];
  333. if (_UFE) {
  334. U.Alert("添加成功");
  335. }
  336. else {
  337. 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];
  338. }
  339. U.F.N.QZSHFXT(UDE.MessageID, UGE, UDOD, true); //清除
  340. }
  341. //添加群进入
  342. U.F.N.AsynCGAddGroup = function (r) {
  343. var context = r.context,
  344. _UDE = context[1],
  345. _UFID = context[2];
  346. US.Friend[3].push(U.F.T.GroupUserEntity(_UDE.UserId, _UDE.UserImageHead, _UDE.UserNickName, _UDE.UserNickName, _UDE.UserThumbnailImageHead, _UDE.MessageContent.toUpperCase(), _UDE.MessageID, 1));
  347. }
  348. //确定添加好友处理
  349. U.F.N.TJZSHFXT = function (UGE, UDE, UDOD) {
  350. var _UFE = _$(US.Friend[1]).Select({ "UserId": UDE.UserId }, null, 1)[0]; //判断用户是否在好友分组里
  351. if (!_UFE) { //好友不存在自己的列表
  352. U.F.M.AddFriend(UDE, null, "0"); //添加他人进入群
  353. return false;
  354. }
  355. else { //判断是否需要添加用户
  356. U.F.W.PopupFriendsForm(_UFE);
  357. }
  358. U.F.N.QZSHFXT(UDE.MessageID, UGE, UDOD); //清除
  359. }
  360. /**
  361. * 异步处理确定添加好友
  362. *
  363. * @param {object} 确定添加对方为好友
  364. */
  365. U.F.N.AsynTJZSHFXT = function (UGE, UDE, UDOD) {
  366. var _UFID = Guid.newGuid(),
  367. _UFE = _$(US.Friend[1]).Select({ "UserId": UDE.UserId })[0];
  368. if (!_UFE) { //如果好友没有添加处理
  369. U.A.Request(US.Auth, ["AddFriend", UIF.UserId, _UFID, UDE.MessageContent, UDE.MessageDescript], U.F.N.AsynAddFriend, [null, UDE, UDE.MessageContent, _UFID]); //添加好友到默认分组
  370. }
  371. else {
  372. U.F.W.PopupFriendsForm(_UFE);
  373. }
  374. U.F.N.QZSHFXT(UDE.MessageID, UGE, UDOD); //清除消息
  375. }
  376. /**
  377. * 异步处理确定添加好友
  378. *
  379. * @param {object} 确定添加对方为好友
  380. */
  381. U.F.N.AsynAddFriend = function (r) {
  382. var context = r.context,
  383. _UDE = context[1],
  384. _UGID = context[2],
  385. _UFID = context[3];
  386. r = r.value;
  387. U.F.M.DisplayAddFriend(r[0][0], _UFID, _UGID, r); //确定添加好友到好友分组里
  388. }
  389. //清除所有的的添加好友信息
  390. U.F.N.QZSHFXT = function (UMID, UDE, UDOD, UTF) {
  391. var _UDPD = $(UDOD).Parent();
  392. U.F.N.XXYCCL(UDE);
  393. if (UMID) {
  394. _$(UDE).Delete({ "MessageID": UMID });
  395. if (_UDPD) {
  396. $(UDOD).remove();
  397. //_UDPD = $(_UDPD).Parent();
  398. //$(_UDPD).parentg().childg(0, 0).html(UDE.length);
  399. //$(_UDPD).Child()[2].innerText = "有" + UDE.length + "个新追随者";
  400. }
  401. } //单个消息移除
  402. //消息清空 隐藏消息
  403. (!UTF) && (U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteMessageById", UMID || _$(UDE).pluck("MessageID").join(",")]), U.M.apply(), []); //清除所有追随者添加的信息
  404. // (!UTF) && (U.A.Request(US.Auth,"UseStudioManage.canceluseraddtogrouprequest", [US.userInfo.userid, UMID || _$(UDE).pluck("MessageID").join(",") ]), U.M.apply(), [""]); //清除所有追随者添加的信息
  405. }
  406. //#endregion
  407. //好友和群消息
  408. U.F.N.XXHFXT = function (UDE) {
  409. var i, _UDSD, _UDND, _UDTDr,
  410. _UDOD = $("#UD_SYHRC")[0],
  411. _UDTD = $("div", _UDOD)[0],
  412. _UDFD = $$("frag");
  413. _UDTD.innerText = "";
  414. //_UDFDF = $$("fragg");
  415. _UDODT = $("#UD_SYSSRXOA")[0];
  416. if (UDE && UDE.length) {
  417. for (i = 0; i < UDE.length; i++) {
  418. (_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]]]); //添加好友
  419. _UDCD = $$("div", { "className": "UD_SYSSRXOOI" }, _UDTDr);
  420. if (UDE[i].GroupManageID) {
  421. _UDNDS = $$("div", { "className": "UD_SYHRCOONTw" }, _UDTDr);
  422. U.F.PrintGroupHeadImage(UDE[i], _UDNDS, 4, [35, 35]);
  423. } //群头像
  424. else { $$("img", { "onerror": U.M.ImgError, "alt": UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName, "src": U.M.GetImgU(UDE[i].UserThumbnailImageHead) }, _UDCD); }
  425. $$("div", { "className": "UD_SYSSRXOON UTDF", "innerHTML": UDE[i].FriendsDescript || UDE[i].UserNickName || UDE[i].GroupManageName }, _UDTDr);
  426. $$("div", { "className": "UD_SYSSRXOONT UTDF", "innerHTML": "您有" + UDE[i].UCN + "消息未读" }, _UDTDr);
  427. $$("div", { "className": "UD_SYSSRXOOC", "style": { "cssText": "float:right" }, "innerHTML": "查看" }, _UDTDr); //查看消息
  428. _UDODT.appendChild(_UDTDr);
  429. }
  430. //_UDTD.appendChild(_UDFD);
  431. }
  432. }
  433. /**
  434. * 提供好友和群统一接口实现信息回调
  435. *
  436. * @param {bool} 接收的消息类型
  437. * true 群消息
  438. * false 好友消息
  439. * @param {string} 好友或者群消息
  440. * @param {object} 获取查看的好友消息
  441. */
  442. U.F.FM.AsynReceiveMessages = function (isgroup, chatform, r) {
  443. //如果是群消息查看
  444. if (isgroup) {
  445. U.F.W.PrintGroupChatMessage($("div.UD_SYFC", chatform)[0], r); //打印群消息
  446. }
  447. //好友消息的查看
  448. else {
  449. U.F.W.PrintFriendChatMessage($("div.UD_SYFC", chatform)[0], r); //打印好友消息
  450. }
  451. }
  452. //拉用户进入群处理
  453. U.F.N.LYHJQCL = function (UDE) {
  454. U.A.Request(US.Auth, ["GetJoinGroupNews", US.userInfo.userid, UDE.MessageID, UDE.MessageContent], U.F.N.AsynLYHJQCL, ["", UDE]); //拉用户进入群组
  455. }
  456. //拉用户进入群组异步
  457. U.F.N.AsynLYHJQCL = function (r) {
  458. if (r.value != "") {
  459. var i, _UFE, _UAE,
  460. _userid = US.userInfo.userid,
  461. context = r.context,
  462. UDE = context[1],
  463. _UGE = US.Disk.Disks[_userid];
  464. r = r.value;
  465. _UFE = r[0];
  466. US.Friend[2].unshift((_UAE = new U.F.T.GroupEntity(UDE.MessageContent.toLocaleLowerCase(), UDE.MessageDescript, U.MT.toTimeStamp(new Date()), UDE.UserId, "", null))); //创建群
  467. U.Dk.M.Entity.Add(r[1], _UGE);
  468. 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);
  469. for (i = 0; i < _UFE.length; i++) {
  470. if (!_$(US.Friend[3]).Select({ "GroupManageID": _UFE[i].GroupManageID || _UFE[i].MessageContent, "UserId": _UFE[i].UserId || _UFE[i].UserId })[0]) {
  471. 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)));
  472. }
  473. } //添加群友
  474. $($("#UD_SYHZLTA").Child()[2]).Child()[0].onclick(); return US.Friend[2][0]; //直接切换到群
  475. }
  476. }
  477. //#endregion
  478. //#region
  479. //查看即时消息
  480. U.F.N.CKHFXTPB = function (UDE) {
  481. var i, j, _ULE, _UTF, _UPE, _UCE, _UKE, _UME, _UNE, _UDOD,
  482. _userid = US.userInfo.userid;
  483. if ((UDE = UDE[4])) {
  484. for (i = 0; i < UDE.length; i++) {
  485. _UCE = UDE[i];
  486. if (_UCE.UserId != _userid) {
  487. switch (_UCE["NEWTYPE"]) {
  488. case "UPBR": //学习系统回复信息或者blog回复信息
  489. eval("0,_UKE =" + _UCE["ET"]);
  490. _UNE = US.PB.News[0];
  491. _UME = (_UCE["ET"] = _$(_UNE).Select({ "ArticleID": _UKE["ArticleID"], "ReplyAddUserID": _UCE["UserId"] })[0]);
  492. if (_UME) { _UME.UCN++; }
  493. else {
  494. _UTF = _UKE.NewsType == 2;
  495. _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 }));
  496. } //添加学习系统消息
  497. U.D.Blog.N.PNXX(); //打印学习系统和blog消息
  498. break;
  499. case "UD_DiskCon": case "DDisk": //Disk添加删除文件
  500. _UKE = U.Dk.DiskOperatingSwitch(US.userInfo.userid);
  501. _UPE = [];
  502. _ULE = _UKE[4][_UKE[1][1]].Child.length;
  503. if (_UKE) {
  504. _UDOD = $("#UD_SYWRZ", _UKE.pdiv)[0]; // US.Disk.UserDisk
  505. if (_UCE["NEWTYPE"] == "UD_DiskCon") {//添加文件处理
  506. eval("0,_UNE =" + _UCE["NEWC"]);
  507. _UCE["NEWC"] = (_UNE = _UNE.length == null ? [_UNE] : _UNE);
  508. _UME = _UNE[0].UserDirectoryParentID || _UNE[0].UserDirectoryID
  509. for (j = 0; j < _UNE.length; j++) {
  510. _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);
  511. }
  512. (!_ULE) && (_UDOD.innerText = "");
  513. (_userid == _UKE[1][2] && _UME == _UKE[1][1]) && (U.Dk.VW.XWPDY(_UPE, _UDOD)); //添加文件
  514. }
  515. else {//删除文件处理
  516. _UNE = _UCE["NEWC"].split(",");
  517. _UME = _UCE["NEWT"];
  518. for (j = 0; j < _UNE.length; j++) {
  519. _UTF = _$(_UKE[0]).Delete({ "UserDirectoryID": _UNE[j] })[0];
  520. (_UTF) && (_UPE.push(_UTF));
  521. } //删除文件
  522. (_userid == _UKE[1][2] && _UPE[0].UserDirectoryParentID == _UKE[1][1]) && (U.Dk.RE.AsynWPSCWJ(_UPE, US.userInfo.userid)); //删除文件提示
  523. }
  524. }
  525. break; //Disk更新目录
  526. }
  527. }
  528. }
  529. }
  530. }
  531. //下线通知区域
  532. U.F.N.DL = function (UTF) {
  533. //其它地方登录
  534. if (UTF == "upline") {
  535. U.UI.Confirm("警告", { "width": "300px", "height": "140px" }, null, null,
  536. $$("div", { "style": { "textAlign": "center", "marginTop": "25px", "padding": "10px 0", "fontSize": "14px", "color": "red" },
  537. "innerHTML": "您好, 您的账号在别处有登录!"
  538. }));
  539. U.U.L.TCUL();
  540. }
  541. //超时重新连接
  542. else {
  543. //, US.userInfo.LoginId, US.SystemId
  544. U.A.Request(US.Auth, ["UserStateLogin", US.userInfo.UserName, US.userInfo.UserPassword], U.M.apply(), []);
  545. }
  546. }
  547. //上线
  548. U.F.N.ST = function (UDE, UTF) {
  549. var i, j, _UAID, _UDTD,
  550. _UDOD = $("#UD_SYHZLZ")[0],
  551. _userid = US.userInfo.userid,
  552. _UFE = US.Friend;
  553. for (i = 0; i < UDE.length; i++) {
  554. if (UDE[i].length) {
  555. _UAID = UDE[i].join(",");
  556. for (j = 0; j < 3; j++) {
  557. _$(_$(_UFE[(j ? j + 2 : 1)]).Like({ "UserId": _UAID })).Change({ "IsLogin": i });
  558. } //设置用户在线状态
  559. for (j = 0; j < UDE[i].length; j++) {
  560. _UAID = $("@TID='" + UDE[i][j] + "'", _UDOD);
  561. (_UAID[0]) && (_UDTD = $(_UAID.Parent())).append(_UAID, null, i ? _UDTD[0].firstChild : null);
  562. }
  563. }
  564. }
  565. for (j = 0; j < 3; j++) {
  566. _$(US.Friend[(j ? j + 2 : 1)]).Reset({ "IsLogin": 1 });
  567. } //排序
  568. }
  569. //#endregion