Merge branch 'feature/planb' into dev

This commit is contained in:
dy 2023-12-20 11:28:35 +08:00
commit b9db5098cc
11 changed files with 613 additions and 576 deletions

View File

@ -0,0 +1,21 @@
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 _hd = (await HuoDongFun.gethdList(call, 10))[0]
let payIds = _hd?.data?.gift?.filter(i => i.payId)?.map(i => i.payId)
let payLog = await PayFun.getPayLogs(call.uid, payIds, [_hd.stime, _hd.etime])
call.succ({
record: data?.record || {},
buyLog: payLog
})
}

View File

@ -0,0 +1,33 @@
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)
payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || []
if (!payLog || !payLog.length) 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 || data?.record?.[gift.id] == call.req.recId)) 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

@ -19,7 +19,7 @@ import {getShouChongRedPoint} from "../event/shouchong/ApiReceive";
const defaultKeys: hongdianKey[] = ['jiuba', 'jiaotang', 'shouchong', 'clslhd', 'dixiaqianzhuanghd', 'gonghuihd', 'hbzbhd', 'jjchd', 'taskhd',
'xstaskhd', 'lingzhulaixihd', 'dxlthd', 'wzcjhd', 'slzdhd', 'qjzzdhd', 'kuangdonghd', 'qiandaohd', 'kaifukuanghuanhd', 'jijinhd', 'zhuishalinghd',
'yibaichouhd', 'huobanzhaomuhd', 'qirileichonghd', 'jierihd', 'kbzzhd', 'wzryhd', 'yuedujijin', 'mingdao', 'patahd',
'heishihd', 'huodonghd', 'renown', 'weixiuchang', 'kaifujingsai', 'zhoumolibao'];
'heishihd', 'huodonghd', 'renown', 'weixiuchang', 'kaifujingsai', 'zhoumolibao', 'pobinglibao'];
export default async function (call: ApiCall<ReqGet, ResGet>) {

View File

@ -327,10 +327,7 @@ export class HuoDongHongDianFun {
hdxq: {}
}
};
let _hdList = []
for (let i = 0; i < 8; i++) {
_hdList.push(...await HuoDongFun.gethdList(call, i + 1))
}
let _hdList = await HuoDongFun.gethdList(call)
// let _hdList = await HuoDongFun.gethdList(call)
for (let index = 0; index < _hdList.length; index++) {
const element = _hdList[index];
@ -365,6 +362,11 @@ export class HuoDongHongDianFun {
ishd = await this.qiridengluHongDian(call, element)
}
if (element.htype == 10) {
// 检测 htype 10 破冰活动红点
ishd = await this.pobinglibao(call, element)
}
// 此活动有红点
if (ishd.show) {
_res.show = true
@ -376,6 +378,22 @@ export class HuoDongHongDianFun {
return _res;
}
/**破冰礼包红点 */
static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
let gift = _hd?.data?.gift?.find(i => i.id == call.req.id)
if (!gift) return {show: false}
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || []
if (!payLog || !payLog.length) return {show: false}
// 取奖励列表,判断是否有可领取奖励
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 || data?.record?.[gift.id] == call.req.recId)) return {show: false}
return {show: true}
}
/**开服狂欢红点 */
static async kfkhHongDian(call: ApiCall) {
let _res: hongdianVal = {

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: {
@ -51,6 +52,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

@ -84,12 +84,15 @@ export class PayFun {
return allPlayerPayLog?.[payId] || [];
}
static async getPayLogs(uid: string, payIds?: string[]) {
static async getPayLogs(uid: string, payIds?: string[], times?: number[]) {
let where = {
uid: uid,
del_time: {$exists: false}
}
if (payIds?.length) where['key'] = {$in: payIds}
if (times?.length) {
where['time'] = {$gte: times[0], $lte: times[1]}
}
let logs = await G.mongodb.collection("payLogNew").find(where, {
projection: {

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 {
}

View File

@ -51,7 +51,8 @@ export type hongdianKey =
| 'heishiMrjx'
| 'weixiuchang'
| 'kaifujingsai'
| 'zhoumolibao';
| 'zhoumolibao'
| 'pobinglibao';
export type hongdianVal = {

File diff suppressed because it is too large Load Diff