Merge branch 'bugfix' into dev
This commit is contained in:
commit
3450796bb7
@ -7,26 +7,25 @@ type dataChange = Partial<ResOpen>;
|
||||
export class TanXianFun {
|
||||
/**修改探险数据 */
|
||||
static async changeData(call: ApiCall, change: dataChange) {
|
||||
|
||||
G.mongodb.collection('tanxian').updateOne({uid: call.uid}, {$set: {...change}});
|
||||
let data = await this.getData(call);
|
||||
Object.assign(data, change);
|
||||
G.ioredis.set(`tanxian:${call.uid}`, JSON.stringify(data));
|
||||
G.ioredis.setex(`tanxian:${call.uid}`, 600, JSON.stringify(data));
|
||||
}
|
||||
|
||||
/**获取探险数据 */
|
||||
static async getData(call: ApiCall, cache = true) {
|
||||
if(cache){
|
||||
let data = await G.ioredis.get(`tanxian:${call.uid}`);
|
||||
if (data) return JSON.parse(data);
|
||||
}
|
||||
let cacheData = await G.ioredis.get(`tanxian:${call.uid}`);
|
||||
if (cacheData && cache) return JSON.parse(cacheData);
|
||||
let {_id, uid, ...data} = await G.mongodb.collection('tanxian').findOne({uid: call.uid});
|
||||
if (!data.eventTime) {
|
||||
data.eventTime = G.time;
|
||||
G.mongodb.collection('tanxian').updateOne({uid: call.uid}, {$set: {eventTime: G.time}});
|
||||
}
|
||||
await G.ioredis.set(`tanxian:${call.uid}`, JSON.stringify(data));
|
||||
G.ioredis.setex(`tanxian:${call.uid}`, 600, JSON.stringify(data));
|
||||
return data;
|
||||
}
|
||||
|
||||
/**获取快速探险次数 */
|
||||
static async getFastGuaJiNum(call: ApiCall) {
|
||||
let num = G.gc.tanxian_com.fastGuaJiNum + await TeQuanFun.getTxFreeNum(call);
|
||||
@ -38,6 +37,7 @@ export class TanXianFun {
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/**获取最后领取奖励的id与sort后的数组*/
|
||||
static getLastMapId(receivePrizeConfId: string[]) {
|
||||
if (!receivePrizeConfId) receivePrizeConfId = []
|
||||
|
Loading…
Reference in New Issue
Block a user