第一次提交

This commit is contained in:
dengtongyu committed 2018-12-03 17:31:53 +08:00
commit 8121362a03
4412 files changed
+1091845

No files matched your search

@@ -0,0 +1,40 @@
define(function(require, exports, module) {
var yyapi = require("../../lib/pkroom/yyapi");
var queue = [];
var face = {
saveHistory : function(item,type){
while(queue.length>=5){
queue.shift();
}
item.type = type;
var sid = yyapi.getChannelInfo().longId;
item.channelId = sid;
queue.push(item);
var cookietime = new Date();
cookietime.setTime(cookietime.getTime() + 1 * 60 * 1000);
$.cookie("chatPub_history",JSON.stringify(queue),{expires :cookietime});
},
readHistory : function(type){
var sid = yyapi.getChannelInfo().longId;
var str = $.cookie("chatPub_history");
var arr = [];
if(str == undefined)
return arr;
var jsonData = JSON.parse(str);
for(var i = 0; i < jsonData.length; i++)
{
var item = jsonData[i];
if((type == undefined || item.type == type) && item.channelId == sid)
{
item.isHistory = true;
arr.push(item);
}
}
return arr;
}
};
module.exports = face;
})