Merge branch 'feature/pay_for_diamond' into dev

This commit is contained in:
chenkai 2023-12-22 16:35:25 +08:00
commit dec4ce2cc4
3 changed files with 16 additions and 7 deletions

View File

@ -13,16 +13,17 @@ export async function playerCanReceive(call: ApiCall) {
const showOffList = activityInfo.data['showOffList'] || []; const showOffList = activityInfo.data['showOffList'] || [];
const zeroTime = PublicShared.getToDayZeroTime(); const zeroTime = PublicShared.getToDayZeroTime();
const vipScore = await ActionLog.getDayLog(call.uid, 'pay'); const vipScore = await ActionLog.getDayLog(call.uid, 'pay');
const price = activityInfo.data['price'];
if (!vipScore) { if (!vipScore) {
return { return {
payNum: 0, remaining, result: false, activityInfo, showOffList payNum: 0, remaining, result: false, activityInfo, showOffList, price
}; };
} }
const payNum = vipScore; const payNum = vipScore;
// 玩家充值未达标或者奖池余额耗尽则不能领取 // 玩家充值未达标或者奖池余额耗尽则不能领取
if (payNum < activityInfo.data['price'] || remaining <= 0) { if (payNum < price || remaining <= 0) {
return { return {
payNum, remaining, result: false, activityInfo, showOffList payNum, remaining, result: false, activityInfo, showOffList, price
} }
} }
// 检查玩家今日是否已经领取 // 检查玩家今日是否已经领取
@ -30,19 +31,19 @@ export async function playerCanReceive(call: ApiCall) {
if (playerActivityInfo) { if (playerActivityInfo) {
if (playerActivityInfo[zeroTime]) { if (playerActivityInfo[zeroTime]) {
return { return {
payNum, remaining, result: false, activityInfo, showOffList payNum, remaining, result: false, activityInfo, showOffList, price
}; };
} }
} }
return { return {
payNum, remaining, result: true, activityInfo, showOffList payNum, remaining, result: true, activityInfo, showOffList, price
}; };
} }
export default async function (call: ApiCall<ReqCanReceive, ResCanReceive>) { export default async function (call: ApiCall<ReqCanReceive, ResCanReceive>) {
const canReceiveResult = await playerCanReceive(call); const canReceiveResult = await playerCanReceive(call);
if (canReceiveResult) { if (canReceiveResult) {
const { payNum, remaining, result, showOffList } = canReceiveResult; const { payNum, remaining, result, showOffList, price } = canReceiveResult;
call.succ({ payNum, remaining, result, showOffList }); call.succ({ payNum, remaining, result, showOffList, price });
} }
} }

View File

@ -6,5 +6,6 @@ export type ResCanReceive = {
payNum: number; payNum: number;
remaining?: number; remaining?: number;
result: boolean; result: boolean;
price: number;
showOffList: any[]; showOffList: any[];
}; };

View File

@ -10329,6 +10329,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
}, },
{ {
"id": 3, "id": 3,
"name": "price",
"type": {
"type": "Number"
}
},
{
"id": 4,
"name": "showOffList", "name": "showOffList",
"type": { "type": {
"type": "Array", "type": "Array",