破冰礼包
This commit is contained in:
parent
cea27e9ea4
commit
1a6789b17b
@ -8,47 +8,14 @@ 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 _hd = (await HuoDongFun.gethdList(call, 10))[0]
|
||||
|
||||
let payIds = gift.filter(i => i.payId)?.map(i => i.payId)
|
||||
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: await PayFun.getPayLogs(call.uid, payIds)
|
||||
buyLog: payLog
|
||||
})
|
||||
}
|
||||
|
||||
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: []})))
|
||||
// }
|
||||
}
|
@ -12,13 +12,14 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
if (!gift) return call.errorCode(-1)
|
||||
|
||||
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
|
||||
if (!payLog) return call.errorCode(-2)
|
||||
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) return call.errorCode(-3)
|
||||
if (rec && (rec >= 2 || data?.record?.[gift.id] == call.req.recId)) return call.errorCode(-3)
|
||||
|
||||
await PlayerFun.sendPrize(call, gift.prize);
|
||||
|
||||
@ -28,5 +29,5 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
|
||||
call.succ({})
|
||||
|
||||
// HongDianChange.sendChangeKey(call.uid, ['pobinglibao']);
|
||||
HongDianChange.sendChangeKey(call.uid, ['pobinglibao']);
|
||||
}
|
||||
|
@ -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>) {
|
||||
|
||||
|
@ -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 = {
|
||||
|
@ -83,12 +83,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: {
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user