Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix
This commit is contained in:
commit
38dca3a653
@ -44,6 +44,7 @@ export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>
|
|||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.entries(change).forEach(([k, v]) => {
|
Object.entries(change).forEach(([k, v]) => {
|
||||||
|
@ -18,5 +18,55 @@
|
|||||||
"key":"use_attr_rmbmoney",
|
"key":"use_attr_rmbmoney",
|
||||||
"limit":100000,
|
"limit":100000,
|
||||||
"tips":"钻石消耗达到10万"
|
"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次"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,8 +1,8 @@
|
|||||||
import { resolve } from "path";
|
import {resolve} from "path";
|
||||||
import { PublicShared } from "../../shared/public/public";
|
import {PublicShared} from "../../shared/public/public";
|
||||||
import {Scheduler, schedulerType} from "./scheduler";
|
import {Scheduler, schedulerType} from "./scheduler";
|
||||||
import { existsSync, readFileSync } from "fs";
|
import {existsSync, readFileSync} from "fs";
|
||||||
import { addWatchDogLog, errorLogDB } from "../../gameLog";
|
import {addWatchDogLog, errorLogDB} from "../../gameLog";
|
||||||
|
|
||||||
export class WatchDog extends Scheduler {
|
export class WatchDog extends Scheduler {
|
||||||
id: schedulerType = "watch_dog";
|
id: schedulerType = "watch_dog";
|
||||||
@ -24,28 +24,28 @@ export class WatchDog extends Scheduler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let conf;
|
let conf;
|
||||||
try{
|
try {
|
||||||
conf = await JSON.parse(readFileSync(confFile, 'utf-8'));
|
conf = await JSON.parse(readFileSync(confFile, 'utf-8'));
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
//配置文件不是json
|
//配置文件不是json
|
||||||
await this.ctorStartTime()
|
await this.ctorStartTime()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//获取今天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:{$gt: PublicShared.getToDayZeroTime() }
|
newonlinetime: {$gte: G.time - 3600, $lte: G.time + 30}
|
||||||
},{
|
}, {
|
||||||
projection:{
|
projection: {
|
||||||
uid:1,
|
uid: 1,
|
||||||
name:1,
|
name: 1,
|
||||||
lv:1,
|
lv: 1,
|
||||||
vip:1,
|
vip: 1,
|
||||||
sid:1
|
sid: 1
|
||||||
}
|
}
|
||||||
}).toArray();
|
}).toArray();
|
||||||
|
|
||||||
if(!users.length){
|
if (!users.length) {
|
||||||
//没有符合的玩家
|
//没有符合的玩家
|
||||||
await this.ctorStartTime()
|
await this.ctorStartTime()
|
||||||
return;
|
return;
|
||||||
@ -56,25 +56,25 @@ export class WatchDog extends Scheduler {
|
|||||||
users.map(i => uinfo[i.uid] = i);
|
users.map(i => uinfo[i.uid] = i);
|
||||||
|
|
||||||
let actionLogs = await G.mongodb.collection("actionLog").find({
|
let actionLogs = await G.mongodb.collection("actionLog").find({
|
||||||
type:'day',
|
type: 'day',
|
||||||
uid: {$in: uids},
|
uid: {$in: uids},
|
||||||
},{
|
}, {
|
||||||
projection:{
|
projection: {
|
||||||
uid:1,
|
uid: 1,
|
||||||
log:1
|
log: 1
|
||||||
}
|
}
|
||||||
}).toArray();
|
}).toArray();
|
||||||
|
|
||||||
let warns = [];
|
let warns = [];
|
||||||
for(let j=0;j<conf.length;j++){
|
for (let j = 0; j < conf.length; j++) {
|
||||||
for(let i=0;i<actionLogs.length;i++){
|
for (let i = 0; i < actionLogs.length; i++) {
|
||||||
let key = conf[j].key;
|
let key = conf[j].key;
|
||||||
let myval = actionLogs[i]?.log?.[ key ] || 0
|
let myval = actionLogs[i]?.log?.[key] || 0
|
||||||
let uid = actionLogs[i].uid
|
let uid = actionLogs[i].uid
|
||||||
if( myval >= conf[j].limit ){
|
if (myval > conf[j].limit) {
|
||||||
//触发了警报
|
//触发了警报
|
||||||
warns.push({
|
warns.push({
|
||||||
type:'watchDog',
|
type: 'watchDog',
|
||||||
uid: uid,
|
uid: uid,
|
||||||
name: uinfo[uid]?.name,
|
name: uinfo[uid]?.name,
|
||||||
lv: uinfo[uid]?.lv,
|
lv: uinfo[uid]?.lv,
|
||||||
@ -87,10 +87,10 @@ export class WatchDog extends Scheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(warns.length>0){
|
if (warns.length > 0) {
|
||||||
addWatchDogLog(warns);
|
addWatchDogLog(warns);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.ctorStartTime()
|
await this.ctorStartTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import {ApiCall} from 'tsrpc';
|
|||||||
import {playerInfoType} from '../module/collection_palyerInfo';
|
import {playerInfoType} from '../module/collection_palyerInfo';
|
||||||
import {CollectionXstask} from '../module/collection_xstask';
|
import {CollectionXstask} from '../module/collection_xstask';
|
||||||
import {PublicShared} from '../shared/public/public';
|
import {PublicShared} from '../shared/public/public';
|
||||||
|
import {ActionLog} from "./actionLog/actionLog";
|
||||||
|
|
||||||
|
|
||||||
export class XstaskFun {
|
export class XstaskFun {
|
||||||
@ -166,6 +167,7 @@ export class XstaskFun {
|
|||||||
G.mongodb.cEvent('xstask').updateOne({uid: uid, type: 'xstask'},
|
G.mongodb.cEvent('xstask').updateOne({uid: uid, type: 'xstask'},
|
||||||
{$set: {refreshTime: G.time, receiveNum: 0}}, {upsert: true});
|
{$set: {refreshTime: G.time, receiveNum: 0}}, {upsert: true});
|
||||||
} else {
|
} else {
|
||||||
|
ActionLog.addDayLog(uid, { key: "xstask/Receive/Num", val: 1 });
|
||||||
G.mongodb.cEvent('xstask').updateOne({uid: uid, type: 'xstask'},
|
G.mongodb.cEvent('xstask').updateOne({uid: uid, type: 'xstask'},
|
||||||
{$inc: {receiveNum: 1}}, {upsert: true});
|
{$inc: {receiveNum: 1}}, {upsert: true});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user