diff --git a/src/api_s2c/xstask/ApiOnekeyReceive.ts b/src/api_s2c/xstask/ApiOnekeyReceive.ts index a776b77..42d889a 100644 --- a/src/api_s2c/xstask/ApiOnekeyReceive.ts +++ b/src/api_s2c/xstask/ApiOnekeyReceive.ts @@ -1,9 +1,10 @@ -import { ApiCall } from "tsrpc"; -import { HeroFun } from '../../public/hero'; -import { XstaskFun } from '../../public/xstask'; -import { ReqOnekeyReceive, ResOnekeyReceive } from "../../shared/protocols/xstask/PtlOnekeyReceive"; -import { HeroShared } from '../../shared/public/hero'; -import { HongDianChange } from "../hongdian/fun"; +import {ApiCall} from "tsrpc"; +import { addGameLog } from "../../gameLog"; +import {HeroFun} from '../../public/hero'; +import {XstaskFun} from '../../public/xstask'; +import {ReqOnekeyReceive, ResOnekeyReceive} from "../../shared/protocols/xstask/PtlOnekeyReceive"; +import {HeroShared} from '../../shared/public/hero'; +import {HongDianChange} from "../hongdian/fun"; export default async function (call: ApiCall) { @@ -33,7 +34,9 @@ export default async function (call: ApiCall if (heroList.length != heroIds.length) return call.error(globalThis.lng.xstask_6); let change: ResOnekeyReceive = {}; + let lockNum = event?.receiveNum || 0 for (let receive of args) { + if (lockNum >= 8) continue let task = taskList.find(task => task._id == receive._id); let taskConf = G.gc.xstask[task.taskId]; @@ -43,8 +46,9 @@ export default async function (call: ApiCall 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); - change[receive._id] = { time: G.time, heros: receive.heroIds }; + change[receive._id] = {time: G.time, heros: receive.heroIds}; XstaskFun.receiveNum(call.uid) + lockNum += 1 } Object.entries(change).forEach(([k, v]) => { @@ -53,4 +57,6 @@ export default async function (call: ApiCall HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']); call.succ(change); + + addGameLog(call.uid, "_onekeyReceive", {}, change) } \ No newline at end of file diff --git a/src/oss/watchdog.json b/src/oss/watchdog.json index 8acd728..ac92b66 100644 --- a/src/oss/watchdog.json +++ b/src/oss/watchdog.json @@ -6,7 +6,7 @@ }, { "key":"got_jinbi", - "limit":200000000, + "limit":2000000000, "tips":"jinbi获取达到20亿" }, { diff --git a/src/setWs.ts b/src/setWs.ts index 9a19905..a1186a8 100644 --- a/src/setWs.ts +++ b/src/setWs.ts @@ -13,7 +13,7 @@ import {player} from './shared/protocols/user/type'; import {unQueueByConn} from './api_s2c/user/ApiLogin'; import {clusterPublish, setUidProcessId} from './clusterUtils'; import {clearGud, getGud} from './public/gud'; -import { mylogger } from './gameLog'; +import {mylogger} from './gameLog'; export async function createWs() { @@ -27,7 +27,7 @@ export async function createWs() { //API超时时间5分钟,为登陆排队做准备 apiTimeout: 300000, logLevel: G.argv.logModel as LogLevel, - logger:mylogger + logger: mylogger }); setCrossWs(G.serverCross); await G.serverCross.autoImplementApi(resolve(__dirname, 'api_cross'), true); @@ -39,7 +39,7 @@ export async function createWs() { wss: getWssFile(), //API超时时间5分钟,为登陆排队做准备,只针对游服 apiTimeout: 300000, - logger:mylogger + logger: mylogger }); setWs(G.server); await G.server.autoImplementApi(resolve(__dirname, 'api_s2c'), true); @@ -140,7 +140,7 @@ function setWs(server: WsServer) { //处理API锁,极限情况下只锁10s,防止死锁 //在下方postApiReturnFlow里会解锁 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; } @@ -198,10 +198,14 @@ function setWs(server: WsServer) { //API解锁 let now = new Date().getTime(); - if(node.return.isSucc){ - node.call.conn.apiLock[node.call.service.name] = now+200; - }else{ - delete node.call.conn.apiLock[node.call.service.name]; + 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;