清理联系信息前最后的提交保存。
This commit is contained in:
parent
cfc78c8347
commit
d6e5179acb
@ -1,19 +1,12 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web12306", "Web12306\Web12306.csproj", "{56406C67-2B6F-4152-9EC0-E6D80E86B96D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StationDataFileGenerator", "StationDataFileGenerator\StationDataFileGenerator.csproj", "{0C7635A7-78F5-459D-BBDE-CEEC51E546B9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{4C2B47DF-F10F-4EE2-9150-96FBC50A8F58}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.nuget\NuGet.Config = .nuget\NuGet.Config
|
||||
.nuget\NuGet.exe = .nuget\NuGet.exe
|
||||
.nuget\NuGet.targets = .nuget\NuGet.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildTools", "BuildTools", "{F6960416-F825-4800-8FD4-C72908A4A6CC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeployTools", "DeployTools\DeployTools.csproj", "{E958D106-A3EE-46AF-B3E5-E62FC96F2F94}"
|
||||
|
@ -38,7 +38,12 @@
|
||||
var roomSession = require("./roomsession.js");
|
||||
var enterroom = function () {
|
||||
showChatFrameUI();
|
||||
roomSession.enterRoom(this);
|
||||
|
||||
var checkMsg = roomSession.activityInfo.canEnterRoom();
|
||||
if (checkMsg) {
|
||||
mp.alert("提示", checkMsg);
|
||||
} else
|
||||
roomSession.enterRoom(this);
|
||||
};
|
||||
roomSession.session.on("exitRoom", function () {
|
||||
showServerList();
|
||||
|
@ -15,13 +15,99 @@
|
||||
var media = require("../../platform/media.js");
|
||||
var lastPopupTip = parseInt(sessionStorage["lastRoomMstAt"] || "0", 10);
|
||||
|
||||
var activityInfo = (function () {
|
||||
var info = $.extend({}, JSON.parse(sessionStorage["lastRoomActivity"] || "{}"));
|
||||
|
||||
var saveActivityInfo = function () {
|
||||
sessionStorage.lastRoomActivity = JSON.stringify(info);
|
||||
};
|
||||
|
||||
var obj = {
|
||||
canEnterRoom: function (username) {
|
||||
username = username || user.username;
|
||||
|
||||
//要求登录后才可进入聊天室
|
||||
if (!username)
|
||||
return "未登录不可进入聊天室";
|
||||
//如果是同一个账号登录的,则不限制
|
||||
if (obj.lastEnterUser && obj.lastEnterUser === username)
|
||||
return null;
|
||||
else {
|
||||
//如果换账号登录的,则要求30分钟后再进入
|
||||
if (obj.lastEnterTime && (new Date() - obj.lastEnterTime) < 30 * 60 * 1000) {
|
||||
return "您换账号进入聊天室时间过短,请在换账号登录30分钟后再进入聊天室。";
|
||||
}
|
||||
|
||||
obj.lastEnterTime = new Date();
|
||||
obj.lastEnterUser = username;
|
||||
obj.sendMessageTimes = 0;
|
||||
obj.lastSendMessage = null;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
canSendPic: function () {
|
||||
if (securityCheck.isAdmin)
|
||||
return null;
|
||||
|
||||
if (!activityInfo.lastEnterTime || (new Date() - activityInfo.lastEnterTime) < 60 * 1000 * 10) {
|
||||
return "很抱歉,进入聊天室10分钟内不可发送图片哦,还有" + (10 - Math.floor((new Date() - activityInfo.lastEnterTime) / 1000 / 60)) + "分钟。";
|
||||
}
|
||||
if (!activityInfo.sendMessageTimes || activityInfo.sendMessageTimes < 10) {
|
||||
return "很抱歉,发言次数在10次以内的时候不可发送图片哦,还差" + (10 - activityInfo.sendMessageTimes) + "次。";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Object.defineProperties(obj, {
|
||||
lastEnterUser: {
|
||||
get: function () {
|
||||
return info.lastEnterUser || "";
|
||||
},
|
||||
set: function (value) {
|
||||
info.lastEnterUser = value;
|
||||
saveActivityInfo();
|
||||
}
|
||||
},
|
||||
lastEnterTime: {
|
||||
get: function () {
|
||||
return info.lastEnterTime ? new Date(parseInt(info.lastEnterTime)) : null;
|
||||
},
|
||||
set: function (value) {
|
||||
info.lastEnterTime = value ? value.getTime() : null;
|
||||
saveActivityInfo();
|
||||
}
|
||||
},
|
||||
lastSendMessage: {
|
||||
get: function () {
|
||||
return info.lastSendMessage ? new Date(parseInt(info.lastSendMessage)) : null;
|
||||
},
|
||||
set: function (value) {
|
||||
info.lastSendMessage = value ? value.getTime() : null;
|
||||
saveActivityInfo();
|
||||
}
|
||||
},
|
||||
sendMessageTimes: {
|
||||
get: function () {
|
||||
return info.sendMessageTimes || null;
|
||||
},
|
||||
set: function (value) {
|
||||
info.sendMessageTimes = value;
|
||||
saveActivityInfo();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return obj;
|
||||
})();
|
||||
|
||||
var checkPrivilege = function () {
|
||||
securityCheck.isAdmin = user && (user.username === 'imfish' || user.username === 'iccfish');
|
||||
};
|
||||
|
||||
sessMgr.on("sessionChanged", function () {
|
||||
|
||||
if (!sessMgr.current) {
|
||||
if (!sessMgr.isLogined) {
|
||||
session.exitRoom();
|
||||
} else {
|
||||
user = sessMgr.current;
|
||||
@ -49,10 +135,10 @@
|
||||
text: "[贴图]",
|
||||
target: []
|
||||
}, [
|
||||
{
|
||||
type: "image",
|
||||
data: fe.target.result
|
||||
}]);
|
||||
{
|
||||
type: "image",
|
||||
data: fe.target.result
|
||||
}]);
|
||||
};
|
||||
|
||||
this.sendPic = function (file) {
|
||||
@ -81,11 +167,20 @@
|
||||
|
||||
that.fireEvent("enterRoom");
|
||||
if (!room.url) {
|
||||
that.appendMessageItem(roomStateTemplate({ state: "connecting", stateIcon: "fa-spin fa-spinner", msg: "正在获得房间地址..." }));
|
||||
that.appendMessageItem(roomStateTemplate({
|
||||
state: "connecting",
|
||||
stateIcon: "fa-spin fa-spinner",
|
||||
msg: "正在获得房间地址..."
|
||||
}));
|
||||
$.post(param.chatServerGetAddressApi, { roomId: room.id }, "json").done(function (result) {
|
||||
if (!result.url) {
|
||||
that.clearConnectingState();
|
||||
that.appendMessageItem(roomStateTemplate({ state: "disconnect", stateIcon: "fa-times", msg: "无法进入房间,请重试。", exinfo: "<a href='javascript:;' class='chat-frame-reconnect'>重新连接</a>" }));
|
||||
that.appendMessageItem(roomStateTemplate({
|
||||
state: "disconnect",
|
||||
stateIcon: "fa-times",
|
||||
msg: "无法进入房间,请重试。",
|
||||
exinfo: "<a href='javascript:;' class='chat-frame-reconnect'>重新连接</a>"
|
||||
}));
|
||||
that.exitRoom();
|
||||
mp.showMessagePopup("error", "无法进入房间,请稍后重试。");
|
||||
} else {
|
||||
@ -97,7 +192,12 @@
|
||||
}
|
||||
}).fail(function () {
|
||||
that.clearConnectingState();
|
||||
that.appendMessageItem(roomStateTemplate({ state: "disconnect", stateIcon: "fa-times", msg: "无法进入房间,请重试。", exinfo: "<a href='javascript:;' class='chat-frame-reconnect'>重新连接</a>" }));
|
||||
that.appendMessageItem(roomStateTemplate({
|
||||
state: "disconnect",
|
||||
stateIcon: "fa-times",
|
||||
msg: "无法进入房间,请重试。",
|
||||
exinfo: "<a href='javascript:;' class='chat-frame-reconnect'>重新连接</a>"
|
||||
}));
|
||||
that.exitRoom();
|
||||
mp.showMessagePopup("error", "无法进入房间,请稍后重试。");
|
||||
});
|
||||
@ -158,6 +258,8 @@
|
||||
mp.showMessagePopup("error", "发言失败!");
|
||||
return;
|
||||
}
|
||||
activityInfo.sendMessageTimes++;
|
||||
activityInfo.lastSendMessage = new Date();
|
||||
|
||||
if (media && media.length) {
|
||||
var tip = new mp.MessagePopup("loading", "正在上传图片,请稍等...");
|
||||
@ -196,10 +298,18 @@
|
||||
|
||||
if (info[1] === user.username) {
|
||||
//自己进入
|
||||
that.appendMessageItem(roomSysMessage({ stateIcon: "fa-info-circle", state: "system", msg: "您已进入房间,当前房间在线 " + room.onlinecount + " 人。" }));
|
||||
that.appendMessageItem(roomSysMessage({
|
||||
stateIcon: "fa-info-circle",
|
||||
state: "system",
|
||||
msg: "您已进入房间,当前房间在线 " + room.onlinecount + " 人。"
|
||||
}));
|
||||
} else {
|
||||
if (sessMgr.current.options.showRoomEnter)
|
||||
that.appendMessageItem(roomSysMessage({ stateIcon: "fa-info-circle", state: "system", msg: '<a href="javascript:;" class="chat-item-at" data-un="' + utility.htmlEncode(info[1]) + '">' + utility.htmlEncode(info[2]) + '</a> 已进入房间,当前房间在线 ' + room.onlinecount + " 人。" }));
|
||||
that.appendMessageItem(roomSysMessage({
|
||||
stateIcon: "fa-info-circle",
|
||||
state: "system",
|
||||
msg: '<a href="javascript:;" class="chat-item-at" data-un="' + utility.htmlEncode(info[1]) + '">' + utility.htmlEncode(info[2]) + '</a> 已进入房间,当前房间在线 ' + room.onlinecount + " 人。"
|
||||
}));
|
||||
}
|
||||
} else if (msg.sysMsgType === cmds.SYS_USEREXIT) {
|
||||
//用户退出
|
||||
@ -209,21 +319,37 @@
|
||||
|
||||
if (info[1] === user.username) {
|
||||
//自己进入
|
||||
that.appendMessageItem(roomSysMessage({ stateIcon: "fa-info-circle", state: "system", msg: "您已离开房间,当前房间在线 " + room.onlinecount + " 人。" }));
|
||||
that.appendMessageItem(roomSysMessage({
|
||||
stateIcon: "fa-info-circle",
|
||||
state: "system",
|
||||
msg: "您已离开房间,当前房间在线 " + room.onlinecount + " 人。"
|
||||
}));
|
||||
} else {
|
||||
if (sessMgr.current.options.showRoomEnter)
|
||||
that.appendMessageItem(roomSysMessage({ stateIcon: "fa-info-circle", state: "system", msg: '<a href="javascript:;" class="chat-item-at" data-un="' + utility.htmlEncode(info[1]) + '">' + utility.htmlEncode(info[2]) + '</a> 已离开房间,当前房间在线 ' + room.onlinecount + " 人。" }));
|
||||
that.appendMessageItem(roomSysMessage({
|
||||
stateIcon: "fa-info-circle",
|
||||
state: "system",
|
||||
msg: '<a href="javascript:;" class="chat-item-at" data-un="' + utility.htmlEncode(info[1]) + '">' + utility.htmlEncode(info[2]) + '</a> 已离开房间,当前房间在线 ' + room.onlinecount + " 人。"
|
||||
}));
|
||||
}
|
||||
} else if (msg.sysMsgType === cmds.SYS_SENDFAILED) {
|
||||
} else if (msg.sysMsgType === cmds.SYS_OPERATIONBLOCKED) {
|
||||
if(msg&&msg.content.indexOf("被封锁")!==-1){
|
||||
msg.content+=",如有疑问请新浪微博联系 木魚非非魚(@imcfish)";
|
||||
if (msg && msg.content.indexOf("被封锁") !== -1) {
|
||||
msg.content += ",如有疑问请新浪微博联系 木魚非非魚(@imcfish)";
|
||||
}
|
||||
mp.showMessagePopup("error", msg.content, {closeAfter:10000});
|
||||
mp.showMessagePopup("error", msg.content, { closeAfter: 10000 });
|
||||
} else if (msg.sysMsgType === cmds.SYS_UPDATEONLINECOUNT) {
|
||||
that.appendMessageItem(roomSysMessage({ stateIcon: "fa-info-circle", state: "system", msg: "您已离开房间,当前房间在线 " + room.onlinecount + " 人。" }));
|
||||
that.appendMessageItem(roomSysMessage({
|
||||
stateIcon: "fa-info-circle",
|
||||
state: "system",
|
||||
msg: "您已离开房间,当前房间在线 " + room.onlinecount + " 人。"
|
||||
}));
|
||||
} else if (msg.sysMsgType === cmds.SYS_REPORTABUSERESULT) {
|
||||
that.appendMessageItem(roomSysMessage({ stateIcon: "fa-info-circle", state: "system", msg: msg.content }));
|
||||
that.appendMessageItem(roomSysMessage({
|
||||
stateIcon: "fa-info-circle",
|
||||
state: "system",
|
||||
msg: msg.content
|
||||
}));
|
||||
}
|
||||
};
|
||||
this.processUserMessage = function (msg) {
|
||||
@ -261,7 +387,7 @@
|
||||
|
||||
//replace icon
|
||||
msg.content = msg.content || "";
|
||||
msg.content = utility.htmlEncode(msg.content).replace(/https?:\/\/[a-z\d\.-_\/%+\[\]\(\)\&\$!@]+/gi,"<a href='$&' target='_blank'>$&</a>");
|
||||
msg.content = utility.htmlEncode(msg.content).replace(/https?:\/\/[a-z\d\.-_\/%+\[\]\(\)\&\$!@]+/gi, "<a href='$&' target='_blank'>$&</a>");
|
||||
msg.content = msg.content.replace(/:([a-z\d-+_]+):/gi, function ($0, $1) {
|
||||
return "<img src='" + emojiRoot + "/" + $1 + ".png' />";
|
||||
});
|
||||
@ -274,7 +400,11 @@
|
||||
}
|
||||
});
|
||||
port.on("chatRoomConnecting", function () {
|
||||
that.appendMessageItem(roomStateTemplate({ state: "connecting", stateIcon: "fa-spin fa-spinner", msg: "正在连接服务器中..." }));
|
||||
that.appendMessageItem(roomStateTemplate({
|
||||
state: "connecting",
|
||||
stateIcon: "fa-spin fa-spinner",
|
||||
msg: "正在连接服务器中..."
|
||||
}));
|
||||
that.fireEvent("chatRoomConnecting");
|
||||
});
|
||||
port.on("chatRoomConnected", function () {
|
||||
@ -293,7 +423,7 @@
|
||||
//check
|
||||
if (data.images) {
|
||||
if (_.some(data.images, function (m) {
|
||||
return !/^http:\/\/www\.liebao\.cn\/.*/.test(m);
|
||||
return !/^http:\/\/www\.liebao\.cn\/.*/.test(m);
|
||||
}))
|
||||
return;
|
||||
}
|
||||
@ -308,7 +438,12 @@
|
||||
});
|
||||
port.on("chatRoomDisconnected", function () {
|
||||
that.clearConnectingState();
|
||||
that.appendMessageItem(roomStateTemplate({ state: "disconnect", stateIcon: "fa-times", msg: "服务器已断开连接。", exinfo: "<a href='javascript:;' class='chat-frame-reconnect'>重新连接</a>" }));
|
||||
that.appendMessageItem(roomStateTemplate({
|
||||
state: "disconnect",
|
||||
stateIcon: "fa-times",
|
||||
msg: "服务器已断开连接。",
|
||||
exinfo: "<a href='javascript:;' class='chat-frame-reconnect'>重新连接</a>"
|
||||
}));
|
||||
that.fireEvent("chatRoomDisconnected");
|
||||
page.find("button.button-primary").prop("disabled", true);
|
||||
});
|
||||
@ -323,7 +458,12 @@
|
||||
$("#chat_server_select li[data-id='" + room.id + "'] span").html("(" + d.count + "人)");
|
||||
});
|
||||
port.on("sendMessageFailed", function (e, data) {
|
||||
that.appendMessageItem(roomStateTemplate({ state: "error", stateIcon: "fa-times", msg: "消息发送失败:" + data, exinfo: "" }));
|
||||
that.appendMessageItem(roomStateTemplate({
|
||||
state: "error",
|
||||
stateIcon: "fa-times",
|
||||
msg: "消息发送失败:" + data,
|
||||
exinfo: ""
|
||||
}));
|
||||
});
|
||||
|
||||
return this;
|
||||
@ -351,7 +491,8 @@
|
||||
emojiHtml.push("<li><img src='" + emojiRoot + "/" + code + ".png' data-emoji='" + code + "' /></li>");
|
||||
});
|
||||
editor.find(">header>.popup-smail").html(emojiHtml.join(""));
|
||||
loadImgIcons = function () { };
|
||||
loadImgIcons = function () {
|
||||
};
|
||||
};
|
||||
|
||||
var initEditor = function () {
|
||||
@ -415,8 +556,15 @@
|
||||
if (items) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].type.indexOf("image") === 0) {
|
||||
var blob = items[i].getAsFile();
|
||||
filereader.readAsDataURL(blob);
|
||||
var checkMsg = activityInfo.canSendPic();
|
||||
if (checkMsg) {
|
||||
mp.alert("提示", checkMsg);
|
||||
} else {
|
||||
var blob = items[i].getAsFile();
|
||||
filereader.readAsDataURL(blob);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -436,10 +584,17 @@
|
||||
sessMgr.save();
|
||||
});
|
||||
editor.find("#chat_file").change(function () {
|
||||
var checkMsg = activityInfo.canSendPic();
|
||||
var file = this;
|
||||
if (file.files.length > 0) {
|
||||
session.sendPic(this.files[0]);
|
||||
|
||||
if (checkMsg) {
|
||||
mp.alert("提示", checkMsg);
|
||||
} else {
|
||||
if (file.files.length > 0) {
|
||||
session.sendPic(this.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
file.value = "";
|
||||
});
|
||||
editor.find(">footer>button.button-default").click(function () {
|
||||
@ -521,6 +676,7 @@
|
||||
|
||||
return {
|
||||
session: session,
|
||||
enterRoom: session.enterRoom
|
||||
enterRoom: session.enterRoom,
|
||||
activityInfo: activityInfo
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user