破冰礼包

This commit is contained in:
dy 2023-12-19 13:42:23 +08:00
parent eb1e346988
commit 38e04d29ab
6 changed files with 115 additions and 151 deletions

View File

@ -0,0 +1,54 @@
import {ApiCall} from "tsrpc";
import {ReqOpen, ResOpen} from "../../../shared/protocols/event/zhoumolibao/PtlOpen";
import {PayFun} from "../../../public/pay";
import {HuoDongFun} from "../../../public/huodongfun";
import {PublicShared} from "../../../shared/public/public";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'})
let gift = await getConf(call)
let payIds = gift.filter(i => i.payId)?.map(i => i.payId)
call.succ({
record: data?.record || {},
buyLog: await PayFun.getPayLogs(call.uid, payIds)
})
}
export async function getConf(call, args?: { id?: string; payId?: string }) {
let _hd = (await HuoDongFun.gethdList(call, 10))[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) {
// G.mongodb.cEvent(`zhoumolibao`).updateOne(
// {uid: call.uid, type: `zhoumolibao`},
// {$set: {record: {}, refreshTime: G.time}},
// {upsert: true}
// )
// }
//
// let gifts = await getConf(call)
//
// let payIds = gifts.filter(i => i.payId)?.map(i => i.payId)
// let payLogs = await PayFun.getPayLogs(call.uid, payIds)
// let payLogLength = R.flatten(R.values(payLogs)).filter(i => i.time < zeroTime).length
// if (payLogLength) {
// PayFun.delPayLog(call.uid, ...payIds.map(i => ({payId: i, val: []})))
// }
}

View File

@ -0,0 +1,32 @@
import {ApiCall} from "tsrpc";
import {ReqReceive, ResReceive} from "../../../shared/protocols/event/pobinglibao/PtlReceive";
import {HuoDongFun} from "../../../public/huodongfun";
import {PlayerFun} from "../../../public/player";
import {HongDianChange} from "../../hongdian/fun";
import {PayFun} from "../../../public/pay";
export default async function (call: ApiCall<ReqReceive, ResReceive>) {
// 查询活动是否有当前领奖的免费选项
let _hd = (await HuoDongFun.gethdList(call, 10))[0]
let gift = _hd?.data?.gift?.find(i => i.id == call.req.id)
if (!gift) return call.errorCode(-1)
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
if (!payLog) return call.errorCode(-2)
// 取奖励列表,判断是否有可领取奖励
let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'})
let rec = data?.record?.[call.req.id].length
if (rec && rec >= 2) return call.errorCode(-3)
await PlayerFun.sendPrize(call, gift.prize);
await G.mongodb.cEvent('pobinglibao').updateOne({uid: call.uid, type: 'pobinglibao'}, {
$push: {[`record.${gift.id}`]: call.req.recId},
}, {upsert: true})
call.succ({})
// HongDianChange.sendChangeKey(call.uid, ['pobinglibao']);
}

View File

@ -21,6 +21,7 @@ import {ResOpen as ResOpenZhoulibao} from '../shared/protocols/event/zhoulibao/P
import {ResOpen as ResOpenZixuanlibao} from '../shared/protocols/event/zixuanlibao/PtlOpen';
import {ResOpen as ResOpenKaifujingsai} from '../shared/protocols/kaifujingsai/PtlOpen';
import {ResOpen as ResOpenZhoumolibao} from '../shared/protocols/event/zhoumolibao/PtlOpen';
import {ResOpen as ResOpenPobinglibao} from '../shared/protocols/event/pobinglibao/PtlOpen';
export type eventType = {
shouchong: {
@ -48,6 +49,7 @@ export type eventType = {
jierihuodong: Omit<ResOpenJierihuodong, 'taskFinish'> & { refreshTime: number; };
kaifujingsai: ResOpenKaifujingsai;
zhoumolibao: ResOpenZhoumolibao & { refreshTime: number; }
pobinglibao: ResOpenPobinglibao
} & {
[k: `${number}jijin`]: ResOpenYuedujijin;
[k: `yangchengmubiao${number}`]: yangchengmubiao;

View File

@ -1,151 +0,0 @@
{
"hdid" : 91029302193,
"htype" : 8,
"stype" : 800,
"ttype" : 0,
"stime" : 1702396800,
"rtime" : 1703088000,
"etime" : 1703088000,
"name" : "christmas",
"icon" : "icon_xfdj",
"showtime" : "根据玩家注册时间,游戏返回时复写",
"data" : {
"task" : {
"1": {
"pval" : 1,
"stype" : "",
"cond": [],
"prize" : [
{
"a" : "item",
"t" : "1",
"n" : 500000
}
],
"des" : "intr_cszl_des_1"
},
"2": {
"pval" : 1,
"stype" : "101",
"cond": [],
"prize" : [
{
"a" : "item",
"t" : "1",
"n" : 500000
}
],
"des" : "intr_cszl_des_1"
},
"3": {
"pval" : 2,
"stype" : "101",
"cond": [],
"prize" : [
{
"a" : "item",
"t" : "1",
"n" : 500000
}
],
"des" : "intr_cszl_des_1"
}
},
"gameneed": [{"a": "attr", "t":"jinbi", "n": 1}],
"game": [0,1, 2, 3, 4, 5],
"gamefree": 3,
"zhanling":[{
"val": 1,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
},
{
"val": 2,
"pt": [{"a": "attr", "t":"rmbmoney", "n": 100}],
"gj": [{"a": "attr", "t":"rmbmoney", "n": 100},{"a": "attr", "t":"jinbi", "n": 1}]
},
{
"val": 3,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
},{
"val": 4,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
},
{
"val": 5,
"pt": [{"a": "attr", "t":"rmbmoney", "n": 100}],
"gj": [{"a": "attr", "t":"rmbmoney", "n": 100},{"a": "attr", "t":"jinbi", "n": 1}]
},
{
"val": 6,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
},{
"val": 7,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
},
{
"val": 8,
"pt": [{"a": "attr", "t":"rmbmoney", "n": 100}],
"gj": [{"a": "attr", "t":"rmbmoney", "n": 100},{"a": "attr", "t":"jinbi", "n": 1}]
},
{
"val": 9,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
}],
"zlpayid":"ycmb_1_1",
"libao": {
"1": {
"payid": "",
"buynum": 2,
"basep": [{"a": "attr", "t":"rmbmoney", "n": 1}],
"des" : "intr_cszl_des_1",
"dlz": [
{
"1": {"a": "attr", "t":"rmbmoney", "n": 1},
"2": {"a": "attr", "t":"rmbmoney", "n": 2},
"3": {"a": "attr", "t":"rmbmoney", "n": 3}
},
{
"1": {"a": "attr", "t":"rmbmoney", "n": 1},
"2": {"a": "attr", "t":"rmbmoney", "n": 2},
"3": {"a": "attr", "t":"rmbmoney", "n": 3}
}
]
},
"2": {
"payid": "ycmb_1_2",
"buynum": 2,
"basep": [{"a": "attr", "t":"rmbmoney", "n": 2}],
"des" : "intr_cszl_des_2",
"dlz": [
{
"1": {"a": "attr", "t":"rmbmoney", "n": 1},
"2": {"a": "attr", "t":"rmbmoney", "n": 2},
"3": {"a": "attr", "t":"rmbmoney", "n": 3}
},
{
"1": {"a": "attr", "t":"rmbmoney", "n": 1},
"2": {"a": "attr", "t":"rmbmoney", "n": 2},
"3": {"a": "attr", "t":"rmbmoney", "n": 3}
}
]
}
},
"qiandao": [
[{"a": "attr", "t":"jinbi", "n": 1}],
[{"a": "attr", "t":"jinbi", "n": 1}],
[{"a": "attr", "t":"jinbi", "n": 1}],
[{"a": "attr", "t":"jinbi", "n": 1}],
[{"a": "attr", "t":"jinbi", "n": 1}],
[{"a": "attr", "t":"jinbi", "n": 1}],
[{"a": "attr", "t":"jinbi", "n": 1}]
]
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
export type ReqOpen = {
};
export type ResOpen = {
record:{
[k: string]: any;
}
buyLog:{
[k: string]: any;
}
};

View File

@ -0,0 +1,11 @@
/**
*
*/
export interface ReqReceive {
id: string
recId: string
}
export interface ResReceive {
}