diff --git a/src/api_s2c/xstask/ApiOnekeyReceive.ts b/src/api_s2c/xstask/ApiOnekeyReceive.ts index b8e4981..a776b77 100644 --- a/src/api_s2c/xstask/ApiOnekeyReceive.ts +++ b/src/api_s2c/xstask/ApiOnekeyReceive.ts @@ -44,6 +44,7 @@ export default async function (call: ApiCall if (star < taskConf.needStar) return call.error(globalThis.lng.xstask_8); change[receive._id] = { time: G.time, heros: receive.heroIds }; + XstaskFun.receiveNum(call.uid) } Object.entries(change).forEach(([k, v]) => { diff --git a/src/oss/watchdog.json b/src/oss/watchdog.json index 629f6b8..e60bb3e 100644 --- a/src/oss/watchdog.json +++ b/src/oss/watchdog.json @@ -18,5 +18,55 @@ "key":"use_attr_rmbmoney", "limit":100000, "tips":"钻石消耗达到10万" + }, + { + "key":"tanxian/FastGuaJi", + "limit":40, + "tips":"快速探险达到40次" + }, + { + "key":"xstask/Receive/Num", + "limit":8, + "tips":"接取悬赏任务超过8个" + }, + { + "key":"dixiaqianzhuang/Qf", + "limit":500, + "tips":"地下钱庄使用次数超过500次" + }, + { + "key":"shop/Buy/2", + "limit":50, + "tips":"势力商店购买某一商品超过50次" + }, + { + "key":"shop/Buy/1", + "limit":10, + "tips":"杂货商店购买某一商品超过10次" + }, + { + "key":"peijiancangku/Jump", + "limit":500, + "tips":"指定高级仓库超过50次" + }, + { + "key":"meirishilian/Fight", + "limit":30, + "tips":"物资缴获挑战和扫荡累计超过30次" + }, + { + "key":"pata/SaoDang", + "limit":5, + "tips":"黑暗塔扫荡次数超过5次" + }, + { + "key":"lingzhulaixi/PkBoss", + "limit":15, + "tips":"讨伐海盗挑战次数超过15次" + }, + { + "key":"gonghui/FbFight", + "limit":5, + "tips":"势力战斗boss超过5次" } ] \ No newline at end of file diff --git a/src/public/scheduler/scheduler_watchdog.ts b/src/public/scheduler/scheduler_watchdog.ts index 8243d0c..6ef9bb8 100644 --- a/src/public/scheduler/scheduler_watchdog.ts +++ b/src/public/scheduler/scheduler_watchdog.ts @@ -1,8 +1,8 @@ -import { resolve } from "path"; -import { PublicShared } from "../../shared/public/public"; +import {resolve} from "path"; +import {PublicShared} from "../../shared/public/public"; import {Scheduler, schedulerType} from "./scheduler"; -import { existsSync, readFileSync } from "fs"; -import { addWatchDogLog, errorLogDB } from "../../gameLog"; +import {existsSync, readFileSync} from "fs"; +import {addWatchDogLog, errorLogDB} from "../../gameLog"; export class WatchDog extends Scheduler { id: schedulerType = "watch_dog"; @@ -24,28 +24,28 @@ export class WatchDog extends Scheduler { return; } let conf; - try{ + try { conf = await JSON.parse(readFileSync(confFile, 'utf-8')); - }catch(e){ + } catch (e) { //配置文件不是json await this.ctorStartTime() return; } //获取今天0点之后在线的玩家 let users = await G.mongodb.collection("user").find({ - lv : {$gt:10}, - newonlinetime:{$gt: PublicShared.getToDayZeroTime() } - },{ - projection:{ - uid:1, - name:1, - lv:1, - vip:1, - sid:1 + lv: {$gt: 10}, + newonlinetime: {$gte: G.time - 3600, $lte: G.time + 30} + }, { + projection: { + uid: 1, + name: 1, + lv: 1, + vip: 1, + sid: 1 } }).toArray(); - if(!users.length){ + if (!users.length) { //没有符合的玩家 await this.ctorStartTime() return; @@ -56,25 +56,25 @@ export class WatchDog extends Scheduler { users.map(i => uinfo[i.uid] = i); let actionLogs = await G.mongodb.collection("actionLog").find({ - type:'day', + type: 'day', uid: {$in: uids}, - },{ - projection:{ - uid:1, - log:1 + }, { + projection: { + uid: 1, + log: 1 } }).toArray(); let warns = []; - for(let j=0;j= conf[j].limit ){ + if (myval > conf[j].limit) { //触发了警报 warns.push({ - type:'watchDog', + type: 'watchDog', uid: uid, name: uinfo[uid]?.name, lv: uinfo[uid]?.lv, @@ -87,10 +87,10 @@ export class WatchDog extends Scheduler { } } - if(warns.length>0){ + if (warns.length > 0) { addWatchDogLog(warns); } - + await this.ctorStartTime() } diff --git a/src/public/xstask.ts b/src/public/xstask.ts index ef277a9..cfdce3d 100644 --- a/src/public/xstask.ts +++ b/src/public/xstask.ts @@ -3,6 +3,7 @@ import {ApiCall} from 'tsrpc'; import {playerInfoType} from '../module/collection_palyerInfo'; import {CollectionXstask} from '../module/collection_xstask'; import {PublicShared} from '../shared/public/public'; +import {ActionLog} from "./actionLog/actionLog"; export class XstaskFun { @@ -166,6 +167,7 @@ export class XstaskFun { G.mongodb.cEvent('xstask').updateOne({uid: uid, type: 'xstask'}, {$set: {refreshTime: G.time, receiveNum: 0}}, {upsert: true}); } else { + ActionLog.addDayLog(uid, { key: "xstask/Receive/Num", val: 1 }); G.mongodb.cEvent('xstask').updateOne({uid: uid, type: 'xstask'}, {$inc: {receiveNum: 1}}, {upsert: true}); }