Merge branch 'feature/pay_for_diamond' into dev
This commit is contained in:
commit
304a67e56f
@ -2,6 +2,7 @@ import { ApiCall } from "tsrpc";
|
||||
import { HuoDongFun } from "../../../public/huodongfun";
|
||||
import { ReqCanReceive, ResCanReceive } from '../../../shared/protocols/event/payForDiamond/PtlCanReceive';
|
||||
import { PublicShared } from "../../../shared/public/public";
|
||||
import { ActionLog } from "../../../public/actionLog/actionLog";
|
||||
|
||||
export async function playerCanReceive(call: ApiCall) {
|
||||
const activityInfo = await HuoDongFun.getHdidInfo(call, call.req.activityId);
|
||||
@ -11,13 +12,13 @@ export async function playerCanReceive(call: ApiCall) {
|
||||
const remaining = activityInfo.data['totalmoney'];
|
||||
const showOffList = activityInfo.data['showOffList'] || [];
|
||||
const zeroTime = PublicShared.getToDayZeroTime();
|
||||
const dayPayInfo = await G.mongodb.collection('dayPay').findOne({ uid: call.uid, time: zeroTime });
|
||||
if (!dayPayInfo || !dayPayInfo.payNum) {
|
||||
const vipScore = await ActionLog.getDayLog(call.uid, 'pay');
|
||||
if (!vipScore) {
|
||||
return {
|
||||
payNum: 0, remaining, result: false, activityInfo, showOffList
|
||||
};
|
||||
}
|
||||
const payNum = dayPayInfo.payNum;
|
||||
const payNum = vipScore;
|
||||
// 玩家充值未达标或者奖池余额耗尽则不能领取
|
||||
if (payNum < activityInfo.data['price'] || remaining <= 0) {
|
||||
return {
|
||||
@ -25,9 +26,9 @@ export async function playerCanReceive(call: ApiCall) {
|
||||
}
|
||||
}
|
||||
// 检查玩家今日是否已经领取
|
||||
const playerActivityInfo = G.mongodb.cEvent('payForDiamond').findOne({ uid: call.uid });
|
||||
const playerActivityInfo = await G.mongodb.cEvent('payForDiamond').findOne({ uid: call.uid, type: 'payForDiamond' });
|
||||
if (playerActivityInfo) {
|
||||
if (playerActivityInfo[zeroTime]?.length) {
|
||||
if (playerActivityInfo[zeroTime]) {
|
||||
return {
|
||||
payNum, remaining, result: false, activityInfo, showOffList
|
||||
};
|
||||
|
@ -92,10 +92,9 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
const zeroTime = PublicShared.getToDayZeroTime();
|
||||
const setObj = {};
|
||||
setObj[zeroTime] = gotAmount;
|
||||
const updatecEventResult = await G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, {
|
||||
await G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid, type: 'payForDiamond' }, {
|
||||
$set: setObj
|
||||
}, {upsert: true});
|
||||
console.log('updatecEventResult', JSON.stringify(updatecEventResult));
|
||||
// 记录玩家日志. 仅保留最近 10 条
|
||||
if (showOff) {
|
||||
await G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}});
|
||||
|
@ -14,7 +14,5 @@
|
||||
//黑帮争霸争霸赛第二名
|
||||
hbzb_pmd2: 'intr_pmd_hbzb2',
|
||||
//黑帮争霸争霸赛第三名
|
||||
hbzb_pmd3: 'intr_pmd_hbzb3',
|
||||
// 充值抢钻石 - 抢到大量钻石
|
||||
pay_for_diamond: 'intr_pmd_pfd'
|
||||
hbzb_pmd3: 'intr_pmd_hbzb3'
|
||||
}
|
Loading…
Reference in New Issue
Block a user