今天分析了一下有关群的操作,这是操作结果的JS,通过它我们可以分析返回值的意义.
Jx().$package(alloy.app.groupSystemMsg = new alloy.businessClass.App(alloy.portal.getSystemConfig("groupSystemMsg")),
function(i) {
var l = this,
e = i.dom,
f = i.event;
alloy.layout.getPanel("desktop");
uin2window = [];
windowList = [];
idCount = 1;
notifyTimer = null;
var o = function(a) {
return i.string.encodeHtml(String(a || ""))
},
u = function(a) {
var b = '<img class="gmsAvatar" src="' + EQQ.getGroupAvatar(a.value.gcode) + '" />\t\t\t \t\t\t <div class="gmsMsgBox">' + a.content + '</div>\t\t\t\t\t\t <div class="gmsMsgBox"></div>';
e.id("gsmContent-" + a.value.from_uin + "-" + a.type).innerHTML = b;
j(a);
m(a)
},
v = function(a) {
var b = '<img class="gmsAvatar" src="' + EQQ.getGroupAvatar(a.value.gcode) + '" />\t\t\t \t\t\t <div class="gmsMsgBox">' + a.content + '</div>\t\t\t\t\t\t <div class="gmsMsgBox">' + i.string.encodeHtml(a.atMsg) + "</div>";
e.id("gsmContent-" + a.value.from_uin + "-" + a.type).innerHTML = b;
j(a);
m(a)
},
w = function(a) {
var b = a.value.from_uin + "-" + a.type,
c = '<img class="gmsAvatar" src="' + EQQ.getGroupAvatar(a.value.gcode) + '" />\t\t\t \t\t\t <div class="gmsMsgBox">' + a.content + '</div>\t\t\t\t\t\t <div class="gmsMsgBox gmsMargin">' + i.string.encodeHtml(a.atMsg) + '</div>\t\t\t\t\t\t <div class="gmsMsgBox"><span class="inputMask">\t\t\t\t\t\t \t\t\t\t\t\t\t<input name="radioAct-' + b + '" id="radioAct-' + b + '-1" type="radio" value="1" checked="checked" /></span>\u540c\u610f</div>\t\t\t\t\t\t <div class="gmsMsgBox"><span class="inputMask"><input name="radioAct-' + b + '" id="radioAct-' + b + '-2" type="radio" value="2" /></span>\u62d2\u7edd</div>\t\t\t\t\t\t <div class="gmsMsgBox" id="reasonBox-' + b + '" style="display:none">\t\t\t\t\t\t \t\t\t\t\t\t\t<input class="txt" name="reasontxt-' + b + '" id="reasontxt-' + b + '" type="text"/></span></div>';
e.id("gsmContent-" + b).innerHTML = c;
c = e.id("radioAct-" + b + "-1");
b = e.id("radioAct-" + b + "-2");
f.on(c, "click", p);
f.on(b, "click", p);
m(a);
j(a)
},
j = function(a) {
var b = e.id("group-" + (a.value.from_uin + "-" + a.value.type));
b && (f.on(b, "click", x), y(a))
},
y = function(a) {
alloy.rpcService.sendGetGroupPublicInfo(a.value.gcode, a, alloy.app.groupSystemMsg.onGetGroupPublicInfoSuccess,
function() { })
};
this.onGetGroupPublicInfoSuccess = function(a) {
if (a.retcode == 0) {
var b = a.arguments;
if (b = e.id("group-" + (b.value.from_uin + "-" + b.value.type))) {
var c = b.getAttribute("tgcode");
b.innerHTML = o(a.result.ginfo.name) + "(" + c + ")"
}
}
};
var m = function(a) {
if (typeof a.buddy != "undefined") {
f.on(e.id(a.buddy), "click", q);
var b = a.buddy.split("-");
r(b[1], a)
}
typeof a.buddy2 != "undefined" && (f.on(e.id(a.buddy2), "click", q), b = a.buddy2.split("-"), r(b[1], a))
},
r = function(a, b) {
alloy.rpcService.sendGetUserInfo_with_code(a, b.value.type + "-" + b.value.from_uin, "", alloy.app.groupSystemMsg.onGetUserInfoSuccess, alloy.app.groupSystemMsg.onGetUserInfoError)
};
this.onGetUserInfoSuccess = function(a) {
if (a.retcode == 0) {
var b = a.arguments;
if (b = e.id("buddy-" + b.uin + "-" + b.code)) {
var c = b.getAttribute("tuin");
b.innerHTML = o(a.result.nick) + "(" + c + ")"
}
}
};
this.onGetUserInfoError = function() { };
var p = function() {
var a = this.id.split("-");
e.id("reasonBox-" + a[1] + "-" + a[2]).style.display = a[3] == 1 ? "none" : ""
},
q = function(a) {
a.preventDefault();
a = Number(this.getAttribute("uin"));
alloy.portal.runApp("userDetails", a)
},
x = function(a) {
a.preventDefault();
a = {
gid: "",
gcode: Number(this.getAttribute("gcode")),
from: "groupSystemMsg"
};
alloy.portal.runApp("groupDetails", a)
},
s = function(a) {
a.retcode == 0 ? (a = a.arguments, a.actType == 2 && f.notifyObservers(EQQ.Model.BuddyList, "ReloadGroupInfo", a.value.gcode)) : n(a)
},
n = function(a) {
a = a.arguments;
typeof a.actType != "undefined" ? a.actType == 2 ? alloy.layout.alert("\u540c\u610f(同意)" + a.value.t_request_uin + "\u52a0\u5165\u7fa4(加入群)" + a.value.t_gcode + "\u64cd\u4f5c\u5931\u8d25!(操作失败)") : a.actType == 3 && alloy.layout.alert("\u62d2\u7edd(拒绝)" + a.value.t_request_uin + "\u52a0\u5165\u7fa4(加入群)" + a.value.t_gcode + "\u64cd\u4f5c\u5931\u8d25!(操作失败)") : alloy.layout.alert("\u64cd\u4f5c\u5931\u8d25")
},
z = function(a) {
notifyTimer && (clearTimeout(notifyTimer), notifyTimer = null);
notifyTimer = setTimeout(function() {
f.notifyObservers(EQQ.Model.BuddyList, "ReloadGroupInfo", a)
},
3E3)
},
t = {
onRun: function(a) {
var b = a.value.from_uin + "-" + a.type,
c = l.getWindow(b);
if (!i.isUndefined(c)) return c.setCurrent(),
!0;
var c = 180,
e = "msg",
d = alloy.portal.getUin(),
g = '<a href="###" gcode="' + a.value.gcode + '" tgcode="' + a.value.t_gcode + '" id="group-' + (a.value.from_uin + "-" + a.value.type) + '">' + a.value.t_gcode + "(" + a.value.t_gcode + ")</a>",
j = !1,
k = !1;
switch (a.type) {
case "group_join":
d == a.value.new_member ? (a.content = "\u60a8\u5df2\u7ecf\u52a0\u5165\u7fa4(你已经加入群)" + g, f.notifyObservers(EQQ.Model.BuddyList, "AddNewGroupToModel", a.value.gcode)) : (a.buddy = "buddy-" + a.value.new_member + "-" + a.value.type + "-" + a.value.from_uin, d = '<a href="###" uin="' + a.value.new_member + '" tuin="' + a.value.t_new_member + '" id="' + a.buddy + '">' + a.value.t_new_member + "(" + a.value.t_new_member + ")</a>", a.content = d + "\u5df2\u52a0\u5165\u7fa4(已加入群)" + g, k = !0);
break;
case "group_leave_1":
if (d == a.value.admin_uin) a.content = "\u60a8\u5df2\u7ecf\u6210\u529f\u5730\u89e3\u6563\u4e86\u7fa4(你已经成功解散群)" + a.value.t_gcode;
else {
a.buddy = "buddy-" + a.value.admin_uin + "-" + a.value.type + "-" + a.value.from_uin;
var h = '<a href="###" uin="' + a.value.admin_uin + '" tuin="' + a.value.t_admin_uin + '" id="' + a.buddy + '">' + a.value.t_admin_uin + "(" + a.value.t_admin_uin + ")</a>";
a.content = a.value.t_gcode + "\u7684\u7fa4\u4e3b(的群主)" + h + "\u5df2\u5c06\u89e3\u6563\u8be5\u7fa4\u3002(已将群解散)"
}
j = !0;
break;
case "group_leave_2":
if (d != a.value.old_member) a.buddy = "buddy-" + a.value.old_member + "-" + a.value.type + "-" + a.value.from_uin,
d = '<a href="###" uin="' + a.value.old_member + '" tuin="' + a.value.t_old_member + '" id="' + a.buddy + '">' + a.value.t_old_member + "(" + a.value.t_old_member + ")</a>",
a.content = d + "\u9000\u51fa\u7fa4(退出群)" + g,
k = !0;
break;
case "group_leave_3":
a.buddy = "buddy-" + a.value.admin_uin + "-" + a.value.type + "-" + a.value.from_uin;
h = '<a href="###" uin="' + a.value.admin_uin + '" tuin="' + a.value.t_admin_uin + '" id="' + a.buddy + '">' + a.value.t_admin_uin + "(" + a.value.t_admin_uin + ")</a>";
d == a.value.old_member ? (a.content = g + "\u7ba1\u7406\u5458(管理员)" + h + "\u5df2\u5c06\u60a8\u79fb\u9664\u51fa\u8be5\u7fa4\u3002(已经将你移出群)", j = !0) : (a.buddy2 = "buddy-" + a.value.old_member + "-" + a.value.type + "-" + a.value.from_uin, d = '<a href="###" uin="' + a.value.old_member + '" tuin="' + a.value.t_old_member + '" id="' + a.buddy2 + '">' + a.value.t_old_member + "(" + a.value.t_old_member + ")</a>", a.content = d + "\u5df2\u88ab\u7ba1\u7406\u5458(已被管理员)" + h + "\u79fb\u9664\u51fa\u7fa4(移除出群)" + g + "\u3002", k = !0);
break;
case "group_request_join":
a.buddy = "buddy-" + a.value.request_uin + "-" + a.value.type + "-" + a.value.from_uin;
a.content = '<a href="###" uin="' + a.value.request_uin + '" tuin="' + a.value.t_request_uin + '" id="' + a.buddy + '">' + a.value.t_request_uin + "(" + a.value.t_request_uin + ")</a>\u7533\u8bf7\u52a0\u5165\u7fa4" + g;
a.atMsg = "\u9644\u52a0\u6d88\u606f\uff1a(附加信息)" + a.value.msg || "";
c = 270;
e = "msgAct";
break;
case "group_request_join_agree":
a.content = "\u7ba1\u7406\u5458\u5df2\u540c\u610f\u60a8\u52a0\u5165\u7fa4(管理员已经同意你加入群)" + g + "\u3002";
f.notifyObservers(EQQ.Model.BuddyList, "AddNewGroupToModel", a.value.gcode);
break;
case "group_request_join_deny":
a.content = "\u7ba1\u7406\u5458\u5df2\u62d2\u7edd\u60a8\u52a0\u5165\u7fa4(管理员已拒绝您加入群)" + g + "\u3002";
a.atMsg = "\u62d2\u7edd\u7406\u7531\uff1a(拒绝理由)" + a.value.msg || "";
c = 270;
e = "msgEx";
break;
case "group_create":
a.content = "\u60a8\u5df2\u7ecf\u6210\u529f\u521b\u5efa\u7fa4(你已成功创建群)" + g + "\uff0c\u9a6c\u4e0a\u9080\u8bf7\u60a8\u7684\u597d\u53cb\u52a0\u5165\u5427\u3002(马上邀请你的好友加入)";
f.notifyObservers(EQQ.Model.BuddyList, "AddNewGroupToModel", a.value.gcode);
break;
case "group_admin_op_0":
case "group_admin_op_2":
d == a.value.uin ? a.content = "\u60a8\u5df2\u7ecf\u88ab\u53d6\u6d88\u7fa4(你已被取消群)" + g + "\u7684\u7ba1\u7406\u5458\u8eab\u4efd\u3002(管理员身份)" : (a.buddy = "buddy-" + a.value.uin + "-" + a.value.type + "-" + a.value.from_uin, h = '<a href="###" uin="' + a.value.uin + '" tuin="' + a.value.t_uin + '" id="' + a.buddy + '">' + a.value.t_uin + "(" + a.value.t_uin + ")</a>", a.content = h + "\u5df2\u7ecf\u88ab\u53d6\u6d88\u7fa4" + g + "\u7684\u7ba1\u7406\u5458\u8eab\u4efd\u3002");
k = !0;
break;
case "group_admin_op_1":
case "group_admin_op_3":
d == a.value.uin ? a.content = "\u60a8\u5df2\u6210\u4e3a\u7fa4(你已成为群)" + g + "\u7684\u7ba1\u7406\u5458\u3002(的管理员)" : (a.buddy = "buddy-" + a.value.uin + "-" + a.value.type + "-" + a.value.from_uin, h = '<a href="###" uin="' + a.value.uin + '" tuin="' + a.value.t_uin + '" id="' + a.buddy + '">' + a.value.t_uin + "(" + a.value.t_uin + ")</a>", a.content = h + "\u5df2\u6210\u4e3a\u7fa4" + g + "\u7684\u7ba1\u7406\u5458\u3002");
k = !0;
break;
case "group_admin_op_255":
if (d == a.value.old_uin) a.buddy = "buddy-" + a.value.new_uin + "-" + a.value.type + "-" + a.value.from_uin,
h = '<a href="###" uin="' + a.value.new_uin + '" tuin="' + a.value.t_new_uin + '" id="' + a.buddy + '">' + a.value.t_new_uin + "(" + a.value.t_new_uin + ")</a>",
a.content = "\u60a8\u5df2\u7ecf\u6210\u529f\u5c06\u7fa4(你已成功将群)" + g + "\u7684\u7fa4\u4e3b\u8eab\u4efd\u8f6c\u8ba9\u7ed9(的群主身份转让给)" + h + "\u3002";
else if (d == a.value.new_uin) a.buddy = "buddy-" + a.value.old_uin + "-" + a.value.type + "-" + a.value.from_uin,
h = '<a href="###" uin="' + a.value.old_uin + '" tuin="' + a.value.t_old_uin + '" id="' + a.buddy + '">' + a.value.t_old_uin + "(" + a.value.t_old_uin + ")</a>",
a.content = g + "\u7684\u7fa4\u4e3b(的群主)" + h + "\u5df2\u7ecf\u5c06\u8be5\u7fa4\u8f6c\u8ba9\u7ed9\u60a8\uff0c\u73b0\u5728\u60a8\u4e3a\u8be5\u7fa4\u7fa4\u4e3b\u3002(已经将该群转让给您,现在您为该群群主。)";
else return !1;
k = !0;
break;
default:
return !1
}
j && alloy.portal.getApp("50").run({
api: ["exitGroup", [a.value.gcode]],
loginMode: "logined"
});
k && z(a.value.gcode);
c = alloy.layout.getWindowManager().createWindow("Window", {
title: "",
modeSwitch: !1,
dragable: !0,
resize: !1,
width: 330,
height: c - 77,
hasCloseButton: !0,
hasOkButton: !0,
hasCancelButton: !0
});
c.setHtml('<div class="gsmBody"><div class="gsmContent" id="gsmContent-' + a.value.from_uin + "-" + a.type + '"></div></div>');
c.setTitle(l.option.title);
l.setWindow(b, c);
e == "msgAct" ? w(a) : e == "msgEx" ? v(a) : u(a);
f.addObserver(c, "close",
function() {
l.closeWindow(b)
});
f.addObserver(c, "clickOkButton",
function() {
return t.onClickOkButton(a)
});
pgvSendClick({
hottag: "WEB2QQ.APP.groupSystemMsg." + a.type
})
},
onClickOkButton: function(a) {
if (a.type == "group_request_join") {
var b = a.value.from_uin + "-" + a.type,
c = e.id("radioAct-" + b + "-1"),
f = e.id("radioAct-" + b + "-2"),
d = {
group_uin: a.value.from_uin,
req_uin: a.value.request_uin,
msg: ""
};
if (c && c.checked) d.op_type = 2,
a.actType = 2,
EQQ.RPCService.sendGroupRequestJoin(d, a, s, n);
else if (f && f.checked) d.op_type = 3,
a.actType = 3,
d.msg = e.id("reasontxt-" + b).value,
EQQ.RPCService.sendGroupRequestJoin(d, a, s, n)
}
return !0
},
onClickCustomButton: function() { }
};
this.createWindow = function() { };
this.getWindow = function(a) {
return uin2window[a]
};
this.setWindow = function(a, b) {
uin2window[a] = b;
windowList.push(b);
b.uin = a;
return b
};
this.closeWindow = function(a) {
i.array.remove(windowList, uin2window[a]);
delete uin2window[a];
return !0
};
this.closeAllWindow = function() {
for (var a = 0; a < windowList.length; a++) this.closeWindow(windowList[a].uin);
return !0
};
f.addObserver(this, "run", t.onRun)
});