Commit 13388f2f authored by liuxinjun's avatar liuxinjun

去掉本地缓存时间限制

parent a1e5eedf
......@@ -2027,7 +2027,7 @@ var sdk = {
if(expireTime==-1)
{
expireTime=7*24*60*60;
expireTime=15*24*60*60;
}else if(expireTime==0)
{
expireTime=24*60*60;
......@@ -2037,7 +2037,7 @@ var sdk = {
self.setLocalCache(dataKey,JSON.stringify(data),localExpireTime);
console.log("sdk setToServer "+dataKey + " : "+JSON.stringify(data));
this.Get(this.ip2 + this.set, { key: dataKey,data: JSON.stringify(data),data_type:dataType,expireTime:String(expireTime)}, function (d) {
this.Post(this.ip2 + this.set, { key: dataKey,data: JSON.stringify(data),data_type:dataType,expireTime:String(expireTime)}, function (d) {
console.log("sdk setToServer 服务端返回",JSON.stringify(d));
if(d.c==0)
{
......@@ -2072,7 +2072,7 @@ var sdk = {
if(cacheData==-1)
{
//去远程服务器拿数据
this.Get(this.ip2 + this.get, { key: dataKey,data_type:dataType,data: JSON.stringify(data)}, function (d) {
this.Post(this.ip2 + this.get, { key: dataKey,data_type:dataType,data: JSON.stringify(data)}, function (d) {
console.log("sdk getFromServer "+dataKey+" 本地不存在,去服务器获取值:"+JSON.stringify(d.d));
callbackFunction(d.d);
......@@ -2083,7 +2083,7 @@ var sdk = {
//callbackFunction(null);
//去远程服务器拿数据
this.Get(this.ip2 + this.get, { key: dataKey,data_type:dataType,data: JSON.stringify(data)}, function (d) {
this.Post(this.ip2 + this.get, { key: dataKey,data_type:dataType,data: JSON.stringify(data)}, function (d) {
console.log("sdk getFromServer "+dataKey+" 本地已经过期,去服务器获取值:"+JSON.stringify(d.d));
callbackFunction(d.d);
......@@ -2149,19 +2149,20 @@ var sdk = {
{
var data = JSON.parse(localData);
var expireTime = data.expireTime;
if(nowTime>=expireTime)
{
cc.sys.localStorage.removeItem(key);
console.log("sdk getLocalCache dataKey : "+key+" is expire");
return 0;
}else
{
var data = data.data;
console.log("sdk getLocalCache dataKey : "+key+" is "+data+" 离过期时间还有:"+((expireTime-nowTime)/1000)+"S");
return data;
}
return data.data;
// if(nowTime>=expireTime)
// {
// cc.sys.localStorage.removeItem(key);
// console.log("sdk getLocalCache dataKey : "+key+" is expire");
// return 0;
// }else
// {
// var data = data.data;
// console.log("sdk getLocalCache dataKey : "+key+" is "+data+" 离过期时间还有:"+((expireTime-nowTime)/1000)+"S");
// return data;
// }
}else
{
//本地不存在数据,应该去远程服务器拿数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment