Compare commits

...

11 Commits

Author SHA1 Message Date
dy
4c33bad9fb Merge branch 'bugfix' into dev 2023-12-19 18:12:14 +08:00
dy
5c6e403e19 Merge branch 'release' into bugfix 2023-12-19 18:01:22 +08:00
xcy
070edf1cb5 fix:
修改伙伴招募的奖励领取条件
2023-12-19 18:00:29 +08:00
xcy
db2286509c fix:
修改情报特权
2023-12-19 18:00:02 +08:00
dy
94bf56cc9e Merge branch 'feature/json' into release 2023-12-19 17:14:00 +08:00
58ff276e10 Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2023-12-19 17:00:42 +08:00
11e5f17b20 增加gc Test 2023-12-19 17:00:25 +08:00
xcy
7ae7349550 fix:跨服邮件定时器 2023-12-19 16:26:41 +08:00
dy
b84fd92528 Merge branch 'bugfix' into release 2023-12-19 16:24:37 +08:00
dy
dbda10a17e 去掉trace log 2023-12-19 16:24:14 +08:00
dy
87d5b0902f 铁笼死斗,相同积分用战力排名 2023-12-19 14:30:01 +08:00
12 changed files with 233 additions and 77 deletions

View File

@ -60,6 +60,8 @@ const localApps = [
instances: instancesNum,
// 传递给脚本的参数
args: '-serverType msg',
//允许强制gc
node_args: '--expose-gc',
// 是否启用监控模式默认是false。如果设置成true当应用程序变动时pm2会自动重载。这里也可以设置你要监控的文件。
watch: false,
// 不用监听的文件
@ -86,6 +88,8 @@ const crossApps = [
cwd: './',
// 传递给脚本的参数
args: '-serverType cross',
//允许强制gc
node_args: '--expose-gc',
// 是否启用监控模式默认是false。如果设置成true当应用程序变动时pm2会自动重载。这里也可以设置你要监控的文件。
watch: false,
// 不用监听的文件

31
package-lock.json generated
View File

@ -11,6 +11,7 @@
"axios": "^1.4.0",
"crypto-js": "^4.1.1",
"express": "^4.18.2",
"heapdump": "^0.3.15",
"ioredis": "^5.3.2",
"json5": "^2.2.3",
"mathjs": "^11.4.0",
@ -2545,6 +2546,18 @@
"he": "bin/he"
}
},
"node_modules/heapdump": {
"version": "0.3.15",
"resolved": "https://registry.npmjs.org/heapdump/-/heapdump-0.3.15.tgz",
"integrity": "sha512-n8aSFscI9r3gfhOcAECAtXFaQ1uy4QSke6bnaL+iymYZ/dWs9cqDqHM+rALfsHUwukUbxsdlECZ0pKmJdQ/4OA==",
"hasInstallScript": true,
"dependencies": {
"nan": "^2.13.2"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/http-basic": {
"version": "8.1.3",
"resolved": "https://registry.npmmirror.com/http-basic/-/http-basic-8.1.3.tgz",
@ -3199,6 +3212,11 @@
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
"dev": true
},
"node_modules/nan": {
"version": "2.18.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
"integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
},
"node_modules/nanoid": {
"version": "3.3.1",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.1.tgz",
@ -6645,6 +6663,14 @@
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true
},
"heapdump": {
"version": "0.3.15",
"resolved": "https://registry.npmjs.org/heapdump/-/heapdump-0.3.15.tgz",
"integrity": "sha512-n8aSFscI9r3gfhOcAECAtXFaQ1uy4QSke6bnaL+iymYZ/dWs9cqDqHM+rALfsHUwukUbxsdlECZ0pKmJdQ/4OA==",
"requires": {
"nan": "^2.13.2"
}
},
"http-basic": {
"version": "8.1.3",
"resolved": "https://registry.npmmirror.com/http-basic/-/http-basic-8.1.3.tgz",
@ -7163,6 +7189,11 @@
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
"dev": true
},
"nan": {
"version": "2.18.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
"integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
},
"nanoid": {
"version": "3.3.1",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.1.tgz",

View File

@ -37,6 +37,7 @@
"axios": "^1.4.0",
"crypto-js": "^4.1.1",
"express": "^4.18.2",
"heapdump": "^0.3.15",
"ioredis": "^5.3.2",
"json5": "^2.2.3",
"mathjs": "^11.4.0",

View File

@ -0,0 +1,23 @@
import { ApiCall } from "tsrpc";
import { Reqheapdump, Resheapdump } from "../../monopoly/protocols/games/Ptlheapdump";
var heapdump = require('heapdump');
export default async function (call: ApiCall<Reqheapdump, Resheapdump>) {
if(call.req.act == "heapdump"){
let name = Date.now() + '.heapsnapshot'
heapdump.writeSnapshot(name);
call.succ({
code:200,
data:name
})
}
if(call.req.act == "gc"){
global.gc();
call.succ({
code:200,
data:"gc..."
})
}
}

View File

@ -1,27 +1,38 @@
import { ApiCall } from "tsrpc";
import { PlayerFun } from '../../../public/player';
import { ReqRec, ResRec } from "../../../shared/protocols/event/huobanzhaomu/PtlRec";
import { HongDianChange } from "../../hongdian/fun";
import {ApiCall} from "tsrpc";
import {PlayerFun} from '../../../public/player';
import {ReqRec, ResRec} from "../../../shared/protocols/event/huobanzhaomu/PtlRec";
import {HongDianChange} from "../../hongdian/fun";
import {PayFun} from "../../../public/pay";
export default async function (call: ApiCall<ReqRec, ResRec>) {
let conf = G.gc.huobanzhaomu[call.req.index];
if (!conf) return call.error('', { code: -1 });
if (conf.gudKey && call.conn.gud[conf.gudKey] < conf.total) return call.error('', { code: -2 });
if (!conf) return call.error('', {code: -1});
if (conf.gudKey && call.conn.gud[conf.gudKey] < conf.total) return call.error('', {code: -2});
let db = await G.mongodb.cEvent('huobanzhaomu').findOne({ uid: call.uid, type: 'huobanzhaomu' });
if (db?.rec.includes(call.req.index)) return call.error('', { code: -3 });
if (!conf.gudKey && (db?.rec?.length || 0) < G.gc.huobanzhaomu.length - 1) return call.error('', { code: -4 });
let db = await G.mongodb.cEvent('huobanzhaomu').findOne({uid: call.uid, type: 'huobanzhaomu'});
if (db?.rec.includes(call.req.index)) return call.error('', {code: -3});
if (conf.gudKey == "chaozhiyueka") {
let logs = await PayFun.getPayLog(call.uid, "chaozhiyueka");
if (!logs || logs.slice(-1)[0].eTime < G.time) {
return call.error('', {code: -4});
}
} else {
if (!conf.gudKey && (db?.rec?.length || 0) < G.gc.huobanzhaomu.length - 1) {
return call.error('', {code: -4});
}
}
await PlayerFun.sendPrize(call, conf.prize);
if (db?.rec?.length + 1 >= G.gc.huobanzhaomu.length) {
G.mongodb.collection('syncBtns').updateOne({ uid: call.uid }, { $set: { 'huobanzhaomu.active': false } }, { upsert: true });
G.mongodb.collection('syncBtns').updateOne({uid: call.uid}, {$set: {'huobanzhaomu.active': false}}, {upsert: true});
}
G.mongodb.cEvent('huobanzhaomu').updateOne(
{ uid: call.uid, type: 'huobanzhaomu' },
{ $push: { rec: call.req.index } },
{ upsert: true }
{uid: call.uid, type: 'huobanzhaomu'},
{$push: {rec: call.req.index}},
{upsert: true}
);
HongDianChange.sendChangeKey(call.uid, ['huobanzhaomuhd'])

View File

@ -1,15 +1,17 @@
import { ApiCall } from "tsrpc";
import { PlayerFun } from '../../public/player';
import { XstaskFun } from '../../public/xstask';
import { ReqAllGet, ResAllGet } from "../../shared/protocols/xstask/PtlAllGet";
import { HongDianChange } from "../hongdian/fun";
import { PublicShared } from "../../shared/public/public";
import {ApiCall} from "tsrpc";
import {PlayerFun} from '../../public/player';
import {XstaskFun} from '../../public/xstask';
import {ReqAllGet, ResAllGet} from "../../shared/protocols/xstask/PtlAllGet";
import {HongDianChange} from "../hongdian/fun";
import {PublicShared} from "../../shared/public/public";
import {TeQuanFun} from "../../public/tequan";
export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
const taskList = JSON.parse(JSON.stringify(await XstaskFun.getAllTask(call.uid)));
let taskInfo = await XstaskFun.getInfo(call.uid);
let prizeArr:atn[] = []
for(let task of taskList) {
let tequan = await TeQuanFun.getXsTaskNum(call);
let prizeArr: atn[] = []
for (let task of taskList) {
const taskConf = G.gc.xstask[task?.taskId];
if (!task) continue;
if (task.receiveData == undefined) continue;
@ -23,12 +25,12 @@ export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
// }
continue
}
let change: Parameters<typeof XstaskFun.changeInfo>[1] = { $inc: {} };
let change: Parameters<typeof XstaskFun.changeInfo>[1] = {$inc: {}};
change.$inc[`finishNum.${taskConf.colour}`] = 1;
// 比对派遣时间如果小于当日0点则更新新任务否则该变领取状态为true
if(task.receiveData.time < PublicShared.getToDayZeroTime()) {
if (task.receiveData.time < PublicShared.getToDayZeroTime()) {
// 更新任务
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
XstaskFun.updateTask(call.uid, task._id, newTask[0].taskId)
} else {
// 更新领取状态
@ -38,6 +40,14 @@ export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
XstaskFun.changeInfo(call.uid, change);
await PlayerFun.sendPrize(call, taskConf.prize);
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
if (!tequan) {
prizeArr.push(...taskConf.prize)
} else {
for (let i = 0; i < 3; i++) {
prizeArr.push(...taskConf.prize)
}
}
prizeArr.push(...taskConf.prize)
}
call.succ({

View File

@ -1,9 +1,10 @@
import { ApiCall } from "tsrpc";
import { PlayerFun } from '../../public/player';
import { XstaskFun } from '../../public/xstask';
import { ReqGet, ResGet } from "../../shared/protocols/xstask/PtlGet";
import { HongDianChange } from "../hongdian/fun";
import { PublicShared } from '../../shared/public/public';
import {ApiCall} from "tsrpc";
import {PlayerFun} from '../../public/player';
import {XstaskFun} from '../../public/xstask';
import {ReqGet, ResGet} from "../../shared/protocols/xstask/PtlGet";
import {HongDianChange} from "../hongdian/fun";
import {PublicShared} from '../../shared/public/public';
import {TeQuanFun} from "../../public/tequan";
export default async function (call: ApiCall<ReqGet, ResGet>) {
@ -23,24 +24,32 @@ export default async function (call: ApiCall<ReqGet, ResGet>) {
}
}
let change: Parameters<typeof XstaskFun.changeInfo>[1] = { $inc: {} };
let change: Parameters<typeof XstaskFun.changeInfo>[1] = {$inc: {}};
change.$inc[`finishNum.${taskConf.colour}`] = 1;
// 比对派遣时间如果小于当日0点则更新新任务否则该变领取状态为true
if(task.receiveData.time < PublicShared.getToDayZeroTime()) {
if (task.receiveData.time < PublicShared.getToDayZeroTime()) {
// 更新任务
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
XstaskFun.updateTask(call.uid, call.req._id, newTask[0].taskId)
} else {
// 更新领取状态
XstaskFun.finishTask(call.uid, call.req._id)
}
// XstaskFun.delTask(call.uid, call.req._id);
let send_prize = [];
XstaskFun.changeInfo(call.uid, change);
await PlayerFun.sendPrize(call, taskConf.prize);
if (!await TeQuanFun.getXsTaskNum(call)) {
send_prize = taskConf.prize;
} else {
for (let i = 0; i < 3; i++) {
send_prize = send_prize.concat(taskConf.prize)
}
}
await PlayerFun.sendPrize(call, send_prize);
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
call.succ({
taskList: await XstaskFun.getAllTask(call.uid),
prize: taskConf.prize
prize: send_prize
});
}

View File

@ -36,7 +36,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
XstaskFun.delTasks(call.uid, delTask.map(task => task._id));
}
needAddTask += await TeQuanFun.getXsTaskNum(call);
// needAddTask += await TeQuanFun.getXsTaskNum(call);
needAddTask && await XstaskFun.addTasks(call.uid, XstaskFun.randomTasks(taskInfo?.lv || changeInfo.lv, needAddTask));
let { _id, uid, type, ...info } = taskInfo || changeInfo as typeof taskInfo;

View File

@ -0,0 +1,18 @@
import { StringTypeSchema } from "tsbuffer-schema";
/**
*
*/
export type Reqheapdump = {
act:string,
data:any
};
export type Resheapdump = {
/**
*
*/
code: number
data: any;
};

View File

@ -1,6 +1,7 @@
import { ServiceProto } from 'tsrpc-proto';
import { Reqsendemail, Ressendemail } from './email/Ptlsendemail';
import { Reqdeploy, Resdeploy } from './games/Ptldeploy';
import { Reqheapdump, Resheapdump } from './games/Ptlheapdump';
import { Reqmetrics, Resmetrics } from './games/Ptlmetrics';
import { Reqnotification, Resnotification } from './games/Ptlnotification';
import { Reqopen, Resopen } from './games/Ptlopen';
@ -31,6 +32,10 @@ export interface ServiceType {
req: Reqdeploy,
res: Resdeploy
},
"games/heapdump": {
req: Reqheapdump,
res: Resheapdump
},
"games/metrics": {
req: Reqmetrics,
res: Resmetrics
@ -127,96 +132,101 @@ export const serviceProto: ServiceProto<ServiceType> = {
},
{
"id": 2,
"name": "games/metrics",
"name": "games/heapdump",
"type": "api"
},
{
"id": 3,
"name": "games/notification",
"name": "games/metrics",
"type": "api"
},
{
"id": 4,
"name": "games/open",
"name": "games/notification",
"type": "api"
},
{
"id": 5,
"name": "games/ranking",
"name": "games/open",
"type": "api"
},
{
"id": 6,
"name": "gift/popup",
"name": "games/ranking",
"type": "api"
},
{
"id": 7,
"name": "gm/Pay",
"name": "gift/popup",
"type": "api"
},
{
"id": 8,
"name": "gm/SendPrize",
"name": "gm/Pay",
"type": "api"
},
{
"id": 9,
"name": "hdinfo/details",
"name": "gm/SendPrize",
"type": "api"
},
{
"id": 10,
"name": "AddHuoDong",
"name": "hdinfo/details",
"type": "api"
},
{
"id": 11,
"name": "CatAllhd",
"name": "AddHuoDong",
"type": "api"
},
{
"id": 12,
"name": "DelHuoDong",
"name": "CatAllhd",
"type": "api"
},
{
"id": 13,
"name": "Email",
"name": "DelHuoDong",
"type": "api"
},
{
"id": 14,
"name": "GetLog",
"name": "Email",
"type": "api"
},
{
"id": 15,
"name": "healthz",
"name": "GetLog",
"type": "api"
},
{
"id": 16,
"name": "union/rename",
"name": "healthz",
"type": "api"
},
{
"id": 17,
"name": "user/data",
"name": "union/rename",
"type": "api"
},
{
"id": 18,
"name": "user/disable",
"name": "user/data",
"type": "api"
},
{
"id": 19,
"name": "user/getdata",
"name": "user/disable",
"type": "api"
},
{
"id": 20,
"name": "user/getdata",
"type": "api"
},
{
"id": 21,
"name": "user/rename",
"type": "api"
}
@ -367,6 +377,44 @@ export const serviceProto: ServiceProto<ServiceType> = {
}
]
},
"games/Ptlheapdump/Reqheapdump": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "act",
"type": {
"type": "String"
}
},
{
"id": 1,
"name": "data",
"type": {
"type": "Any"
}
}
]
},
"games/Ptlheapdump/Resheapdump": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "code",
"type": {
"type": "Number"
}
},
{
"id": 1,
"name": "data",
"type": {
"type": "Any"
}
}
]
},
"games/Ptlmetrics/Reqmetrics": {
"type": "Interface"
},

View File

@ -10,7 +10,8 @@ export async function createHttp() {
json: true,
cors: '*',
port: G.config.httpPort,
logLevel: G.argv.logModel as LogLevel
logLevel: G.argv.logModel as LogLevel,
apiTimeout:300000,
});
setHttp(G.http);
await G.http.autoImplementApi(resolve(__dirname, 'api_o2s'), true);

View File

@ -640,25 +640,25 @@ export class _mongodb {
}
}
//@ts-ignore
FindCursor.prototype._toArray = FindCursor.prototype.toArray;
//@ts-ignore
FindCursor.prototype.toArray = async function(){
let rss = await this._toArray();
//如果返回的数据超过50条
if(rss.length>50){
addGameLog("system","findCount",null,{
collection: this.namespace.collection,
db:this.namespace.db,
count:rss.length
})
console.log("system,findCount",{
collection: this.namespace.collection,
db:this.namespace.db,
count:rss.length
})
console.trace();
}
return rss;
}
// //@ts-ignore
// FindCursor.prototype._toArray = FindCursor.prototype.toArray;
// //@ts-ignore
// FindCursor.prototype.toArray = async function(){
// let rss = await this._toArray();
//
// //如果返回的数据超过50条
// if(rss.length>50){
// addGameLog("system","findCount",null,{
// collection: this.namespace.collection,
// db:this.namespace.db,
// count:rss.length
// })
// console.log("system,findCount",{
// collection: this.namespace.collection,
// db:this.namespace.db,
// count:rss.length
// })
// console.trace();
// }
// return rss;
// }