更新圣诞活动相关代码
This commit is contained in:
parent
5fabfb2c5a
commit
582ac4f7e3
@ -8,17 +8,24 @@ import {PlayerFun} from "../../../public/player";
|
||||
export default async function (call: ApiCall<ReqGame, ResGame>) {
|
||||
let initCon = await Christmasfun.getCon(call)
|
||||
let need = initCon[call.req.hdid].data.gameneed;
|
||||
let freenum = initCon[call.req.hdid].data.gamefree
|
||||
let addval = initCon[call.req.hdid].data.game[call.req.index];
|
||||
// 判断消耗是否满足
|
||||
await PlayerFun.checkNeedIsMeet(call, need);
|
||||
// 扣除消耗
|
||||
await PlayerFun.cutNeed(call, need);
|
||||
|
||||
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
|
||||
// 判断是否有免费配置
|
||||
if (_mydata.gamenum >= freenum) {
|
||||
// 判断消耗是否满足
|
||||
await PlayerFun.checkNeedIsMeet(call, need);
|
||||
// 扣除消耗
|
||||
await PlayerFun.cutNeed(call, need);
|
||||
}
|
||||
|
||||
let _setData = {}
|
||||
_mydata["val"] += addval
|
||||
_setData["val"] = _mydata["val"]
|
||||
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData })
|
||||
_mydata["gamenum"] += 1
|
||||
_setData["val"] = _mydata.val
|
||||
_setData["game"] = _mydata["gamenum"]
|
||||
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData})
|
||||
let changedata = { mydata: _mydata}
|
||||
// 推送红点
|
||||
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
|
||||
|
@ -22,13 +22,14 @@ export default async function (call: ApiCall<ReqLiBao, ResLiBao>) {
|
||||
// 判断是否能购买
|
||||
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
const _select = _mydata.select[lbid] || {}
|
||||
if (Object.keys(_select).length >= _con.dlz.length) {
|
||||
let _select = _mydata.select[lbid] || {}
|
||||
if (Object.keys(_select).length < _con.dlz.length) {
|
||||
// 判断是否选择奖励了
|
||||
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
|
||||
let _prize: atn[] = _con.prize
|
||||
let _prize: atn[] = _con.basep
|
||||
|
||||
for (let key in _select) {
|
||||
_prize.push(_con.dlz[parseInt(key)][_select[key]])
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
// 无此活动
|
||||
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
||||
}
|
||||
|
||||
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
|
||||
let changedata = { mydata: _mydata, hdinfo: _hdinfo }
|
||||
call.succ(changedata);
|
||||
|
@ -17,7 +17,7 @@ export default async function (call: ApiCall<ReqQianDao, ResQianDao>) {
|
||||
for(let i = 0; i < _diff; i++) {
|
||||
if (_mydata.qiandao.includes(i)) continue
|
||||
_mydata.qiandao.push(i)
|
||||
_prize.push(_con[i])
|
||||
_prize = _prize.concat(_con[i])
|
||||
}
|
||||
|
||||
if (!_prize){
|
||||
|
@ -20,12 +20,14 @@ export default async function (call: ApiCall<ReqZhanLingRec, ResZhanLingRec>) {
|
||||
|
||||
if (!_mydata.pt.includes(index)){
|
||||
// 如果普通奖励没有领取
|
||||
_prize.push(_con.pt)
|
||||
|
||||
_prize = _prize.concat(_con.pt)
|
||||
_mydata.pt.push(index)
|
||||
}
|
||||
if (_mydata.pay && !_mydata.gj.includes(index)){
|
||||
// 如果普通奖励没有领取
|
||||
_prize.push(_con.gj)
|
||||
_prize = _prize.concat(_con.gj)
|
||||
|
||||
_mydata.gj.push(index)
|
||||
}
|
||||
if (!_prize) {
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { strict } from 'assert';
|
||||
import { ApiCall } from 'tsrpc';
|
||||
import {ApiCall, BaseConnection} from 'tsrpc';
|
||||
import { ReqAddHuoDong } from '../../../monopoly/protocols/PtlAddHuoDong';
|
||||
import { HuoDongFun } from '../../../public/huodongfun';
|
||||
import { TaskFun } from '../../../public/task';
|
||||
import { christmas } from '../../../shared/protocols/event/christmas/PtlOpen';
|
||||
import { PublicShared } from '../../../shared/public/public';
|
||||
|
||||
import {player} from '../../../shared/protocols/user/type';
|
||||
import {PlayerFun} from "../../../public/player";
|
||||
|
||||
export class Christmasfun {
|
||||
/**配置 */
|
||||
@ -61,6 +62,7 @@ export class Christmasfun {
|
||||
taskval: await this.getTaskVal(call, hdid),
|
||||
taskfinish: [],
|
||||
refresh: G.time,
|
||||
gamenum: 0,
|
||||
pt: [],
|
||||
gj: [],
|
||||
pay: false,
|
||||
@ -114,20 +116,49 @@ export class Christmasfun {
|
||||
return mydata
|
||||
}
|
||||
|
||||
static async payChristmas(payid, call: ApiCall) {
|
||||
let _hd = await HuoDongFun.gethdList(call, 8)
|
||||
for (let index = 0; index < _hd.length; index++) {
|
||||
const hdinfo = _hd[index];
|
||||
const _hdid = hdinfo.hdid
|
||||
if (payid == hdinfo.data.zlpayid){
|
||||
let _mydata = await Christmasfun.getMyData(call, _hdid)
|
||||
if (_mydata.pay) continue
|
||||
await this.setMyData(call.uid, _hdid, { $set: { pay: true} })
|
||||
let _prize = hdinfo.data.zlpayprize
|
||||
await PlayerFun.sendPrize(call, _prize);
|
||||
}
|
||||
else{
|
||||
const libaos = hdinfo.data.libao
|
||||
for (let index = 0; index < Object.keys(libaos).length; index++){
|
||||
const lbid = Object.keys(libaos)[index];
|
||||
let _tmp = libaos[lbid]
|
||||
if (_tmp['payid'] != payid) continue
|
||||
let _mydata = await Christmasfun.getMyData(call, _hdid)
|
||||
let _buyNum = _mydata.libao[lbid] || 0
|
||||
if (_buyNum >= _tmp["buynum"]) continue
|
||||
_mydata.libao[lbid] = _buyNum + 1
|
||||
this.setMyData(call.uid, _hdid, { $set: { libao: _mydata.libao} })
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**设置任务 */
|
||||
static async setTaskVal(call: ApiCall, stype: number, val: number, chkCall: Function, chkval: number = 0, isinc: number = 0, alchangeVal: Function, arg) {
|
||||
let hdids = await this.gethdids(call)
|
||||
if (hdids.length <= 0) return // 活动过期,不计数
|
||||
let _initCon = await this.getCon(call)
|
||||
|
||||
|
||||
|
||||
for (let index = 0; index < hdids.length; index++) {
|
||||
const hdid = hdids[index];
|
||||
let _mydata = await Christmasfun.getMyData(call, hdid)
|
||||
let _tasks = _initCon[hdid].data.task
|
||||
|
||||
let _setData = {
|
||||
let _setData= {
|
||||
$inc: {},
|
||||
$set: {}
|
||||
}
|
||||
@ -165,4 +196,4 @@ export class Christmasfun {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import { player } from './shared/protocols/user/type';
|
||||
import { PublicShared } from './shared/public/public';
|
||||
import { setGud } from './public/gud';
|
||||
import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen";
|
||||
import {Christmasfun} from "./api_s2c/event/christmas/fun";
|
||||
|
||||
export type gEventType = {
|
||||
/**玩家断开连接 */
|
||||
@ -23,7 +24,7 @@ export type gEventType = {
|
||||
/**玩家修改名字 */
|
||||
PLAYER_CHANGE_NAME: (gud: player, name: string) => void;
|
||||
/**玩家充值 */
|
||||
PLAYER_PAY: (gud: player, payId: string, type: 'user' | 'system') => void;
|
||||
PLAYER_PAY: (gud: player, payId: string, type: 'user' | 'system', call) => void;
|
||||
/**玩家发生api调用 */
|
||||
API_CALL: (node: { call: ApiCall, return: ApiReturn<any>; }) => void;
|
||||
/**玩家每日首次登陆 */
|
||||
@ -166,13 +167,14 @@ export function addListener() {
|
||||
}
|
||||
});
|
||||
|
||||
G.on('PLAYER_PAY', async (player, payId, payArgs) => {
|
||||
G.on('PLAYER_PAY', async (player, payId, payArgs,call) => {
|
||||
let conf: any = await PayFun.getConf(payId, payArgs);
|
||||
ActionLog.addDayLog(player.uid, { key: 'pay', val: conf.payExp[0].n });
|
||||
ActionLog.addRetainLog(player.uid, { key: 'pay', val: conf.payExp[0].n });
|
||||
|
||||
if (payId == G.gc.zhanling.payId) payZhanLing(player);
|
||||
|
||||
//圣诞节活动充值
|
||||
Christmasfun.payChristmas(payId, call);
|
||||
let payEmailConf = G.gc.payEmail[payId] as _gcType['payEmail']['caifutequan'];
|
||||
if (payEmailConf?.length > 0) {
|
||||
let sendEmailConfs = payEmailConf;
|
||||
@ -202,18 +204,17 @@ export function addListener() {
|
||||
ActionLog.addRetainLog(gud.uid, { key: 'login_day', val: 1 });
|
||||
ZhanLingTasks.clearLog(gud.uid, 'day');
|
||||
PayFun.checkGiftDayEmail(gud, lastTime, curTime);
|
||||
|
||||
reissuePrize(gud, lastTime, curTime);
|
||||
addDay(gud);
|
||||
|
||||
// 任务累计登录天数
|
||||
let call = PayFun.getCall(gud);
|
||||
|
||||
G.emit("Class_task_135", 'Class_task_135', call, 1, 0);
|
||||
// 七日登录活动计数
|
||||
qiRiDengLuAddDay(call);
|
||||
// 周末礼包检测刷新
|
||||
checkResetBuyLog(call)
|
||||
checkResetBuyLog(call);
|
||||
|
||||
});
|
||||
|
||||
G.on('API_CALL', node => {
|
||||
|
@ -5,7 +5,7 @@ export default {
|
||||
/**是否开发模式 */
|
||||
debug: true,
|
||||
/**消息服socket端口*/
|
||||
msgPort: 7778,
|
||||
msgPort: 7785,
|
||||
/**http端口 msg服专用*/
|
||||
// httpPort: 7779,
|
||||
/**跨服socket端口 */
|
||||
@ -13,7 +13,7 @@ export default {
|
||||
/**跨服 ws url */
|
||||
corssWsUrl: "ws://10.0.1.20:10003",
|
||||
/**服务器id */
|
||||
serverId: 0,
|
||||
serverId: 1001,
|
||||
/**redis url */
|
||||
redisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/0',
|
||||
/**mongodb url */
|
||||
@ -27,7 +27,7 @@ export default {
|
||||
/**服务器时间 */
|
||||
time: '',
|
||||
/**开服时间 */
|
||||
openTime: '2022-10-10 1:0:0',
|
||||
openTime: '2023-12-11 1:0:0',
|
||||
/**项目名称 */
|
||||
projectName: 'heijiao',
|
||||
/**加密key */
|
||||
|
@ -271,7 +271,7 @@ export class PayFun {
|
||||
}
|
||||
});
|
||||
|
||||
G.emit('PLAYER_PAY', player, payId, payArgs);
|
||||
G.emit('PLAYER_PAY', player, payId, payArgs, call);
|
||||
G.emit("Class_task_116", 'Class_task_116', call, 1, 0);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@ export type christmas = {
|
||||
taskval: { [id: string]: number }
|
||||
/**任务领取标识 */
|
||||
taskfinish: string[]
|
||||
/**小游戏挑战次数 */
|
||||
gamenum: number
|
||||
/**普通战令奖励集合 奖励id */
|
||||
pt: number[]
|
||||
/**高级战令奖励集合 奖励id */
|
||||
@ -36,7 +38,7 @@ export type christmas = {
|
||||
/**装扮值 */
|
||||
val: number
|
||||
/**签到标识 */
|
||||
qiandao:string[],
|
||||
qiandao:number[],
|
||||
/**刷新时间 */
|
||||
refresh: number
|
||||
}
|
@ -2,11 +2,11 @@
|
||||
"hdid" : 91029302193,
|
||||
"htype" : 8,
|
||||
"stype" : 800,
|
||||
"ttype" : 1,
|
||||
"stime" : 60,
|
||||
"rtime" : 90,
|
||||
"etime" : 90,
|
||||
"name" : "xinfupeiyang",
|
||||
"ttype" : 0,
|
||||
"stime" : 1702396800,
|
||||
"rtime" : 1703088000,
|
||||
"etime" : 1703088000,
|
||||
"name" : "christmas",
|
||||
"icon" : "icon_xfdj",
|
||||
"showtime" : "根据玩家注册时间,游戏返回时复写",
|
||||
"data" : {
|
||||
@ -52,24 +52,51 @@
|
||||
}
|
||||
},
|
||||
"gameneed": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"game": [0,1,2,3,4,5],
|
||||
"zhanling":[
|
||||
{
|
||||
"val": 1,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 2,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 3,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"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": {
|
||||
|
@ -8642,6 +8642,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "gamenum",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "pt",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
@ -8651,7 +8658,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"id": 7,
|
||||
"name": "gj",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
@ -8661,14 +8668,14 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"id": 8,
|
||||
"name": "pay",
|
||||
"type": {
|
||||
"type": "Boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"id": 9,
|
||||
"name": "libao",
|
||||
"type": {
|
||||
"type": "Interface",
|
||||
@ -8681,7 +8688,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"id": 10,
|
||||
"name": "select",
|
||||
"type": {
|
||||
"type": "Interface",
|
||||
@ -8700,24 +8707,24 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"id": 11,
|
||||
"name": "val",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"id": 12,
|
||||
"name": "qiandao",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
"elementType": {
|
||||
"type": "String"
|
||||
"type": "Number"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"id": 13,
|
||||
"name": "refresh",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
|
Loading…
Reference in New Issue
Block a user