This commit is contained in:
ciniao 2023-12-14 11:33:14 +08:00
commit e0c0d03f4e
11 changed files with 638 additions and 365 deletions

4
.gitignore vendored
View File

@ -2,4 +2,6 @@
/.idea
/.vscode
/dist
/doc
/doc
/src/config.json

View File

@ -0,0 +1,20 @@
import {ApiCall} from "tsrpc";
import {ReqOpen, ResOpen} from "../../../shared/protocols/event/zhoumolibao/PtlOpen";
import {PayFun} from "../../../public/pay";
import {HuoDongFun} from "../../../public/huodongfun";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'})
let _hd = (await HuoDongFun.gethdList(call, 9))[0]
let payIds = _hd?.data?.gift?.filter(i => i.payId)?.map(i => i.payId)
call.succ({
record: data.record,
buyLog: await PayFun.getPayLogs(call.uid, payIds)
})
}

View File

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

View File

@ -1,7 +0,0 @@
{
"msgPort": 8100,
"openTime": "2023-12-01 00:00:02",
"httpPort": 8101,
"redisUrl": "redis://:lyMaple525458@10.0.1.20:6379/0",
"crossRedisUrl": "redis://:lyMaple525458@10.0.1.20:6379/1"
}

View File

@ -3293,7 +3293,8 @@
//礼包
gift: [
{
name: 'wkdtips_4',
id: '1',
name: 'wkdtips_4',
need: [],
free: true,
payId: '',
@ -3301,6 +3302,7 @@
prize: [{'a': 'item', 't': '13', 'n': 600}]
},
{
id: '2',
name: 'wkdtips_5',
need: [],
free: false,
@ -3309,6 +3311,7 @@
prize: [{'a': 'item', 't': '4', 'n': 1},{'a': 'item', 't': '13', 'n': 800},{'a': 'item', 't': '2', 'n': 1000},{'a': 'item', 't': '1', 'n': 1000}]
},
{
id: '3',
name: 'wkdtips_6',
need: [],
free: false,
@ -3317,6 +3320,7 @@
prize: [{'a': 'item', 't': '4', 'n': 2},{'a': 'item', 't': '13', 'n': 1000},{'a': 'item', 't': '2', 'n': 1200},{'a': 'item', 't': '1', 'n': 1200}]
},
{
id: '4',
name: 'wkdtips_7',
need: [],
free: false,

View File

@ -1300,5 +1300,18 @@
"display": {
"lv": 20
}
},
"zhoumolibao": {
"name": "zhoumolibao",
"undefined": "周末礼包",
"and": {
"lv": 15
},
"or": {},
"time": 0,
"tips": "openCond_tips_96",
"display": {
"lv": 15
}
}
}

View File

@ -20,6 +20,7 @@ import {ResOpen as ResOpenZhanLing} from '../shared/protocols/event/zhanling/Ptl
import {ResOpen as ResOpenZhoulibao} from '../shared/protocols/event/zhoulibao/PtlOpen';
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';
export type eventType = {
shouchong: {
@ -46,6 +47,7 @@ export type eventType = {
qirichongzhi: Omit<ResOpenQirichongzhi, 'finished'>;
jierihuodong: Omit<ResOpenJierihuodong, 'taskFinish'> & { refreshTime: number; };
kaifujingsai: ResOpenKaifujingsai
zhoumolibao: ResOpenZhoumolibao
} & {
[k: `${number}jijin`]: ResOpenYuedujijin;
[k: `yangchengmubiao${number}`]: yangchengmubiao;

View File

@ -37,6 +37,7 @@ export class HuoDongFun {
let openTime = PublicShared.getToDayZeroTime(G.openTime)
let _sDay = Number((G.time - openTime) / 86400)
// ttype为0 根据开服时间计算ttype为1根据用户注册时间计算
let _where = {
$or: [
{

View File

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

View File

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

File diff suppressed because it is too large Load Diff