周末礼包
This commit is contained in:
parent
e0d9c40be3
commit
ab8404ef62
@ -12,6 +12,8 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
let _hd = (await HuoDongFun.gethdList(call, 9))[0]
|
||||
|
||||
let payIds = _hd?.data?.gift?.filter(i => i.payId)?.map(i => i.payId)
|
||||
await checkResetBuyLog(call)
|
||||
await getConf(call)
|
||||
|
||||
call.succ({
|
||||
record: data?.record || {},
|
||||
@ -20,24 +22,32 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
|
||||
}
|
||||
|
||||
export async function checkResetBuyLog(call: ApiCall) {
|
||||
export async function getConf(call, args?: { id?: string; payId?: string }) {
|
||||
let _hd = (await HuoDongFun.gethdList(call, 9))[0]
|
||||
if (!_hd) return []
|
||||
if (args?.id) return _hd?.data?.gift?.find(i => i.id == args.id)
|
||||
if (args?.payId) return _hd?.data?.gift?.find(i => i.payId == args.payId)
|
||||
return _hd?.data?.gift
|
||||
}
|
||||
|
||||
export async function checkResetBuyLog(call) {
|
||||
let zeroTime = PublicShared.getToDayZeroTime()
|
||||
|
||||
|
||||
let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'})
|
||||
if (data.refreshTime && data.refreshTime > zeroTime) return
|
||||
if (data.refreshTime && data.refreshTime <= zeroTime) {
|
||||
G.mongodb.cEvent(`zhoumolibao`).updateOne(
|
||||
{uid: call.uid, type: `zhoumolibao`},
|
||||
{$set: {record: {}}},
|
||||
{upsert: true}
|
||||
)
|
||||
}
|
||||
|
||||
G.mongodb.cEvent(`zhoumolibao`).updateOne(
|
||||
{uid: call.uid, type: `zhoumolibao`},
|
||||
{$set: {record: {}}},
|
||||
{upsert: true}
|
||||
)
|
||||
let gifts = await getConf(call)
|
||||
|
||||
let _hd = (await HuoDongFun.gethdList(call, 9))[0]
|
||||
let payIds = _hd?.data?.gift?.filter(i => i.payId)?.map(i => i.payId)
|
||||
let payIds = gifts.filter(i => i.payId)?.map(i => i.payId)
|
||||
let payLogs = await PayFun.getPayLogs(call.uid, payIds)
|
||||
let payLogLength = R.values(payLogs).filter(i => i.time < zeroTime).length
|
||||
if (payLogLength) {
|
||||
PayFun.delPayLog(call.uid, payIds.map(i => ({payId: i})))
|
||||
PayFun.delPayLog(call.uid, payIds.map(i => ({payId: i, val: []})))
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
// 取奖励列表,判断是否有可领取奖励
|
||||
let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'})
|
||||
let rec = data?.record?.[call.req.id]
|
||||
// if (rec && rec >= gift?.buyNum) return call.errorCode(-2)
|
||||
if (rec && rec >= gift?.buyNum) return call.errorCode(-2)
|
||||
|
||||
await PlayerFun.sendPrize(call, gift.prize);
|
||||
|
||||
|
@ -15,6 +15,7 @@ import { ZhanLingTasks } from './public/zhanling';
|
||||
import { player } from './shared/protocols/user/type';
|
||||
import { PublicShared } from './shared/public/public';
|
||||
import { setGud } from './public/gud';
|
||||
import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen";
|
||||
|
||||
export type gEventType = {
|
||||
/**玩家断开连接 */
|
||||
@ -201,15 +202,18 @@ export function addListener() {
|
||||
ActionLog.addRetainLog(gud.uid, { key: 'login_day', val: 1 });
|
||||
ZhanLingTasks.clearLog(gud.uid, 'day');
|
||||
PayFun.checkGiftDayEmail(gud, lastTime, curTime);
|
||||
|
||||
reissuePrize(gud, lastTime, curTime);
|
||||
addDay(gud);
|
||||
|
||||
// 任务累计登录天数
|
||||
let call = PayFun.getCall(gud);
|
||||
|
||||
G.emit("Class_task_135", 'Class_task_135', call, 1, 0);
|
||||
// 七日登录活动计数
|
||||
qiRiDengLuAddDay(call);
|
||||
|
||||
// 周末礼包检测刷新
|
||||
checkResetBuyLog(call)
|
||||
});
|
||||
|
||||
G.on('API_CALL', node => {
|
||||
|
@ -9,6 +9,7 @@ import {HuoDongFun} from './huodongfun';
|
||||
import {call, PlayerFun} from './player';
|
||||
import {number} from "mathjs";
|
||||
import {getGud} from './gud';
|
||||
import {getConf as zmlbGetConf} from '../api_s2c/event/zhoumolibao/ApiOpen';
|
||||
|
||||
async function checkPayIsActive(payId: string, logs: payLog[], payArgs) {
|
||||
let conf: any = await this.getConf(payId, payArgs);
|
||||
@ -367,7 +368,12 @@ export class PayFun {
|
||||
buyLog = await this.getPayLog(player.uid, '136Gift1');
|
||||
if (buyLog.slice(-1)[0]?.eTime > G.time) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -3});
|
||||
}
|
||||
|
||||
if (payId.indexOf('wkdlibao') != -1) {
|
||||
let call = this.getCall(player)
|
||||
let conf = await zmlbGetConf(call, {payId})
|
||||
buyLog = await this.getPayLog(player.uid, payId);
|
||||
if (buyLog.length && buyLog.length >= conf.buyNum) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -1});
|
||||
}
|
||||
}
|
||||
|
||||
if (G.config.debug) {
|
||||
|
Loading…
Reference in New Issue
Block a user