Compare commits
9 Commits
20f0f41c22
...
eb73af1dd2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
eb73af1dd2 | ||
![]() |
1dd7bc2175 | ||
![]() |
ecc17a22a9 | ||
![]() |
826840455c | ||
![]() |
60d0e04e33 | ||
![]() |
6233a6672e | ||
![]() |
afd856af30 | ||
![]() |
698c7bd3f6 | ||
![]() |
7dd83e06ef |
@ -37,7 +37,7 @@ export default async function (call: ApiCall<ReqPkBoss, ResPkBoss>) {
|
|||||||
let _bossMaxHp = _bossData.maxhp
|
let _bossMaxHp = _bossData.maxhp
|
||||||
let _bossDelHp = _bossData.delhp
|
let _bossDelHp = _bossData.delhp
|
||||||
/**格式化boss属性 */
|
/**格式化boss属性 */
|
||||||
let hpjc = Number(((_bossMaxHp - _bossDelHp) / _bossMaxHp).toFixed(2)) || 0.01 // 继承血量比
|
let hpjc = Number(((_bossMaxHp - _bossDelHp) / _bossMaxHp).toFixed(2)) || 0.01 // 继承血量比
|
||||||
let _bossFightId = _con.army // boss 战斗id
|
let _bossFightId = _con.army // boss 战斗id
|
||||||
let _npcFightData = await LingZhuLaiXifun.getBossFightInof(_bossFightId, Number(hpjc))
|
let _npcFightData = await LingZhuLaiXifun.getBossFightInof(_bossFightId, Number(hpjc))
|
||||||
// let _npcFightData = await LingZhuLaiXifun.getBossFightInof(25, Number(hpjc)) // 测试数据
|
// let _npcFightData = await LingZhuLaiXifun.getBossFightInof(25, Number(hpjc)) // 测试数据
|
||||||
@ -63,7 +63,6 @@ export default async function (call: ApiCall<ReqPkBoss, ResPkBoss>) {
|
|||||||
{ 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 {
|
||||||
// 超过回合,直接赋值输
|
// 超过回合,直接赋值输
|
||||||
result.winSide = 1
|
result.winSide = 1
|
||||||
@ -93,11 +92,13 @@ export default async function (call: ApiCall<ReqPkBoss, ResPkBoss>) {
|
|||||||
_mySetDat = {
|
_mySetDat = {
|
||||||
maxdps: _myData.maxdps,
|
maxdps: _myData.maxdps,
|
||||||
time: _myData.time,
|
time: _myData.time,
|
||||||
num: _myData.num + 1
|
|
||||||
}
|
}
|
||||||
_bossData.delhp += result.totalDamage[0]
|
_bossData.delhp += result.totalDamage[0]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 无论挑战成功失败都扣除战斗次数
|
||||||
|
_mySetDat["num"] = _myData.num + 1;
|
||||||
|
|
||||||
// 设置boss数据
|
// 设置boss数据
|
||||||
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
||||||
await LingZhuLaiXifun.setMyData(call, { $set: _mySetDat })
|
await LingZhuLaiXifun.setMyData(call, { $set: _mySetDat })
|
||||||
|
@ -4,6 +4,7 @@ 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";
|
||||||
|
|
||||||
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)
|
||||||
@ -91,6 +92,8 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
|||||||
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 });
|
||||||
|
|
||||||
// 扣除挑战次数
|
// 扣除挑战次数
|
||||||
_myData.num += _num
|
_myData.num += _num
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import {ApiCall} from "tsrpc";
|
||||||
import { PlayerFun } from '../../public/player';
|
import {PlayerFun} from '../../public/player';
|
||||||
import { TanXianFun } from '../../public/tanxian';
|
import {TanXianFun} from '../../public/tanxian';
|
||||||
import { TeQuanFun } from "../../public/tequan";
|
import {TeQuanFun} from "../../public/tequan";
|
||||||
import { ReqFastGuaJi, ResFastGuaJi } from "../../shared/protocols/tanxian/PtlFastGuaJi";
|
import {ReqFastGuaJi, ResFastGuaJi} from "../../shared/protocols/tanxian/PtlFastGuaJi";
|
||||||
import { TanXianShared } from '../../shared/public/tanxian';
|
import {TanXianShared} from '../../shared/public/tanxian';
|
||||||
import { event_dldh_addPrize } from '../event/diaoluoduihuan/ApiOpen';
|
import {event_dldh_addPrize} from '../event/diaoluoduihuan/ApiOpen';
|
||||||
import { HongDianChange } from "../hongdian/fun";
|
import {HongDianChange} from "../hongdian/fun";
|
||||||
import { getEventPrize } from './ApiEvent';
|
import {getEventPrize} from './ApiEvent';
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
|
export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
|
||||||
|
|
||||||
@ -18,10 +18,14 @@ export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
|
|||||||
let freeNum = G.gc.tanxian_com.fastGuaJiFreeNum + tqFree
|
let freeNum = G.gc.tanxian_com.fastGuaJiFreeNum + tqFree
|
||||||
|
|
||||||
// let notFree = data.useFastGuaJiNum >= freeNum && ((data?.zztqfreeNum || 0) >= tqFree && tqFree) && (data?.useFreeGuaJiNum || 0) <= freeNum
|
// let notFree = data.useFastGuaJiNum >= freeNum && ((data?.zztqfreeNum || 0) >= tqFree && tqFree) && (data?.useFreeGuaJiNum || 0) <= freeNum
|
||||||
let notFree = (data?.useFreeGuaJiNum || 0) >= freeNum
|
let notFree = (data?.useFreeGuaJiNum || 0) >= freeNum
|
||||||
if (notFree) {
|
if (notFree) {
|
||||||
let num = G.gc.tanxian_com.fastGuaJiNeed[data.useFastGuaJiNum - freeNum ] || 0;
|
let num = G.gc.tanxian_com.fastGuaJiNeed[data.useFastGuaJiNum - freeNum] || 0;
|
||||||
let need = [{ a: 'attr', t: 'rmbmoney', n: num ? num : G.gc.tanxian_com.fastGuaJiNeed[G.gc.tanxian_com.fastGuaJiNeed.length - 1] }];
|
let need = [{
|
||||||
|
a: 'attr',
|
||||||
|
t: 'rmbmoney',
|
||||||
|
n: num ? num : G.gc.tanxian_com.fastGuaJiNeed[G.gc.tanxian_com.fastGuaJiNeed.length - 1]
|
||||||
|
}];
|
||||||
await PlayerFun.checkNeedIsMeet(call, need);
|
await PlayerFun.checkNeedIsMeet(call, need);
|
||||||
await PlayerFun.cutNeed(call, need);
|
await PlayerFun.cutNeed(call, need);
|
||||||
}
|
}
|
||||||
@ -32,15 +36,15 @@ export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
|
|||||||
let eventPrize = getEventPrize(call.conn.gud.lv, G.gc.tanxian_com.fastGuaJiTime, call.conn.gud.mapId, call.conn.gud.wxcLv?.lv);
|
let eventPrize = getEventPrize(call.conn.gud.lv, G.gc.tanxian_com.fastGuaJiTime, call.conn.gud.mapId, call.conn.gud.wxcLv?.lv);
|
||||||
let _p = [].concat(prize.prize, prize.dlz, eventPrize.prize);
|
let _p = [].concat(prize.prize, prize.dlz, eventPrize.prize);
|
||||||
// 过滤物品数量为0的道具。
|
// 过滤物品数量为0的道具。
|
||||||
_p = _p.filter(x => x.n > 0)
|
_p = _p.filter(x => x.n > 0)
|
||||||
// await event_dldh_addPrize(_p, call, G.gc.tanxian_com.fastGuaJiTime);
|
// await event_dldh_addPrize(_p, call, G.gc.tanxian_com.fastGuaJiTime);
|
||||||
await PlayerFun.sendPrize(call, _p);
|
await PlayerFun.sendPrize(call, _p);
|
||||||
|
|
||||||
let setData = { useFastGuaJiNum: data.useFastGuaJiNum + 1, useFreeGuaJiNum: (data?.useFreeGuaJiNum || 0) + (notFree ? 0 : 1)}
|
// let setData = { useFastGuaJiNum: data.useFastGuaJiNum + 1, useFreeGuaJiNum: (data?.useFreeGuaJiNum || 0) + (notFree ? 0 : 1)}
|
||||||
if ((data?.zztqfreeNum || 0) < tqFree && tqFree) setData["zztqfreeNum"] = tqFree
|
let setData = {$inc: {useFastGuaJiNum: 1, useFreeGuaJiNum: (notFree ? 0 : 1)}}
|
||||||
TanXianFun.changeData(call, setData);
|
// if ((data?.zztqfreeNum || 0) < tqFree && tqFree) setData["zztqfreeNum"] = tqFree
|
||||||
|
if ((data?.zztqfreeNum || 0) < tqFree && tqFree) setData["$set"] = {zztqfreeNum: tqFree}
|
||||||
// (await call.conn.gonghui)?.addExp(20, call.uid);
|
await TanXianFun.changeDataNew(call, setData);
|
||||||
|
|
||||||
HongDianChange.sendChangeKey(call.uid, ['taskhd', 'huodonghd']);
|
HongDianChange.sendChangeKey(call.uid, ['taskhd', 'huodonghd']);
|
||||||
|
|
||||||
|
@ -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,7 +6,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"got_jinbi",
|
"key":"got_jinbi",
|
||||||
"limit":200000000,
|
"limit":2000000000,
|
||||||
"tips":"jinbi获取达到20亿"
|
"tips":"jinbi获取达到20亿"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -34,16 +34,6 @@
|
|||||||
"limit":500,
|
"limit":500,
|
||||||
"tips":"地下钱庄使用次数超过500次"
|
"tips":"地下钱庄使用次数超过500次"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"key":"shop/Buy/2",
|
|
||||||
"limit":50,
|
|
||||||
"tips":"势力商店购买某一商品超过50次"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key":"shop/Buy/1",
|
|
||||||
"limit":10,
|
|
||||||
"tips":"杂货商店购买某一商品超过10次"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"key":"peijiancangku/Jump",
|
"key":"peijiancangku/Jump",
|
||||||
"limit":500,
|
"limit":500,
|
||||||
@ -68,5 +58,36 @@
|
|||||||
"key":"gonghui/FbFight",
|
"key":"gonghui/FbFight",
|
||||||
"limit":5,
|
"limit":5,
|
||||||
"tips":"势力战斗boss超过5次"
|
"tips":"势力战斗boss超过5次"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"key":"shop/Buy/2",
|
||||||
|
"limit":50,
|
||||||
|
"tips":"势力商店购买超过50次"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key":"shop/Buy/1",
|
||||||
|
"limit":20,
|
||||||
|
"tips":"杂货商店购买超过20次"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key":"shop/Buy/10",
|
||||||
|
"limit":20,
|
||||||
|
"tips":"荣誉商店购买超过20次"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key":"shop/Buy/4",
|
||||||
|
"limit":10,
|
||||||
|
"tips":"饰品商店购买超过10次"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key":"shop/Buy/11",
|
||||||
|
"limit":5,
|
||||||
|
"tips":"功绩商店购买超过5次"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key":"shop/Buy/3",
|
||||||
|
"limit":5,
|
||||||
|
"tips":"战争商店购买超过5次"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -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,
|
||||||
|
@ -1,16 +1,31 @@
|
|||||||
import {ApiCall} from 'tsrpc';
|
import {ApiCall} from 'tsrpc';
|
||||||
import {ResOpen} from '../shared/protocols/tanxian/PtlOpen';
|
import {ResOpen} from '../shared/protocols/tanxian/PtlOpen';
|
||||||
import {TeQuanFun} from './tequan';
|
import {TeQuanFun} from './tequan';
|
||||||
|
import {addGameLog} from "../gameLog";
|
||||||
|
|
||||||
type dataChange = Partial<ResOpen>;
|
type dataChange = Partial<ResOpen>;
|
||||||
|
|
||||||
export class TanXianFun {
|
export class TanXianFun {
|
||||||
/**修改探险数据 */
|
/**
|
||||||
|
* 修改探险数据
|
||||||
|
* 此改动是为了不影响旧的数据结构
|
||||||
|
* 下面changeDataNew和此方法一样
|
||||||
|
*/
|
||||||
static async changeData(call: ApiCall, change: dataChange) {
|
static async changeData(call: ApiCall, change: dataChange) {
|
||||||
G.mongodb.collection('tanxian').updateOne({uid: call.uid}, {$set: {...change}});
|
let {_id, uid, ...data} = (await G.mongodb.collection('tanxian').findOneAndUpdate({uid: call.uid}, {$set: {...change}}, {returnDocument: 'after'})).value;
|
||||||
let data = await this.getData(call);
|
G.ioredis.setex(`tanxian:${uid}`, 600, JSON.stringify(data));
|
||||||
Object.assign(data, change);
|
}
|
||||||
G.ioredis.setex(`tanxian:${call.uid}`, 600, JSON.stringify(data));
|
|
||||||
|
/**
|
||||||
|
* 此方法是为了不影响旧的数据结构
|
||||||
|
* 用inc去叠加用户限制的次数
|
||||||
|
* @param call
|
||||||
|
* @param change
|
||||||
|
*/
|
||||||
|
static async changeDataNew(call: ApiCall, change) {
|
||||||
|
let {_id, uid, ...data} = (await G.mongodb.collection('tanxian').findOneAndUpdate({uid: call.uid}, change, {returnDocument: 'after'})).value;
|
||||||
|
G.ioredis.setex(`tanxian:${uid}`, 600, JSON.stringify(data));
|
||||||
|
addGameLog(call.uid, "_fastguajiChange", {}, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**获取探险数据 */
|
/**获取探险数据 */
|
||||||
|
28
src/setWs.ts
28
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,8 +27,8 @@ 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);
|
||||||
await G.serverCross.start();
|
await G.serverCross.start();
|
||||||
@ -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);
|
||||||
@ -139,14 +139,14 @@ function setWs(server: WsServer<ServiceType>) {
|
|||||||
|
|
||||||
//处理API锁,极限情况下只锁10s,防止死锁
|
//处理API锁,极限情况下只锁10s,防止死锁
|
||||||
//在下方postApiReturnFlow里会解锁
|
//在下方postApiReturnFlow里会解锁
|
||||||
if (call.conn.apiLock[call.service.name] && new Date().getTime() - call.conn.apiLock[call.service.name] < 10000) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//API锁定
|
//API锁定到什么时候
|
||||||
if (!writeList.includes(call.service.name)) {
|
if (!writeList.includes(call.service.name)) {
|
||||||
call.conn.apiLock[call.service.name] = new Date().getTime();
|
call.conn.apiLock[call.service.name] = new Date().getTime() + 10000;
|
||||||
}
|
}
|
||||||
//API耗时统计
|
//API耗时统计
|
||||||
call.conn.requstApiTime[call.service.name] = new Date().getTime();
|
call.conn.requstApiTime[call.service.name] = new Date().getTime();
|
||||||
@ -196,7 +196,17 @@ function setWs(server: WsServer<ServiceType>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//API解锁
|
//API解锁
|
||||||
delete node.call.conn.apiLock[node.call.service.name];
|
let now = new Date().getTime();
|
||||||
|
|
||||||
|
if (node.return.isSucc) {
|
||||||
|
if (!writeList.includes(node.call.service.name)){
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user