Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix
This commit is contained in:
commit
52ab7e9979
@ -32,7 +32,7 @@ export default async function (call: ApiCall<Reqdetails, Resdetails>) {
|
||||
let _tmp = {
|
||||
ranking: index,
|
||||
participantId: elementUser.uid,
|
||||
value: await (await PayFun.getPayDaysAllPayNum(elementUser.uid, element.stime, element.rtime)).toString()
|
||||
value: await (await PayFun.getPayDaysAllPayNum(elementUser.uid, element.stime, element.etime)).toString()
|
||||
}
|
||||
accountingData.push(_tmp)
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
{upsert: true}
|
||||
);
|
||||
}
|
||||
db = await checkNextRound(call, db, _hdinfo.data.tasks)
|
||||
db = await checkNextRound(call, db, _hdinfo)
|
||||
|
||||
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10
|
||||
payNum = payNum - (db?.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
|
||||
|
@ -20,7 +20,7 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
|
||||
let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
|
||||
if (db.recIndex.includes(call.req.index)) return call.error('', {code: -2});
|
||||
|
||||
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10;
|
||||
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.etime)) * 10;
|
||||
payNum = payNum - (db.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
|
||||
if (payNum < conf.total) return call.error('', {code: -3});
|
||||
|
||||
@ -31,7 +31,7 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
|
||||
{$push: {recIndex: call.req.index}}
|
||||
);
|
||||
|
||||
await checkNextRound(call, db, _hdinfo.data.tasks)
|
||||
await checkNextRound(call, db, _hdinfo)
|
||||
|
||||
HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
|
||||
call.succ({
|
||||
@ -39,9 +39,13 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function checkNextRound(call: ApiCall, event, tasks) {
|
||||
export async function checkNextRound(call: ApiCall, event, _hdinfo) {
|
||||
if ((event?.recIndex?.length || 0) < _hdinfo.data.tasks.length) return event
|
||||
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.etime)) * 10
|
||||
payNum = payNum - (event?.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
|
||||
if (payNum < 0) return event
|
||||
|
||||
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
|
||||
if ((event?.recIndex?.length || 0) < tasks.length) return event
|
||||
return (await G.mongodb.cEvent(_dbType).findOneAndUpdate(
|
||||
{uid: call.uid, type: _dbType},
|
||||
{$set: {recIndex: []}, $inc: {round: 1}}, {returnDocument: 'after'}
|
||||
|
@ -656,7 +656,7 @@ export class HuoDongHongDianFun {
|
||||
let _con = hdCon.data.tasks;
|
||||
let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
|
||||
let _mydata = db || {sTime: PublicShared.getToDayZeroTime(G.time), recIndex: []};
|
||||
let payNum = await PayFun.getPayDaysAllPayNum(call.uid, hdCon.stime, hdCon.rtime);
|
||||
let payNum = await PayFun.getPayDaysAllPayNum(call.uid, hdCon.stime, hdCon.etime);
|
||||
for (let index = 0; index < _con.length; index++) {
|
||||
const element = _con[index];
|
||||
if (_mydata.recIndex.includes(index)) continue;
|
||||
|
@ -63,7 +63,6 @@ export default async function (call: ApiCall<ReqPkBoss, ResPkBoss>) {
|
||||
{ type: 'lingzhulaixi' },
|
||||
{ $set: G.mongodb.createTreeObj({ key: `maxdps.${call.req.bid}`, val: 0 }) }
|
||||
)
|
||||
|
||||
} else {
|
||||
// 超过回合,直接赋值输
|
||||
result.winSide = 1
|
||||
@ -92,12 +91,14 @@ export default async function (call: ApiCall<ReqPkBoss, ResPkBoss>) {
|
||||
}
|
||||
_mySetDat = {
|
||||
maxdps: _myData.maxdps,
|
||||
time: _myData.time,
|
||||
num: _myData.num + 1
|
||||
}
|
||||
_bossData.delhp += result.totalDamage[0]
|
||||
|
||||
}
|
||||
|
||||
// 无论挑战成功失败都扣除战斗次数
|
||||
_mySetDat["num"] = _myData.num + 1;
|
||||
_mySetDat["time"] = G.time;
|
||||
|
||||
// 设置boss数据
|
||||
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
||||
await LingZhuLaiXifun.setMyData(call, { $set: _mySetDat })
|
||||
|
@ -4,6 +4,7 @@ import { PlayerFun } from "../../public/player";
|
||||
import {ReqSaoDang, ResSaoDang} from "../../shared/protocols/lingzhulaixi/PtlSaoDang";
|
||||
import {PublicShared} from "../../shared/public/public";
|
||||
import {HongDianChange} from "../hongdian/fun";
|
||||
import {ActionLog} from "../../public/actionLog/actionLog";
|
||||
|
||||
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
||||
let _con = await LingZhuLaiXifun.getCon(call.req.bid)
|
||||
@ -85,12 +86,14 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
||||
|
||||
// 设置boss数据
|
||||
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
|
||||
await LingZhuLaiXifun.setMyData(call, { $inc: { num: _num } })
|
||||
await LingZhuLaiXifun.setMyData(call, {$inc: {num: _num}, $set: {time: G.time}})
|
||||
|
||||
// 发奖
|
||||
prize = PublicShared.mergePrize(prize)
|
||||
await PlayerFun.sendPrize(call, prize)
|
||||
|
||||
ActionLog.addDayLog(call.uid, {key: "lingzhulaixi/PkBoss", val: _num});
|
||||
|
||||
// 扣除挑战次数
|
||||
_myData.num += _num
|
||||
|
||||
|
@ -25,11 +25,11 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
||||
|
||||
changeInfo.saodangNum = call.req.num + (changeInfo?.saodangNum || 0);
|
||||
// 改变的数据
|
||||
let setData = {
|
||||
saodangNum: changeInfo.saodangNum
|
||||
};
|
||||
// let setData = {
|
||||
// saodangNum: changeInfo.saodangNum
|
||||
// };
|
||||
// 设置数据
|
||||
await PataFun.changeInfo(call.uid, changeInfo.sid, { $set: setData });
|
||||
await PataFun.changeInfo(call.uid, changeInfo.sid, {"$inc": {saodangNum: call.req.num}});
|
||||
_prize = await PlayerFun.sendPrize(call, _prize);
|
||||
|
||||
let data = {
|
||||
|
@ -21,7 +21,11 @@ export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
|
||||
let notFree = (data?.useFreeGuaJiNum || 0) >= freeNum
|
||||
if (notFree) {
|
||||
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.cutNeed(call, need);
|
||||
}
|
||||
@ -36,11 +40,11 @@ export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
|
||||
// await event_dldh_addPrize(_p, call, G.gc.tanxian_com.fastGuaJiTime);
|
||||
await PlayerFun.sendPrize(call, _p);
|
||||
|
||||
let setData = { useFastGuaJiNum: data.useFastGuaJiNum + 1, useFreeGuaJiNum: (data?.useFreeGuaJiNum || 0) + (notFree ? 0 : 1)}
|
||||
if ((data?.zztqfreeNum || 0) < tqFree && tqFree) setData["zztqfreeNum"] = tqFree
|
||||
TanXianFun.changeData(call, setData);
|
||||
|
||||
// (await call.conn.gonghui)?.addExp(20, call.uid);
|
||||
// let setData = { useFastGuaJiNum: data.useFastGuaJiNum + 1, useFreeGuaJiNum: (data?.useFreeGuaJiNum || 0) + (notFree ? 0 : 1)}
|
||||
let setData = {$inc: {useFastGuaJiNum: 1, useFreeGuaJiNum: (notFree ? 0 : 1)}}
|
||||
// if ((data?.zztqfreeNum || 0) < tqFree && tqFree) setData["zztqfreeNum"] = tqFree
|
||||
if ((data?.zztqfreeNum || 0) < tqFree && tqFree) setData["$set"] = {zztqfreeNum: tqFree}
|
||||
await TanXianFun.changeDataNew(call, setData);
|
||||
|
||||
HongDianChange.sendChangeKey(call.uid, ['taskhd', 'huodonghd']);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
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";
|
||||
@ -33,7 +34,9 @@ export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>
|
||||
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];
|
||||
|
||||
@ -45,6 +48,7 @@ export default async function (call: ApiCall<ReqOnekeyReceive, ResOnekeyReceive>
|
||||
|
||||
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<ReqOnekeyReceive, ResOnekeyReceive>
|
||||
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
|
||||
|
||||
call.succ(change);
|
||||
|
||||
addGameLog(call.uid, "_onekeyReceive", {}, change)
|
||||
}
|
@ -7,17 +7,17 @@ export default {
|
||||
/**消息服socket端口*/
|
||||
msgPort: 7778,
|
||||
/**http端口 msg服专用*/
|
||||
httpPort: 7779,
|
||||
// httpPort: 7779,
|
||||
/**跨服socket端口 */
|
||||
crossPort: 7780,
|
||||
/**跨服 ws url */
|
||||
corssWsUrl: "ws://localhost:7780",
|
||||
corssWsUrl: "ws://10.0.1.20:10003",
|
||||
/**服务器id */
|
||||
serverId: 15,
|
||||
serverId: 1001,
|
||||
/**redis url */
|
||||
redisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/0',
|
||||
/**mongodb url */
|
||||
mongodbUrl: 'mongodb://root:lyMaple525458@10.0.1.20:27017/heijiao_cl?authSource=admin',
|
||||
mongodbUrl: 'mongodb://root:lyMaple525458@10.0.1.20:27017/heijiao?authSource=admin',
|
||||
/**cross redis url */
|
||||
crossRedisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/1',
|
||||
/**cross mongodb url */
|
||||
@ -27,13 +27,11 @@ export default {
|
||||
/**服务器时间 */
|
||||
time: '',
|
||||
/**开服时间 */
|
||||
openTime: '2023-12-05 01:00:00',
|
||||
openTime: '2023-12-11 1:0:0',
|
||||
/**项目名称 */
|
||||
projectName: 'heijiao',
|
||||
/**加密key */
|
||||
APIKEY: 'uutown123456',
|
||||
/**是否已经开区 */
|
||||
opened:true,
|
||||
/**wss */
|
||||
wss: {
|
||||
key: '',
|
||||
|
@ -6,13 +6,13 @@
|
||||
},
|
||||
{
|
||||
"key":"got_jinbi",
|
||||
"limit":200000000,
|
||||
"limit":2000000000,
|
||||
"tips":"jinbi获取达到20亿"
|
||||
},
|
||||
{
|
||||
"key":"got_rmbmoney",
|
||||
"limit":30000,
|
||||
"tips":"钻石获取达到3万"
|
||||
"limit":50000,
|
||||
"tips":"钻石获取达到5万"
|
||||
},
|
||||
{
|
||||
"key":"use_attr_rmbmoney",
|
||||
@ -21,8 +21,8 @@
|
||||
},
|
||||
{
|
||||
"key":"tanxian/FastGuaJi",
|
||||
"limit":40,
|
||||
"tips":"快速探险达到40次"
|
||||
"limit":30,
|
||||
"tips":"快速探险达到30次"
|
||||
},
|
||||
{
|
||||
"key":"xstask/Receive/Num",
|
||||
@ -34,16 +34,6 @@
|
||||
"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,
|
||||
@ -68,5 +58,36 @@
|
||||
"key":"gonghui/FbFight",
|
||||
"limit":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次"
|
||||
}
|
||||
]
|
@ -230,7 +230,7 @@ export class EmailFun {
|
||||
})).insertedId.toHexString();
|
||||
sendEmail._id = _id;
|
||||
|
||||
G.server.broadcastMsg('msg_s2c/Email', sendEmail);
|
||||
G.server?.broadcastMsg('msg_s2c/Email', sendEmail);
|
||||
|
||||
return _id;
|
||||
}
|
||||
|
@ -38,9 +38,8 @@ export class PataFun {
|
||||
}
|
||||
|
||||
/**修改爬塔信息 */
|
||||
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, '$set'>) {
|
||||
|
||||
G.mongodb.collection('pata').updateOne(
|
||||
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, string>) {
|
||||
await G.mongodb.collection('pata').updateOne(
|
||||
{uid: uid, sid: sid},
|
||||
change,
|
||||
{upsert: true}
|
||||
@ -51,7 +50,7 @@ export class PataFun {
|
||||
static async getHongDian(uid: string) {
|
||||
let mydata = await this.getInfo(uid);
|
||||
let con = Object.keys(G.gc.patacom);
|
||||
con.sort((a, b) => { return parseInt(a) - parseInt(b); });
|
||||
con.sort((a, b) => parseInt(a) - parseInt(b));
|
||||
for (let idx in con) {
|
||||
idx = con[idx];
|
||||
if (mydata.lv <= parseInt(idx)) {
|
||||
|
@ -13,7 +13,7 @@ import {getConf as zmlbGetConf} from '../api_s2c/event/zhoumolibao/ApiOpen';
|
||||
import {Christmasfun} from "../api_s2c/event/christmas/fun";
|
||||
|
||||
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;
|
||||
|
||||
let lastLog = logs.last();
|
||||
|
@ -34,7 +34,7 @@ export class WatchDog extends Scheduler {
|
||||
//获取今天0点之后在线的玩家
|
||||
let users = await G.mongodb.collection("user").find({
|
||||
lv: {$gt: 10},
|
||||
newonlinetime: {$gte: G.time - 3600, $lte: G.time + 30}
|
||||
newonlinetime: {$gte: G.time - 1800, $lte: G.time + 30}
|
||||
}, {
|
||||
projection: {
|
||||
uid: 1,
|
||||
|
@ -113,7 +113,7 @@ export class SchedulerWzryDlDjinji extends SchedulerWzryAutoBaoMing {
|
||||
}
|
||||
let _userList = []
|
||||
//0号位 -1的这一条,表示晋级奖励
|
||||
let prize = G.gc.wangzherongyao.wangzhe.jiangli.dld[0].p
|
||||
let prize = G.gc.wangzherongyao.wangzhe.jiangli.dld[0]?.p || []
|
||||
|
||||
for (let index = 0; index < _zuanshiUser.length; index++) {
|
||||
const element = _zuanshiUser[index];
|
||||
@ -306,7 +306,7 @@ export class SchedulerWzryZuanshiSendPrize extends SchedulerWzryAutoBaoMing {
|
||||
_u.push(element.uid)
|
||||
if (element.data.player.uid.indexOf('npc_') != -1) continue
|
||||
if (element?.isprize?.[this.typeprzie]) continue
|
||||
let prize = _prizeCon[this.idx[element.deep]].p
|
||||
let prize = _prizeCon[this.idx[element.deep]]?.p || [];
|
||||
|
||||
//注意:这里的调用addEmail时,cross参数用的是true
|
||||
//因为这个定时器是在跨服上执行的,邮件先临时放到跨服
|
||||
|
@ -1,16 +1,31 @@
|
||||
import {ApiCall} from 'tsrpc';
|
||||
import {ResOpen} from '../shared/protocols/tanxian/PtlOpen';
|
||||
import {TeQuanFun} from './tequan';
|
||||
import {addGameLog} from "../gameLog";
|
||||
|
||||
type dataChange = Partial<ResOpen>;
|
||||
|
||||
export class TanXianFun {
|
||||
/**修改探险数据 */
|
||||
/**
|
||||
* 修改探险数据
|
||||
* 此改动是为了不影响旧的数据结构
|
||||
* 下面changeDataNew和此方法一样
|
||||
*/
|
||||
static async changeData(call: ApiCall, change: dataChange) {
|
||||
G.mongodb.collection('tanxian').updateOne({uid: call.uid}, {$set: {...change}});
|
||||
let data = await this.getData(call);
|
||||
Object.assign(data, change);
|
||||
G.ioredis.setex(`tanxian:${call.uid}`, 600, JSON.stringify(data));
|
||||
let {_id, uid, ...data} = (await G.mongodb.collection('tanxian').findOneAndUpdate({uid: call.uid}, {$set: {...change}}, {returnDocument: 'after'})).value;
|
||||
G.ioredis.setex(`tanxian:${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)
|
||||
}
|
||||
|
||||
/**获取探险数据 */
|
||||
|
18
src/setWs.ts
18
src/setWs.ts
@ -139,14 +139,14 @@ function setWs(server: WsServer<ServiceType>) {
|
||||
|
||||
//处理API锁,极限情况下只锁10s,防止死锁
|
||||
//在下方postApiReturnFlow里会解锁
|
||||
if (call.conn.apiLock[call.service.name] && new Date().getTime() - call.conn.apiLock[call.service.name] < 10000) {
|
||||
call.error('', {code: -100, message: '', time: 0});
|
||||
if (call.conn.apiLock[call.service.name] && call.conn.apiLock[call.service.name] > new Date().getTime()) {
|
||||
call.error('', {code: -100, message: '', apilock: 1});
|
||||
return null;
|
||||
}
|
||||
|
||||
//API锁定
|
||||
//API锁定到什么时候
|
||||
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耗时统计
|
||||
call.conn.requstApiTime[call.service.name] = new Date().getTime();
|
||||
@ -196,7 +196,17 @@ function setWs(server: WsServer<ServiceType>) {
|
||||
}
|
||||
|
||||
//API解锁
|
||||
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;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user