Compare commits
2 Commits
a5e726e811
...
3e1c45aaf9
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3e1c45aaf9 | ||
![]() |
f1dacd19b6 |
@ -6,7 +6,6 @@ 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]
|
||||
if (!_hd) return call.errorCode(-1)
|
||||
@ -16,9 +15,11 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
let payLog: any = await PayFun.getPayLogs(call.uid, payIds)
|
||||
|
||||
for (let key in payLog) {
|
||||
payLog[key]?.filter(i => i.time > _hd.stime && i.time < _hd.etime)
|
||||
payLog[key] = payLog[key]?.filter(i => i.time > _hd.stime && i.time < _hd.etime)
|
||||
}
|
||||
|
||||
let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`})
|
||||
|
||||
call.succ({
|
||||
record: data?.record || {},
|
||||
buyLog: payLog
|
||||
|
@ -7,30 +7,27 @@ import {PayFun} from "../../../public/pay";
|
||||
|
||||
export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
|
||||
if (!call.req.id) return call.errorCode(-1)
|
||||
|
||||
// 查询活动是否有当前领奖的免费选项
|
||||
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)
|
||||
if (!gift || !call.req.recId) 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 data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`})
|
||||
let rec = data?.record?.[call.req.id]?.length
|
||||
if (rec && (rec >= 3 || data?.record?.[gift.id] == call.req.recId)) return call.errorCode(-3)
|
||||
|
||||
await PlayerFun.sendPrize(call, gift[call.req.recId]);
|
||||
|
||||
await G.mongodb.cEvent('pobinglibao').updateOne({uid: call.uid, type: 'pobinglibao'}, {
|
||||
await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).updateOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`}, {
|
||||
$push: {[`record.${gift.id}`]: call.req.recId},
|
||||
}, {upsert: true})
|
||||
|
||||
call.succ({})
|
||||
call.succ({prize: gift[call.req.recId]})
|
||||
|
||||
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ export class HuoDongHongDianFun {
|
||||
let payLogs = await PayFun.getPayLogs(call.uid, payIds)
|
||||
|
||||
// 取奖励列表,判断是否有可领取奖励
|
||||
let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'})
|
||||
let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`})
|
||||
|
||||
for (let item of _hd?.data?.gift){
|
||||
let rec = data?.record?.[item.id]?.length
|
||||
|
@ -54,7 +54,6 @@ export type eventType = {
|
||||
jierihuodong: Omit<ResOpenJierihuodong, 'taskFinish'> & { refreshTime: number; };
|
||||
kaifujingsai: ResOpenKaifujingsai;
|
||||
zhoumolibao: ResOpenZhoumolibao & { refreshTime: number; };
|
||||
pobinglibao: ResOpenPobinglibao
|
||||
payForDiamond: {
|
||||
[time: number]: number
|
||||
}
|
||||
@ -74,6 +73,7 @@ export type eventType = {
|
||||
[k: `qiridenglu${number}`]: Pick<ResOpenQiridenglu, 'recPrize'>;
|
||||
[k: `leichonglibao${number}`]: ResOpenLeiChongLiBao & { opentime: number };
|
||||
[k: `yuandan${number}`]: ResOpenYuandan;
|
||||
[k: `pobinglibao${number}`]: ResOpenPobinglibao;
|
||||
};
|
||||
|
||||
export type CollectionEvent<T extends keyof eventType> = {
|
||||
|
@ -1,11 +1,13 @@
|
||||
import {prizeType} from "../../type";
|
||||
|
||||
/**
|
||||
* 破冰礼包领奖
|
||||
*/
|
||||
export interface ReqReceive {
|
||||
export type ReqReceive = {
|
||||
id: string
|
||||
recId: string
|
||||
}
|
||||
|
||||
export interface ResReceive {
|
||||
|
||||
export type ResReceive = {
|
||||
prize: prizeType[]
|
||||
}
|
||||
|
@ -10560,7 +10560,20 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
]
|
||||
},
|
||||
"event/pobinglibao/PtlReceive/ResReceive": {
|
||||
"type": "Interface"
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "prize",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
"elementType": {
|
||||
"type": "Reference",
|
||||
"target": "type/prizeType"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"event/qirichongzhi/PtlOpen/ReqOpen": {
|
||||
"type": "Interface"
|
||||
|
Loading…
Reference in New Issue
Block a user