Merge branch 'bugfix' into dev
This commit is contained in:
commit
4c0a37cd78
@ -91,13 +91,13 @@ export default async function (call: ApiCall<ReqPkBoss, ResPkBoss>) {
|
|||||||
}
|
}
|
||||||
_mySetDat = {
|
_mySetDat = {
|
||||||
maxdps: _myData.maxdps,
|
maxdps: _myData.maxdps,
|
||||||
time: _myData.time,
|
|
||||||
}
|
}
|
||||||
_bossData.delhp += result.totalDamage[0]
|
_bossData.delhp += result.totalDamage[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 无论挑战成功失败都扣除战斗次数
|
// 无论挑战成功失败都扣除战斗次数
|
||||||
_mySetDat["num"] = _myData.num + 1;
|
_mySetDat["num"] = _myData.num + 1;
|
||||||
|
_mySetDat["time"] = G.time;
|
||||||
|
|
||||||
// 设置boss数据
|
// 设置boss数据
|
||||||
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import {ApiCall} from "tsrpc";
|
||||||
import { LingZhuLaiXifun } from "../../public/lingzhulaixi";
|
import {LingZhuLaiXifun} from "../../public/lingzhulaixi";
|
||||||
import { PlayerFun } from "../../public/player";
|
import {PlayerFun} from "../../public/player";
|
||||||
import { ReqSaoDang, ResSaoDang } from "../../shared/protocols/lingzhulaixi/PtlSaoDang";
|
import {ReqSaoDang, ResSaoDang} from "../../shared/protocols/lingzhulaixi/PtlSaoDang";
|
||||||
import { PublicShared } from "../../shared/public/public";
|
import {PublicShared} from "../../shared/public/public";
|
||||||
import { HongDianChange } from "../hongdian/fun";
|
import {HongDianChange} from "../hongdian/fun";
|
||||||
import {ActionLog} from "../../public/actionLog/actionLog";
|
import {ActionLog} from "../../public/actionLog/actionLog";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
||||||
let _con = await LingZhuLaiXifun.getCon(call.req.bid)
|
let _con = await LingZhuLaiXifun.getCon(call.req.bid)
|
||||||
if (!_con) {
|
if (!_con) {
|
||||||
// 参数错误,无相关配置
|
// 参数错误,无相关配置
|
||||||
return call.error('', { code: -1, message: globalThis.lng.lingzhulaixi_1 })
|
return call.error('', {code: -1, message: globalThis.lng.lingzhulaixi_1})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (call.conn.gud.lv < _con.lv) {
|
if (call.conn.gud.lv < _con.lv) {
|
||||||
// 等级不足
|
// 等级不足
|
||||||
return call.error('', { code: -2, message: globalThis.lng.lingzhulaixi_2 })
|
return call.error('', {code: -2, message: globalThis.lng.lingzhulaixi_2})
|
||||||
}
|
}
|
||||||
|
|
||||||
// boss信息
|
// boss信息
|
||||||
let _bossData = await LingZhuLaiXifun.getBossData(call.req.bid)
|
let _bossData = await LingZhuLaiXifun.getBossData(call.req.bid)
|
||||||
if (_bossData.passtime != 0) {
|
if (_bossData.passtime != 0) {
|
||||||
// boss 未复活
|
// boss 未复活
|
||||||
return call.error('', { code: -3, message: globalThis.lng.lingzhulaixi_4 })
|
return call.error('', {code: -3, message: globalThis.lng.lingzhulaixi_4})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_bossData.pkuser[call.uid]) {
|
if (!_bossData.pkuser[call.uid]) {
|
||||||
// 未挑战过,请先去挑战
|
// 未挑战过,请先去挑战
|
||||||
return call.error('', { code: -4, message: globalThis.lng.lingzhulaixi_5 })
|
return call.error('', {code: -4, message: globalThis.lng.lingzhulaixi_5})
|
||||||
}
|
}
|
||||||
|
|
||||||
let _myData = await LingZhuLaiXifun.getUsePKNum(call)
|
let _myData = await LingZhuLaiXifun.getUsePKNum(call)
|
||||||
@ -54,7 +54,7 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
|||||||
|
|
||||||
if (!prize[0]) {
|
if (!prize[0]) {
|
||||||
// 无奖励,没有挑战次数
|
// 无奖励,没有挑战次数
|
||||||
return call.error('', { code: -5, message: globalThis.lng.lingzhulaixi_6 })
|
return call.error('', {code: -5, message: globalThis.lng.lingzhulaixi_6})
|
||||||
}
|
}
|
||||||
|
|
||||||
let _setData // 设置数据
|
let _setData // 设置数据
|
||||||
@ -71,8 +71,8 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
|||||||
Object.assign(_bossData, _setData["$set"])
|
Object.assign(_bossData, _setData["$set"])
|
||||||
// 清除玩家数据
|
// 清除玩家数据
|
||||||
await G.mongodb.cPlayerInfo('lingzhulaixi').updateMany(
|
await G.mongodb.cPlayerInfo('lingzhulaixi').updateMany(
|
||||||
{ type: 'lingzhulaixi' },
|
{type: 'lingzhulaixi'},
|
||||||
{ $set: G.mongodb.createTreeObj({ key: `maxdps.${call.req.bid}`, val: 0 }) }
|
{$set: G.mongodb.createTreeObj({key: `maxdps.${call.req.bid}`, val: 0})}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
_setData = {
|
_setData = {
|
||||||
@ -86,13 +86,13 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
|||||||
|
|
||||||
// 设置boss数据
|
// 设置boss数据
|
||||||
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
||||||
await LingZhuLaiXifun.setMyData(call, { $inc: { num: _num } })
|
await LingZhuLaiXifun.setMyData(call, {$inc: {num: _num}, $set: {time: G.time}})
|
||||||
|
|
||||||
// 发奖
|
// 发奖
|
||||||
prize = PublicShared.mergePrize(prize)
|
prize = PublicShared.mergePrize(prize)
|
||||||
await PlayerFun.sendPrize(call, prize)
|
await PlayerFun.sendPrize(call, prize)
|
||||||
|
|
||||||
ActionLog.addDayLog(call.uid, { key: "lingzhulaixi/PkBoss", val: _num });
|
ActionLog.addDayLog(call.uid, {key: "lingzhulaixi/PkBoss", val: _num});
|
||||||
|
|
||||||
// 扣除挑战次数
|
// 扣除挑战次数
|
||||||
_myData.num += _num
|
_myData.num += _num
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import {ApiCall} from "tsrpc";
|
||||||
import { PataFun } from "../../public/pata";
|
import {PataFun} from "../../public/pata";
|
||||||
import { PlayerFun } from "../../public/player";
|
import {PlayerFun} from "../../public/player";
|
||||||
import { ReqSaoDang, ResSaoDang } from "../../shared/protocols/pata/PtlSaoDang";
|
import {ReqSaoDang, ResSaoDang} from "../../shared/protocols/pata/PtlSaoDang";
|
||||||
import { PlayerShared } from '../../shared/public/player';
|
import {PlayerShared} from '../../shared/public/player';
|
||||||
import { PublicShared } from "../../shared/public/public";
|
import {PublicShared} from "../../shared/public/public";
|
||||||
import { HongDianChange } from "../hongdian/fun";
|
import {HongDianChange} from "../hongdian/fun";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
||||||
let changeInfo = await PataFun.getInfo(call.uid);
|
let changeInfo = await PataFun.getInfo(call.uid);
|
||||||
@ -25,11 +25,11 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
|||||||
|
|
||||||
changeInfo.saodangNum = call.req.num + (changeInfo?.saodangNum || 0);
|
changeInfo.saodangNum = call.req.num + (changeInfo?.saodangNum || 0);
|
||||||
// 改变的数据
|
// 改变的数据
|
||||||
let setData = {
|
// let setData = {
|
||||||
saodangNum: changeInfo.saodangNum
|
// saodangNum: changeInfo.saodangNum
|
||||||
};
|
// };
|
||||||
// 设置数据
|
// 设置数据
|
||||||
await PataFun.changeInfo(call.uid, changeInfo.sid, { $set: setData });
|
await PataFun.changeInfo(call.uid, changeInfo.sid, {"$inc": {saodangNum: call.req.num}});
|
||||||
_prize = await PlayerFun.sendPrize(call, _prize);
|
_prize = await PlayerFun.sendPrize(call, _prize);
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import {ApiCall} from "tsrpc";
|
||||||
import { HeroFun } from '../../public/hero';
|
import { addGameLog } from "../../gameLog";
|
||||||
import { XstaskFun } from '../../public/xstask';
|
import {HeroFun} from '../../public/hero';
|
||||||
import { ReqOnekeyReceive, ResOnekeyReceive } from "../../shared/protocols/xstask/PtlOnekeyReceive";
|
import {XstaskFun} from '../../public/xstask';
|
||||||
import { HeroShared } from '../../shared/public/hero';
|
import {ReqOnekeyReceive, ResOnekeyReceive} from "../../shared/protocols/xstask/PtlOnekeyReceive";
|
||||||
import { HongDianChange } from "../hongdian/fun";
|
import {HeroShared} from '../../shared/public/hero';
|
||||||
|
import {HongDianChange} from "../hongdian/fun";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>) {
|
export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>) {
|
||||||
|
|
||||||
@ -33,7 +34,9 @@ export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>
|
|||||||
if (heroList.length != heroIds.length) return call.error(globalThis.lng.xstask_6);
|
if (heroList.length != heroIds.length) return call.error(globalThis.lng.xstask_6);
|
||||||
|
|
||||||
let change: ResOnekeyReceive = {};
|
let change: ResOnekeyReceive = {};
|
||||||
|
let lockNum = event?.receiveNum || 0
|
||||||
for (let receive of args) {
|
for (let receive of args) {
|
||||||
|
if (lockNum >= 8) continue
|
||||||
let task = taskList.find(task => task._id == receive._id);
|
let task = taskList.find(task => task._id == receive._id);
|
||||||
let taskConf = G.gc.xstask[task.taskId];
|
let taskConf = G.gc.xstask[task.taskId];
|
||||||
|
|
||||||
@ -43,8 +46,9 @@ export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>
|
|||||||
let star = heros.map(h => G.gc.hero[h.heroId].star).reduce((a, b) => a + b);
|
let star = heros.map(h => G.gc.hero[h.heroId].star).reduce((a, b) => a + b);
|
||||||
if (star < taskConf.needStar) return call.error(globalThis.lng.xstask_8);
|
if (star < taskConf.needStar) return call.error(globalThis.lng.xstask_8);
|
||||||
|
|
||||||
change[receive._id] = { time: G.time, heros: receive.heroIds };
|
change[receive._id] = {time: G.time, heros: receive.heroIds};
|
||||||
XstaskFun.receiveNum(call.uid)
|
XstaskFun.receiveNum(call.uid)
|
||||||
|
lockNum += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.entries(change).forEach(([k, v]) => {
|
Object.entries(change).forEach(([k, v]) => {
|
||||||
@ -53,4 +57,6 @@ export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>
|
|||||||
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
|
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
|
||||||
|
|
||||||
call.succ(change);
|
call.succ(change);
|
||||||
|
|
||||||
|
addGameLog(call.uid, "_onekeyReceive", {}, change)
|
||||||
}
|
}
|
@ -6,13 +6,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"got_jinbi",
|
"key":"got_jinbi",
|
||||||
"limit":200000000,
|
"limit":2000000000,
|
||||||
"tips":"jinbi获取达到20亿"
|
"tips":"jinbi获取达到20亿"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"got_rmbmoney",
|
"key":"got_rmbmoney",
|
||||||
"limit":30000,
|
"limit":50000,
|
||||||
"tips":"钻石获取达到3万"
|
"tips":"钻石获取达到5万"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"use_attr_rmbmoney",
|
"key":"use_attr_rmbmoney",
|
||||||
@ -21,8 +21,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"tanxian/FastGuaJi",
|
"key":"tanxian/FastGuaJi",
|
||||||
"limit":40,
|
"limit":30,
|
||||||
"tips":"快速探险达到40次"
|
"tips":"快速探险达到30次"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"xstask/Receive/Num",
|
"key":"xstask/Receive/Num",
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { UpdateFilter } from 'mongodb';
|
import {UpdateFilter} from 'mongodb';
|
||||||
import { paTaType } from '../shared/protocols/pata/type';
|
import {paTaType} from '../shared/protocols/pata/type';
|
||||||
import { PublicShared } from '../shared/public/public';
|
import {PublicShared} from '../shared/public/public';
|
||||||
|
|
||||||
|
|
||||||
export class PataFun {
|
export class PataFun {
|
||||||
/**获取爬塔信息 */
|
/**获取爬塔信息 */
|
||||||
static async getInfo(uid: string, sid: number = 0) {
|
static async getInfo(uid: string, sid: number = 0) {
|
||||||
let info: paTaType = await G.mongodb.collection('pata').findOne({ uid: uid, sid: sid });
|
let info: paTaType = await G.mongodb.collection('pata').findOne({uid: uid, sid: sid});
|
||||||
let nt = G.time;
|
let nt = G.time;
|
||||||
if (!info) {
|
if (!info) {
|
||||||
info = {
|
info = {
|
||||||
@ -17,7 +17,7 @@ export class PataFun {
|
|||||||
sid: sid,
|
sid: sid,
|
||||||
saodangNum: 0
|
saodangNum: 0
|
||||||
};
|
};
|
||||||
this.changeInfo(uid, info.sid, { $set: info });
|
this.changeInfo(uid, info.sid, {$set: info});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 第二天 */
|
/** 第二天 */
|
||||||
@ -27,7 +27,7 @@ export class PataFun {
|
|||||||
useNum: 0,
|
useNum: 0,
|
||||||
saodangNum: 0
|
saodangNum: 0
|
||||||
};
|
};
|
||||||
this.changeInfo(uid, info.sid, { $set: setData });
|
this.changeInfo(uid, info.sid, {$set: setData});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info['_id']) {
|
if (info['_id']) {
|
||||||
@ -38,12 +38,11 @@ export class PataFun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**修改爬塔信息 */
|
/**修改爬塔信息 */
|
||||||
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, '$set'>) {
|
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, string>) {
|
||||||
|
await G.mongodb.collection('pata').updateOne(
|
||||||
G.mongodb.collection('pata').updateOne(
|
{uid: uid, sid: sid},
|
||||||
{ uid: uid, sid: sid },
|
|
||||||
change,
|
change,
|
||||||
{ upsert: true }
|
{upsert: true}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ export class PataFun {
|
|||||||
static async getHongDian(uid: string) {
|
static async getHongDian(uid: string) {
|
||||||
let mydata = await this.getInfo(uid);
|
let mydata = await this.getInfo(uid);
|
||||||
let con = Object.keys(G.gc.patacom);
|
let con = Object.keys(G.gc.patacom);
|
||||||
con.sort((a, b) => { return parseInt(a) - parseInt(b); });
|
con.sort((a, b) => parseInt(a) - parseInt(b));
|
||||||
for (let idx in con) {
|
for (let idx in con) {
|
||||||
idx = con[idx];
|
idx = con[idx];
|
||||||
if (mydata.lv <= parseInt(idx)) {
|
if (mydata.lv <= parseInt(idx)) {
|
||||||
|
@ -13,7 +13,7 @@ import {getConf as zmlbGetConf} from '../api_s2c/event/zhoumolibao/ApiOpen';
|
|||||||
import {Christmasfun} from "../api_s2c/event/christmas/fun";
|
import {Christmasfun} from "../api_s2c/event/christmas/fun";
|
||||||
|
|
||||||
async function checkPayIsActive(payId: string, logs: payLog[], payArgs) {
|
async function checkPayIsActive(payId: string, logs: payLog[], payArgs) {
|
||||||
let conf: any = await this.getConf(payId, payArgs);
|
let conf: any = await PayFun.getConf(payId, payArgs);
|
||||||
if (!conf) return false;
|
if (!conf) return false;
|
||||||
|
|
||||||
let lastLog = logs.last();
|
let lastLog = logs.last();
|
||||||
|
@ -34,7 +34,7 @@ export class WatchDog extends Scheduler {
|
|||||||
//获取今天0点之后在线的玩家
|
//获取今天0点之后在线的玩家
|
||||||
let users = await G.mongodb.collection("user").find({
|
let users = await G.mongodb.collection("user").find({
|
||||||
lv: {$gt: 10},
|
lv: {$gt: 10},
|
||||||
newonlinetime: {$gte: G.time - 3600, $lte: G.time + 30}
|
newonlinetime: {$gte: G.time - 1800, $lte: G.time + 30}
|
||||||
}, {
|
}, {
|
||||||
projection: {
|
projection: {
|
||||||
uid: 1,
|
uid: 1,
|
||||||
|
18
src/setWs.ts
18
src/setWs.ts
@ -13,7 +13,7 @@ import {player} from './shared/protocols/user/type';
|
|||||||
import {unQueueByConn} from './api_s2c/user/ApiLogin';
|
import {unQueueByConn} from './api_s2c/user/ApiLogin';
|
||||||
import {clusterPublish, setUidProcessId} from './clusterUtils';
|
import {clusterPublish, setUidProcessId} from './clusterUtils';
|
||||||
import {clearGud, getGud} from './public/gud';
|
import {clearGud, getGud} from './public/gud';
|
||||||
import { mylogger } from './gameLog';
|
import {mylogger} from './gameLog';
|
||||||
|
|
||||||
export async function createWs() {
|
export async function createWs() {
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ export async function createWs() {
|
|||||||
//API超时时间5分钟,为登陆排队做准备
|
//API超时时间5分钟,为登陆排队做准备
|
||||||
apiTimeout: 300000,
|
apiTimeout: 300000,
|
||||||
logLevel: G.argv.logModel as LogLevel,
|
logLevel: G.argv.logModel as LogLevel,
|
||||||
logger:mylogger
|
logger: mylogger
|
||||||
});
|
});
|
||||||
setCrossWs(G.serverCross);
|
setCrossWs(G.serverCross);
|
||||||
await G.serverCross.autoImplementApi(resolve(__dirname, 'api_cross'), true);
|
await G.serverCross.autoImplementApi(resolve(__dirname, 'api_cross'), true);
|
||||||
@ -39,7 +39,7 @@ export async function createWs() {
|
|||||||
wss: getWssFile(),
|
wss: getWssFile(),
|
||||||
//API超时时间5分钟,为登陆排队做准备,只针对游服
|
//API超时时间5分钟,为登陆排队做准备,只针对游服
|
||||||
apiTimeout: 300000,
|
apiTimeout: 300000,
|
||||||
logger:mylogger
|
logger: mylogger
|
||||||
});
|
});
|
||||||
setWs(G.server);
|
setWs(G.server);
|
||||||
await G.server.autoImplementApi(resolve(__dirname, 'api_s2c'), true);
|
await G.server.autoImplementApi(resolve(__dirname, 'api_s2c'), true);
|
||||||
@ -140,7 +140,7 @@ function setWs(server: WsServer<ServiceType>) {
|
|||||||
//处理API锁,极限情况下只锁10s,防止死锁
|
//处理API锁,极限情况下只锁10s,防止死锁
|
||||||
//在下方postApiReturnFlow里会解锁
|
//在下方postApiReturnFlow里会解锁
|
||||||
if (call.conn.apiLock[call.service.name] && call.conn.apiLock[call.service.name] > new Date().getTime()) {
|
if (call.conn.apiLock[call.service.name] && call.conn.apiLock[call.service.name] > new Date().getTime()) {
|
||||||
call.error('', {code: -100, message: '', time: 0});
|
call.error('', {code: -100, message: '', apilock: 1});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,11 +198,15 @@ function setWs(server: WsServer<ServiceType>) {
|
|||||||
//API解锁
|
//API解锁
|
||||||
let now = new Date().getTime();
|
let now = new Date().getTime();
|
||||||
|
|
||||||
if(node.return.isSucc){
|
if (node.return.isSucc) {
|
||||||
node.call.conn.apiLock[node.call.service.name] = now+200;
|
if (!writeList.includes(node.call.service.name)){
|
||||||
}else{
|
node.call.conn.apiLock[node.call.service.name] = now + 200;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!node.return.err.apilock) {
|
||||||
delete node.call.conn.apiLock[node.call.service.name];
|
delete node.call.conn.apiLock[node.call.service.name];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user