Compare commits

..

No commits in common. "6233a6672e7b8b8119ea595f06e36773f9f3185e" and "698c7bd3f698d1066f965a1dfa95769ca19a009c" have entirely different histories.

3 changed files with 23 additions and 43 deletions

View File

@ -4,7 +4,6 @@ import { PlayerFun } from "../../public/player";
import { ReqSaoDang, ResSaoDang } from "../../shared/protocols/lingzhulaixi/PtlSaoDang"; import { ReqSaoDang, ResSaoDang } from "../../shared/protocols/lingzhulaixi/PtlSaoDang";
import { PublicShared } from "../../shared/public/public"; import { PublicShared } from "../../shared/public/public";
import { HongDianChange } from "../hongdian/fun"; import { HongDianChange } from "../hongdian/fun";
import {ActionLog} from "../../public/actionLog/actionLog";
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) { export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
let _con = await LingZhuLaiXifun.getCon(call.req.bid) let _con = await LingZhuLaiXifun.getCon(call.req.bid)
@ -92,8 +91,6 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
prize = PublicShared.mergePrize(prize) prize = PublicShared.mergePrize(prize)
await PlayerFun.sendPrize(call, prize) await PlayerFun.sendPrize(call, prize)
ActionLog.addDayLog(call.uid, { key: "lingzhulaixi/PkBoss", val: _num });
// 扣除挑战次数 // 扣除挑战次数
_myData.num += _num _myData.num += _num

View File

@ -1,12 +1,12 @@
import {ApiCall} from "tsrpc"; import { ApiCall } from "tsrpc";
import {PlayerFun} from '../../public/player'; import { PlayerFun } from '../../public/player';
import {TanXianFun} from '../../public/tanxian'; import { TanXianFun } from '../../public/tanxian';
import {TeQuanFun} from "../../public/tequan"; import { TeQuanFun } from "../../public/tequan";
import {ReqFastGuaJi, ResFastGuaJi} from "../../shared/protocols/tanxian/PtlFastGuaJi"; import { ReqFastGuaJi, ResFastGuaJi } from "../../shared/protocols/tanxian/PtlFastGuaJi";
import {TanXianShared} from '../../shared/public/tanxian'; import { TanXianShared } from '../../shared/public/tanxian';
import {event_dldh_addPrize} from '../event/diaoluoduihuan/ApiOpen'; import { event_dldh_addPrize } from '../event/diaoluoduihuan/ApiOpen';
import {HongDianChange} from "../hongdian/fun"; import { HongDianChange } from "../hongdian/fun";
import {getEventPrize} from './ApiEvent'; import { getEventPrize } from './ApiEvent';
export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) { export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
@ -18,14 +18,10 @@ export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
let freeNum = G.gc.tanxian_com.fastGuaJiFreeNum + tqFree let freeNum = G.gc.tanxian_com.fastGuaJiFreeNum + tqFree
// let notFree = data.useFastGuaJiNum >= freeNum && ((data?.zztqfreeNum || 0) >= tqFree && tqFree) && (data?.useFreeGuaJiNum || 0) <= freeNum // let notFree = data.useFastGuaJiNum >= freeNum && ((data?.zztqfreeNum || 0) >= tqFree && tqFree) && (data?.useFreeGuaJiNum || 0) <= freeNum
let notFree = (data?.useFreeGuaJiNum || 0) >= freeNum let notFree = (data?.useFreeGuaJiNum || 0) >= freeNum
if (notFree) { if (notFree) {
let num = G.gc.tanxian_com.fastGuaJiNeed[data.useFastGuaJiNum - freeNum] || 0; let num = G.gc.tanxian_com.fastGuaJiNeed[data.useFastGuaJiNum - freeNum ] || 0;
let need = [{ let need = [{ a: 'attr', t: 'rmbmoney', n: num ? num : G.gc.tanxian_com.fastGuaJiNeed[G.gc.tanxian_com.fastGuaJiNeed.length - 1] }];
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.checkNeedIsMeet(call, need);
await PlayerFun.cutNeed(call, need); await PlayerFun.cutNeed(call, need);
} }
@ -36,15 +32,15 @@ export default async function (call: ApiCall<ReqFastGuaJi, ResFastGuaJi>) {
let eventPrize = getEventPrize(call.conn.gud.lv, G.gc.tanxian_com.fastGuaJiTime, call.conn.gud.mapId, call.conn.gud.wxcLv?.lv); let eventPrize = getEventPrize(call.conn.gud.lv, G.gc.tanxian_com.fastGuaJiTime, call.conn.gud.mapId, call.conn.gud.wxcLv?.lv);
let _p = [].concat(prize.prize, prize.dlz, eventPrize.prize); let _p = [].concat(prize.prize, prize.dlz, eventPrize.prize);
// 过滤物品数量为0的道具。 // 过滤物品数量为0的道具。
_p = _p.filter(x => x.n > 0) _p = _p.filter(x => x.n > 0)
// await event_dldh_addPrize(_p, call, G.gc.tanxian_com.fastGuaJiTime); // await event_dldh_addPrize(_p, call, G.gc.tanxian_com.fastGuaJiTime);
await PlayerFun.sendPrize(call, _p); await PlayerFun.sendPrize(call, _p);
// let setData = { useFastGuaJiNum: data.useFastGuaJiNum + 1, useFreeGuaJiNum: (data?.useFreeGuaJiNum || 0) + (notFree ? 0 : 1)} 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["zztqfreeNum"] = tqFree TanXianFun.changeData(call, setData);
if ((data?.zztqfreeNum || 0) < tqFree && tqFree) setData["$set"] = {zztqfreeNum: tqFree}
await TanXianFun.changeDataNew(call, setData); // (await call.conn.gonghui)?.addExp(20, call.uid);
HongDianChange.sendChangeKey(call.uid, ['taskhd', 'huodonghd']); HongDianChange.sendChangeKey(call.uid, ['taskhd', 'huodonghd']);

View File

@ -5,25 +5,12 @@ import {TeQuanFun} from './tequan';
type dataChange = Partial<ResOpen>; type dataChange = Partial<ResOpen>;
export class TanXianFun { export class TanXianFun {
/** /**修改探险数据 */
*
*
* changeDataNew和此方法一样
*/
static async changeData(call: ApiCall, change: dataChange) { static async changeData(call: ApiCall, change: dataChange) {
let {_id, uid, ...data} = (await G.mongodb.collection('tanxian').findOneAndUpdate({uid: call.uid}, {$set: {...change}}, {returnDocument: 'after'})).value; G.mongodb.collection('tanxian').updateOne({uid: call.uid}, {$set: {...change}});
G.ioredis.setex(`tanxian:${uid}`, 600, JSON.stringify(data)); let data = await this.getData(call);
} Object.assign(data, change);
G.ioredis.setex(`tanxian:${call.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));
} }
/**获取探险数据 */ /**获取探险数据 */