Merge branch 'bugfix' into dev
This commit is contained in:
commit
715efd504c
@ -17,7 +17,7 @@ export default async function (call: ApiCall<ReqGetUser, ResGetUser>) {
|
||||
arr.map(i=>{
|
||||
res[i.uid] = {
|
||||
data: i.data,
|
||||
jifen:i.jifen,
|
||||
jifen:i?.jifen||0,
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -5,7 +5,7 @@ import {ReqYanShi, ResYanShi} from "../../shared/protocols/kuangdong/PtlYanShi";
|
||||
|
||||
export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
|
||||
|
||||
return call.errorCode(1)
|
||||
//return call.errorCode(1)
|
||||
|
||||
let hdid = call.req.hdid
|
||||
let con = await KuangDongfun.getCon(hdid)
|
||||
|
@ -41,13 +41,16 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
},
|
||||
{ upsert: true }
|
||||
);
|
||||
} else if (data.fightNum < G.gc.slzd.maxFightNum && G.time - data.replyCd > G.gc.slzd.replyCd) {
|
||||
let addNum = Math.floor((G.time - data.replyCd) / G.gc.slzd.replyCd);
|
||||
let maxAddNum = G.gc.slzd.maxFightNum - data.fightNum;
|
||||
data.fightNum += addNum > maxAddNum ? maxAddNum : addNum;
|
||||
data.replyCd = G.time;
|
||||
G.mongodb.collection('slzdUser').updateOne({ uid: call.uid }, { $set: { 'data.fightNum': data.fightNum, 'data.replyCd': data.replyCd } });
|
||||
}
|
||||
|
||||
//不需要回复次数
|
||||
// else if (data.fightNum < G.gc.slzd.maxFightNum && G.time - data.replyCd > G.gc.slzd.replyCd) {
|
||||
// let addNum = Math.floor((G.time - data.replyCd) / G.gc.slzd.replyCd);
|
||||
// let maxAddNum = G.gc.slzd.maxFightNum - data.fightNum;
|
||||
// data.fightNum += addNum > maxAddNum ? maxAddNum : addNum;
|
||||
// data.replyCd = G.time;
|
||||
// G.mongodb.collection('slzdUser').updateOne({ uid: call.uid }, { $set: { 'data.fightNum': data.fightNum, 'data.replyCd': data.replyCd } });
|
||||
// }
|
||||
|
||||
let { refreshTime, ...ops } = data;
|
||||
call.succ({
|
||||
|
@ -1,23 +1,24 @@
|
||||
import { ReqEmail } from "../monopoly/protocols/PtlEmail";
|
||||
import { patchInit } from "../patch";
|
||||
import { MsgEmail } from "../shared/protocols/msg_s2c/MsgEmail";
|
||||
import { PublicShared } from "../shared/public/public";
|
||||
import {ReqEmail} from "../monopoly/protocols/PtlEmail";
|
||||
import {patchInit} from "../patch";
|
||||
import {MsgEmail} from "../shared/protocols/msg_s2c/MsgEmail";
|
||||
import {PublicShared} from "../shared/public/public";
|
||||
|
||||
|
||||
class Path {
|
||||
|
||||
async fun1(a: any) {
|
||||
let taskType = 2;
|
||||
// let users = await G.mongodb.collection('user').find({}).toArray();
|
||||
let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray();
|
||||
let users = await G.mongodb.collection('user').find({}, {
|
||||
projection: {uid: 1}
|
||||
}).toArray();
|
||||
// let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray();
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
let user = users[i];
|
||||
|
||||
console.log(`处理玩家${user.uid}数据`);
|
||||
let task = Object.assign({}, ...(await G.mongodb.collection('task').find({
|
||||
uid: user.uid, type: taskType
|
||||
}, { projection: { taskid: 1, finish: 1 } }).toArray()).map(i => {
|
||||
return { [i.taskid]: i.finish }
|
||||
}, {projection: {taskid: 1, finish: 1}}).toArray()).map(i => {
|
||||
return {[i.taskid]: i.finish}
|
||||
}))
|
||||
|
||||
let deltask = [];
|
||||
@ -34,7 +35,7 @@ class Path {
|
||||
|
||||
if (deltask.length > 0) {
|
||||
await G.mongodb.collection("task").deleteMany(
|
||||
{ uid: user.uid, taskid: { $in: deltask } }
|
||||
{uid: user.uid, taskid: {$in: deltask}}
|
||||
)
|
||||
console.log(`删除玩家${user.uid}任务:${deltask}`)
|
||||
}
|
||||
@ -56,4 +57,5 @@ async function main() {
|
||||
process.exit();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
main();
|
||||
|
68
src/fix_patch/patch_20240112-1.ts
Normal file
68
src/fix_patch/patch_20240112-1.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import { ReqEmail } from "../monopoly/protocols/PtlEmail";
|
||||
import { patchInit } from "../patch";
|
||||
import { MsgEmail } from "../shared/protocols/msg_s2c/MsgEmail";
|
||||
import { PublicShared } from "../shared/public/public";
|
||||
|
||||
|
||||
class Path {
|
||||
async fun1(a: any) {
|
||||
let uids = [
|
||||
"4_6571ab682b3f80154e724f2a",
|
||||
"16_6575e1625685671e63fe001f",
|
||||
"13_6574ad08e7cc32b4bd1334e8",
|
||||
"13_65749bc319cab1affec349fb",
|
||||
];
|
||||
|
||||
// 删除玩家背包中的头像框
|
||||
let items = await G.mongodb.collection("item").find({ uid: { $nin: uids }, itemId: { $in: ["47", "48"] } }).toArray();
|
||||
for (let item of items) {
|
||||
console.log(`删除玩家${item.uid}的头像框道具${item.itemId}`);
|
||||
await G.mongodb.collection("item").updateOne({ _id: item._id }, { $set: { uid: `patch_del_${item.uid}` } });
|
||||
}
|
||||
|
||||
// 删除玩家存在的头像框
|
||||
let users = await G.mongodb.collection("user").find({
|
||||
uid: { $nin: uids }, $or: [
|
||||
{ ["headFrame.id"]: "8" },
|
||||
{ ["headFrame.id"]: "14" },
|
||||
{ ["headFrames.8"]: { $exists: true } },
|
||||
{ ["headFrames.14"]: { $exists: true } },
|
||||
]
|
||||
}).toArray();
|
||||
for (let user of users) {
|
||||
let change = { $set: {}, $unset: {} };
|
||||
if (user.headFrame?.id == "8" || user.headFrame?.id == "14") {
|
||||
change.$set = { headFrame: { id: "1", time: -1 } };
|
||||
}
|
||||
|
||||
if (user.headFrames["8"] != undefined) {
|
||||
change.$unset["headFrames.8"] = 1;
|
||||
}
|
||||
|
||||
if (user.headFrames["14"] != undefined) {
|
||||
change.$unset["headFrames.14"] = 1;
|
||||
}
|
||||
if (Object.keys(change.$set).length > 0 || Object.keys(change.$unset).length > 0) {
|
||||
console.log(`处理玩家${user.uid}数据:${JSON.stringify(change)}`);
|
||||
await G.mongodb.collection("user").updateOne({ _id: user._id }, change);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async run() {
|
||||
await this.fun1(1);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await patchInit()
|
||||
let patch = new Path();
|
||||
await patch.run();
|
||||
console.log("逻辑执行完成,等待退出");
|
||||
setTimeout(function () {
|
||||
console.log('结束程序');
|
||||
process.exit();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
main();
|
@ -11,14 +11,29 @@
|
||||
},
|
||||
{
|
||||
"key":"got_rmbmoney",
|
||||
"limit":50000,
|
||||
"tips":"钻石获取达到5万"
|
||||
"limit":100000,
|
||||
"tips":"钻石获取达到10万"
|
||||
},
|
||||
{
|
||||
"key":"use_attr_rmbmoney",
|
||||
"limit":100000,
|
||||
"tips":"钻石消耗达到10万"
|
||||
},
|
||||
{
|
||||
"key":"got_huangqijinbi",
|
||||
"limit":5000,
|
||||
"tips":"单日获取黄旗金币达到5000"
|
||||
},
|
||||
{
|
||||
"key":"got_huangqiduihuan",
|
||||
"limit":10000,
|
||||
"tips":"单日获取黄旗兑换达到10000"
|
||||
},
|
||||
{
|
||||
"key": "huangqijiuguan/ZhaoMu",
|
||||
"limit": 1000,
|
||||
"tips": "单日获取黄旗招募超过1000抽"
|
||||
},
|
||||
{
|
||||
"key":"tanxian/FastGuaJi",
|
||||
"limit":30,
|
||||
|
@ -19,7 +19,8 @@ export class DxltFun {
|
||||
}
|
||||
/**回退层数 */
|
||||
static backLayer(data: ResOpen) {
|
||||
let num = data.curLayer - G.gc.dxlt_com.dayResetBackLayer;
|
||||
//let num = data.curLayer - G.gc.dxlt_com.dayResetBackLayer;
|
||||
let num = (data.curLayer-30) - (data.curLayer-30)%5+1
|
||||
data.curLayer = num < 1 ? 1 : num;
|
||||
data.over = G.gc.dxlt_layer[data.curLayer].type == 2;
|
||||
}
|
||||
|
@ -179,14 +179,14 @@ export class KuangDongfun {
|
||||
}
|
||||
if (!kdInfo) return []
|
||||
let _con = await this.getCon(hdid)
|
||||
let _kcTime = G.time + kdInfo.yanshi - kdInfo.ctime
|
||||
let _kcTime = G.time - kdInfo.ctime
|
||||
//let _gud = await G.mongodb.collection('user').findOne({uid: kdInfo.uid})
|
||||
let _gud = await getGud(kdInfo.uid)
|
||||
let gamer_lv = _gud.lv
|
||||
// @ts-ignore
|
||||
let prize: prizeType[] = _con.reward
|
||||
// let prize: prizeType[] = [{ a: 'attr', t: 'rmbmoney', n: 50 }] // todo 待接入配置
|
||||
if (_kcTime > 8 * 3600) _kcTime = 8 * 3600 + kdInfo.yanshi // 设置最大时长
|
||||
if (_kcTime > 8 * 3600 + kdInfo.yanshi) _kcTime = 8 * 3600 + kdInfo.yanshi // 设置最大时长
|
||||
prize[0]["n"] = Math.floor(eval(_con.formula) * _kcTime)
|
||||
|
||||
if (_con.public_map == 1){
|
||||
|
@ -66,7 +66,8 @@ export class PayFun {
|
||||
);
|
||||
})
|
||||
|
||||
G.mongodb.collection('payLogNew').insertMany(args.map(i => ({key: i.payId, uid: uid, values: i.val})));
|
||||
let colls = args.map(i => ({key: i.payId, uid: uid, values: i.val}))
|
||||
if(colls.length>0)G.mongodb.collection('payLogNew').insertMany(colls);
|
||||
|
||||
G.server.sendMsgByUid(uid, 'msg_s2c/PayChange', Object.fromEntries(args.map(a => [a.payId, a.val])));
|
||||
}
|
||||
|
@ -1,23 +1,23 @@
|
||||
import {ObjectId, OptionalId} from 'mongodb';
|
||||
import {ApiCall, BaseConnection, TsrpcError} from 'tsrpc';
|
||||
import {checkPlayerGift} from '../api_s2c/event/xianshilibao/fun';
|
||||
import {md_redPoint_check} from '../api_s2c/gongyu/mingdao/ApiOpen';
|
||||
import {CollectionPeiJian} from '../module/collection_peijian';
|
||||
import {Wjjl} from '../module/collection_wjjl';
|
||||
import {MongodbCollections} from '../module/mongodb';
|
||||
import {G123} from '../sdk/G123';
|
||||
import {ResGetList} from '../shared/protocols/item/PtlGetList';
|
||||
import {ResLogin} from '../shared/protocols/user/PtlLogin';
|
||||
import {player} from '../shared/protocols/user/type';
|
||||
import {HeroShared, otherBuff} from '../shared/public/hero';
|
||||
import {PublicShared} from '../shared/public/public';
|
||||
import {HeroFun} from './hero';
|
||||
import {ShiwuFun} from './shiwu';
|
||||
import {UserFun} from './user';
|
||||
import {getItemByItemId, getItemNum} from './item';
|
||||
import {getGud, setGud} from './gud';
|
||||
import {addGameLog} from "../gameLog";
|
||||
import {PushGiftFun} from "./pushgift";
|
||||
import { ObjectId, OptionalId } from 'mongodb';
|
||||
import { ApiCall, BaseConnection, TsrpcError } from 'tsrpc';
|
||||
import { checkPlayerGift } from '../api_s2c/event/xianshilibao/fun';
|
||||
import { md_redPoint_check } from '../api_s2c/gongyu/mingdao/ApiOpen';
|
||||
import { CollectionPeiJian } from '../module/collection_peijian';
|
||||
import { Wjjl } from '../module/collection_wjjl';
|
||||
import { MongodbCollections } from '../module/mongodb';
|
||||
import { G123 } from '../sdk/G123';
|
||||
import { ResGetList } from '../shared/protocols/item/PtlGetList';
|
||||
import { ResLogin } from '../shared/protocols/user/PtlLogin';
|
||||
import { player } from '../shared/protocols/user/type';
|
||||
import { HeroShared, otherBuff } from '../shared/public/hero';
|
||||
import { PublicShared } from '../shared/public/public';
|
||||
import { HeroFun } from './hero';
|
||||
import { ShiwuFun } from './shiwu';
|
||||
import { UserFun } from './user';
|
||||
import { getItemByItemId, getItemNum } from './item';
|
||||
import { getGud, setGud } from './gud';
|
||||
import { addGameLog } from "../gameLog";
|
||||
import { PushGiftFun } from "./pushgift";
|
||||
import { ActionLog } from './actionLog/actionLog';
|
||||
import { roleDataType } from '../shared/fightControl/fightType';
|
||||
import { PlayerShared } from '../shared/public/player';
|
||||
@ -49,14 +49,14 @@ export class PlayerFun {
|
||||
* @param uid
|
||||
* @returns
|
||||
*/
|
||||
static async getDefaultFightDataByUid(uid:string){
|
||||
static async getDefaultFightDataByUid(uid: string) {
|
||||
let gud = await getGud(uid);
|
||||
let posObj = gud.heroPos;
|
||||
let roles: k_v<roleDataType> = {};
|
||||
if (gud.selectMatrix && gud.matrixPos) {
|
||||
posObj = gud.matrixPos[gud.selectMatrix];
|
||||
}
|
||||
let heros = await HeroFun.getHeros({uid:uid}, Object.values(posObj).filter(_id => _id != '') as string[]);
|
||||
let heros = await HeroFun.getHeros({ uid: uid }, Object.values(posObj).filter(_id => _id != '') as string[]);
|
||||
let otherBuff = UserFun.getOtherBuff(gud)
|
||||
|
||||
Object.entries(posObj).forEach(obj => {
|
||||
@ -108,13 +108,13 @@ export class PlayerFun {
|
||||
if (err) {
|
||||
// 消耗不足 触发推送礼包
|
||||
PushGiftFun.chkItemGift(call.uid, atn)
|
||||
throw new TsrpcError('', {code: -104, atn: atn});
|
||||
throw new TsrpcError('', { code: -104, atn: atn });
|
||||
} else {
|
||||
return {isOk: false, atn: atn};
|
||||
return { isOk: false, atn: atn };
|
||||
}
|
||||
}
|
||||
}
|
||||
return {isOk: true, atn: null};
|
||||
return { isOk: true, atn: null };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +132,7 @@ export class PlayerFun {
|
||||
atn: need
|
||||
};
|
||||
if (args.length < 1) {
|
||||
throw new TsrpcError('', {code: -104, atn: meet.atn});
|
||||
throw new TsrpcError('', { code: -104, atn: meet.atn });
|
||||
}
|
||||
return await this.checkNeedByArgs(call, ...args);
|
||||
}
|
||||
@ -155,10 +155,10 @@ export class PlayerFun {
|
||||
all.push(this.addItem(call, item));
|
||||
}
|
||||
// 记录消耗
|
||||
addGameLog(call.uid, call.service.name, call.req, {need: val})
|
||||
addGameLog(call.uid, call.service.name, call.req, { need: val })
|
||||
await Promise.all(all);
|
||||
G.emit('USE_ITEM', call.conn.gud, needArr.map(need => {
|
||||
return {...need, n: Math.abs(need.n)};
|
||||
return { ...need, n: Math.abs(need.n) };
|
||||
}));
|
||||
}
|
||||
|
||||
@ -228,9 +228,14 @@ export class PlayerFun {
|
||||
}
|
||||
}
|
||||
|
||||
if( (atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0 ){
|
||||
if ((atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0) {
|
||||
//统计今日获取的金币和钻石
|
||||
ActionLog.addDayLog(call.conn.uid, { key: 'got_'+atn.t, val: atn.n });
|
||||
ActionLog.addDayLog(call.conn.uid, { key: 'got_' + atn.t, val: atn.n });
|
||||
}
|
||||
|
||||
if (["huangqijinbi", "huangqiduihuan"].includes(atn.t) && atn.n > 0) {
|
||||
//统计今日获取的黄旗金币和黄旗对换币
|
||||
ActionLog.addDayLog(call.conn.uid, { key: 'got_' + atn.t, val: atn.n });
|
||||
}
|
||||
|
||||
// 增加vip经验的任务监听
|
||||
@ -238,7 +243,7 @@ export class PlayerFun {
|
||||
G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0);
|
||||
}
|
||||
all.push(this.changeAttr(call.conn.uid, change));
|
||||
all.push(this.upAttr(call, {...atn, n: change[atn.t]}));
|
||||
all.push(this.upAttr(call, { ...atn, n: change[atn.t] }));
|
||||
//await this.changeAttr(call.conn.uid, change);
|
||||
//await this.upAttr(call, {...atn, n: change[atn.t]});
|
||||
}
|
||||
@ -281,17 +286,17 @@ export class PlayerFun {
|
||||
G.mongodb.collection('rmbuse').insertOne(data);
|
||||
// 消费竞赛开启时写入跨服数据库
|
||||
if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') {
|
||||
G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid, type: `xfjs_${G.huodong.xfjsId}`}, {
|
||||
$set: {time: G.time},
|
||||
$inc: {change: data.change}
|
||||
}, {upsert: true});
|
||||
G.crossmongodb.collection('rmbuse').updateOne({ uid: data.uid, type: `xfjs_${G.huodong.xfjsId}` }, {
|
||||
$set: { time: G.time },
|
||||
$inc: { change: data.change }
|
||||
}, { upsert: true });
|
||||
}
|
||||
}
|
||||
|
||||
static async changeAttr(uid: string, change: Partial<player>) {
|
||||
setGud(uid, change);
|
||||
|
||||
G.mongodb.collection('user').updateOne({uid: uid}, {$set: change});
|
||||
G.mongodb.collection('user').updateOne({ uid: uid }, { $set: change });
|
||||
|
||||
if (G.server.uid_connections[uid]) {
|
||||
checkPlayerGift(G.server.uid_connections[uid].gud, change);
|
||||
@ -313,9 +318,9 @@ export class PlayerFun {
|
||||
const curLv = call.conn.gud.lv;
|
||||
while (conf[curLv + addLv + 1] && atn.n >= conf[curLv + addLv + 1].need) {
|
||||
addLv++;
|
||||
G123.sendUserLevelUp({...call.conn.gud, lv: curLv + addLv, nexp: atn.n});
|
||||
G123.sendUserLevelUp({ ...call.conn.gud, lv: curLv + addLv, nexp: atn.n });
|
||||
}
|
||||
addLv && await this.addAttr(call, {lv: curLv + addLv});
|
||||
addLv && await this.addAttr(call, { lv: curLv + addLv });
|
||||
break;
|
||||
case 'payExp':
|
||||
let addVip = 0;
|
||||
@ -324,7 +329,7 @@ export class PlayerFun {
|
||||
while (vipConf[curVip + addVip + 1] && atn.n >= vipConf[curVip + addVip + 1].exp) {
|
||||
addVip++;
|
||||
}
|
||||
addVip && await this.addAttr(call, {vip: curVip + addVip});
|
||||
addVip && await this.addAttr(call, { vip: curVip + addVip });
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -335,7 +340,7 @@ export class PlayerFun {
|
||||
static async addItem(call: call, val: atn[]) {
|
||||
for (let atn of val) {
|
||||
let upObj = {
|
||||
filter: {uid: call.uid, itemId: atn.t},
|
||||
filter: { uid: call.uid, itemId: atn.t },
|
||||
update: {
|
||||
$setOnInsert: {
|
||||
firstTime: G.time,
|
||||
@ -367,7 +372,7 @@ export class PlayerFun {
|
||||
};
|
||||
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options);
|
||||
call.addEventMsg('msg_s2c/ItemChange', atn.t, data);
|
||||
addGameLog(call.uid, "_itemChange", {"additem": 1}, {
|
||||
addGameLog(call.uid, "_itemChange", { "additem": 1 }, {
|
||||
"filter": upObj.filter,
|
||||
"update": upObj.update,
|
||||
"options": upObj.options
|
||||
@ -375,10 +380,10 @@ export class PlayerFun {
|
||||
} else {
|
||||
if (item.num + atn.n <= 0) {
|
||||
await Promise.all([
|
||||
G.mongodb.collection('item').deleteOne({uid: call.uid, itemId: atn.t})
|
||||
G.mongodb.collection('item').deleteOne({ uid: call.uid, itemId: atn.t })
|
||||
]);
|
||||
call.addEventMsg('msg_s2c/ItemChange', atn.t, {num: 0});
|
||||
addGameLog(call.uid, "_itemChange", {"delitem": 1}, {"itemId": atn.t})
|
||||
call.addEventMsg('msg_s2c/ItemChange', atn.t, { num: 0 });
|
||||
addGameLog(call.uid, "_itemChange", { "delitem": 1 }, { "itemId": atn.t })
|
||||
} else {
|
||||
await Promise.all([
|
||||
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options)
|
||||
@ -387,7 +392,7 @@ export class PlayerFun {
|
||||
num: item.num + atn.n,
|
||||
lastTime: upObj.update.$set.lastTime
|
||||
});
|
||||
addGameLog(call.uid, "_itemChange", {"attritem": 1}, {
|
||||
addGameLog(call.uid, "_itemChange", { "attritem": 1 }, {
|
||||
"filter": upObj.filter,
|
||||
"update": upObj.update,
|
||||
"options": upObj.options,
|
||||
@ -422,7 +427,7 @@ export class PlayerFun {
|
||||
|
||||
insertData.forEach((v, key) => {
|
||||
let id = result.insertedIds[key].toHexString();
|
||||
let {_id, ...ops} = v;
|
||||
let { _id, ...ops } = v;
|
||||
|
||||
Wjjl.setVal(call.uid, `has_equip_color_${G.gc.equip[ops.equipId].colour}`, 1, false);
|
||||
|
||||
@ -456,10 +461,10 @@ export class PlayerFun {
|
||||
*/
|
||||
static async cutEquip(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
G.mongodb.collection('equip').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/EquipChange', _id, {num: 0});
|
||||
G.mongodb.collection('equip').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/EquipChange', _id, { num: 0 });
|
||||
|
||||
addGameLog(call.uid, "_cutEquip", {}, {_id: _id})
|
||||
addGameLog(call.uid, "_cutEquip", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,7 +498,7 @@ export class PlayerFun {
|
||||
let v = insertData[key]
|
||||
|
||||
let id = result.insertedIds[key].toHexString();
|
||||
let {_id, ...ops} = v;
|
||||
let { _id, ...ops } = v;
|
||||
|
||||
call.addEventMsg('msg_s2c/HeroChange', id, {
|
||||
_id: id,
|
||||
@ -526,9 +531,9 @@ export class PlayerFun {
|
||||
static async cutHero(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
await HeroFun.delHero(call, _id);
|
||||
G.mongodb.collection('hero').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/HeroChange', _id, {num: 0});
|
||||
addGameLog(call.uid, "_cutHero", {}, {_id: _id})
|
||||
G.mongodb.collection('hero').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/HeroChange', _id, { num: 0 });
|
||||
addGameLog(call.uid, "_cutHero", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,7 +548,7 @@ export class PlayerFun {
|
||||
colour: v.colour,
|
||||
wearId: '',
|
||||
shiwuId: v.t,
|
||||
jichu: ShiwuFun.randomJichu({colour: v.colour, shiwuId: v.t}),
|
||||
jichu: ShiwuFun.randomJichu({ colour: v.colour, shiwuId: v.t }),
|
||||
fujia: []
|
||||
};
|
||||
if (v.shiwuBuff) {
|
||||
@ -563,7 +568,7 @@ export class PlayerFun {
|
||||
|
||||
insertData.forEach((v, key) => {
|
||||
let id = result.insertedIds[key].toHexString();
|
||||
let {_id, ...ops} = v;
|
||||
let { _id, ...ops } = v;
|
||||
call.addEventMsg('msg_s2c/ShiwuChange', id, {
|
||||
_id: id,
|
||||
...ops
|
||||
@ -582,9 +587,9 @@ export class PlayerFun {
|
||||
*/
|
||||
static async cutShiwu(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
G.mongodb.collection('shiwu').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/ShiwuChange', _id, {num: 0});
|
||||
addGameLog(call.uid, "_cutShiwu", {}, {_id: _id})
|
||||
G.mongodb.collection('shiwu').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/ShiwuChange', _id, { num: 0 });
|
||||
addGameLog(call.uid, "_cutShiwu", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,7 +614,7 @@ export class PlayerFun {
|
||||
addGameLog(call.uid, "_addPeiJian", {}, insertData)
|
||||
|
||||
insertData.forEach((v, key) => {
|
||||
let {_id, uid, ...ops} = v;
|
||||
let { _id, uid, ...ops } = v;
|
||||
let id = _id.toHexString();
|
||||
|
||||
if (G.gc.peijian[v.peijianId].colour != 5) {
|
||||
@ -617,8 +622,8 @@ export class PlayerFun {
|
||||
lshd[v.peijianId]++;
|
||||
}
|
||||
|
||||
G.redis.set('peijian', call.uid, id, {_id: id, ...ops});
|
||||
call.addEventMsg('msg_s2c/PeijianChange', id, {_id: id, ...ops});
|
||||
G.redis.set('peijian', call.uid, id, { _id: id, ...ops });
|
||||
call.addEventMsg('msg_s2c/PeijianChange', id, { _id: id, ...ops });
|
||||
});
|
||||
|
||||
G.mongodb.collection('playerInfo', 'lshd_peijian').updateOne(
|
||||
@ -670,9 +675,9 @@ export class PlayerFun {
|
||||
static async cutPeijian(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
G.redis.del('peijian', call.uid, _id);
|
||||
G.mongodb.collection('peijian').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/PeijianChange', _id, {num: 0});
|
||||
addGameLog(call.uid, "_cutPeijian", {}, {_id: _id})
|
||||
G.mongodb.collection('peijian').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/PeijianChange', _id, { num: 0 });
|
||||
addGameLog(call.uid, "_cutPeijian", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -681,7 +686,7 @@ export class PlayerFun {
|
||||
*/
|
||||
static async getAttr(uid: string, where: { ctype: string; }) {
|
||||
let _w = where;
|
||||
Object.assign(_w, {uid: uid});
|
||||
Object.assign(_w, { uid: uid });
|
||||
const _res = await G.mongodb.collection('playattr').find(_w).toArray();
|
||||
_res.forEach(v => {
|
||||
if (v._id) {
|
||||
@ -696,7 +701,7 @@ export class PlayerFun {
|
||||
*/
|
||||
static async getAttrOne(uid: string, where: { ctype: string; }) {
|
||||
let _w = where;
|
||||
Object.assign(_w, {uid: uid});
|
||||
Object.assign(_w, { uid: uid });
|
||||
const _res = await G.mongodb.collection('playattr').findOne(_w);
|
||||
if (_res) {
|
||||
delete _res['_id'];
|
||||
@ -712,10 +717,10 @@ export class PlayerFun {
|
||||
time = G.time;
|
||||
}
|
||||
let _zeroTime = PublicShared.getToDayZeroTime(time);
|
||||
let _tmp = {lasttime: {$gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1}};
|
||||
let _tmp = { lasttime: { $gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1 } };
|
||||
|
||||
let _w = where;
|
||||
Object.assign(_w, {uid: uid, ..._tmp});
|
||||
Object.assign(_w, { uid: uid, ..._tmp });
|
||||
const _res = await G.mongodb.collection('playattr').find(_w).toArray();
|
||||
_res.forEach(v => {
|
||||
if (v._id) {
|
||||
@ -730,7 +735,7 @@ export class PlayerFun {
|
||||
*/
|
||||
static async setAttr(uid: string, where: { ctype: string; }, data: {}, islasttime = 1) {
|
||||
let _w = where;
|
||||
Object.assign(_w, {uid: uid});
|
||||
Object.assign(_w, { uid: uid });
|
||||
|
||||
if (islasttime == 1) {
|
||||
data["lasttime"] = G.time;
|
||||
@ -741,7 +746,7 @@ export class PlayerFun {
|
||||
// 加入创建数据时间
|
||||
data["ctime"] = G.time;
|
||||
}
|
||||
let _res = await G.mongodb.collection('playattr').updateMany(_w, {$set: data}, {upsert: true});
|
||||
let _res = await G.mongodb.collection('playattr').updateMany(_w, { $set: data }, { upsert: true });
|
||||
return _res;
|
||||
}
|
||||
}
|
@ -299,7 +299,7 @@ export class SchedulerWzryZuanshiSendPrize extends SchedulerWzryAutoBaoMing {
|
||||
await this.record()
|
||||
return
|
||||
}
|
||||
let _prizeCon = this.typeprzie=='zhuanshi'?G.gc.wangzherongyao.wangzhe.jiangli.zuanshi:G.gc.wangzherongyao.wangzhe.jiangli.wangzhe;
|
||||
let _prizeCon = this.typeprzie=='zuanshi'?G.gc.wangzherongyao.wangzhe.jiangli.zuanshi:G.gc.wangzherongyao.wangzhe.jiangli.wangzhe;
|
||||
let _u = []
|
||||
for (let index = 0; index < _user.length; index++) {
|
||||
const element = _user[index];
|
||||
|
@ -78,16 +78,17 @@ export class XstaskFun {
|
||||
uid: uid,
|
||||
};
|
||||
});
|
||||
let result = await G.mongodb.collection('xstask').insertMany(taskList);
|
||||
|
||||
this.uidTask[uid] = this.uidTask[uid] || [];
|
||||
taskList.forEach((task, index) => {
|
||||
this.uidTask[uid].push(G.mongodb.conversionIdObj({
|
||||
_id: result.insertedIds[index],
|
||||
...task
|
||||
}));
|
||||
});
|
||||
|
||||
if(taskList.length > 0){
|
||||
let result = await G.mongodb.collection('xstask').insertMany(taskList);
|
||||
taskList.forEach((task, index) => {
|
||||
this.uidTask[uid].push(G.mongodb.conversionIdObj({
|
||||
_id: result.insertedIds[index],
|
||||
...task
|
||||
}));
|
||||
});
|
||||
}
|
||||
return this.uidTask[uid];
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ async function clearRedis() {
|
||||
G.redis.fromatKey('equip'),
|
||||
G.redis.fromatKey('shiwu'),
|
||||
G.redis.fromatKey('tanxian'),
|
||||
G.redis.fromatKey('gbtx'),
|
||||
G.redis.fromatKey('dxlt'),
|
||||
//G.redis.fromatKey('gbtx'),
|
||||
//G.redis.fromatKey('dxlt'),
|
||||
])
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user