fix pata/saodang
This commit is contained in:
parent
98a3927966
commit
04533c80f4
@ -1,10 +1,10 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import {ApiCall} from "tsrpc";
|
||||||
import { PataFun } from "../../public/pata";
|
import {PataFun} from "../../public/pata";
|
||||||
import { PlayerFun } from "../../public/player";
|
import {PlayerFun} from "../../public/player";
|
||||||
import { ReqSaoDang, ResSaoDang } from "../../shared/protocols/pata/PtlSaoDang";
|
import {ReqSaoDang, ResSaoDang} from "../../shared/protocols/pata/PtlSaoDang";
|
||||||
import { PlayerShared } from '../../shared/public/player';
|
import {PlayerShared} from '../../shared/public/player';
|
||||||
import { PublicShared } from "../../shared/public/public";
|
import {PublicShared} from "../../shared/public/public";
|
||||||
import { HongDianChange } from "../hongdian/fun";
|
import {HongDianChange} from "../hongdian/fun";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
||||||
let changeInfo = await PataFun.getInfo(call.uid);
|
let changeInfo = await PataFun.getInfo(call.uid);
|
||||||
@ -25,11 +25,11 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
|
|||||||
|
|
||||||
changeInfo.saodangNum = call.req.num + (changeInfo?.saodangNum || 0);
|
changeInfo.saodangNum = call.req.num + (changeInfo?.saodangNum || 0);
|
||||||
// 改变的数据
|
// 改变的数据
|
||||||
let setData = {
|
// let setData = {
|
||||||
saodangNum: changeInfo.saodangNum
|
// 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);
|
_prize = await PlayerFun.sendPrize(call, _prize);
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"got_rmbmoney",
|
"key":"got_rmbmoney",
|
||||||
"limit":30000,
|
"limit":50000,
|
||||||
"tips":"钻石获取达到3万"
|
"tips":"钻石获取达到5万"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"use_attr_rmbmoney",
|
"key":"use_attr_rmbmoney",
|
||||||
@ -21,8 +21,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"tanxian/FastGuaJi",
|
"key":"tanxian/FastGuaJi",
|
||||||
"limit":40,
|
"limit":30,
|
||||||
"tips":"快速探险达到40次"
|
"tips":"快速探险达到30次"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key":"xstask/Receive/Num",
|
"key":"xstask/Receive/Num",
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { UpdateFilter } from 'mongodb';
|
import {UpdateFilter} from 'mongodb';
|
||||||
import { paTaType } from '../shared/protocols/pata/type';
|
import {paTaType} from '../shared/protocols/pata/type';
|
||||||
import { PublicShared } from '../shared/public/public';
|
import {PublicShared} from '../shared/public/public';
|
||||||
|
|
||||||
|
|
||||||
export class PataFun {
|
export class PataFun {
|
||||||
/**获取爬塔信息 */
|
/**获取爬塔信息 */
|
||||||
static async getInfo(uid: string, sid: number = 0) {
|
static async getInfo(uid: string, sid: number = 0) {
|
||||||
let info: paTaType = await G.mongodb.collection('pata').findOne({ uid: uid, sid: sid });
|
let info: paTaType = await G.mongodb.collection('pata').findOne({uid: uid, sid: sid});
|
||||||
let nt = G.time;
|
let nt = G.time;
|
||||||
if (!info) {
|
if (!info) {
|
||||||
info = {
|
info = {
|
||||||
@ -17,7 +17,7 @@ export class PataFun {
|
|||||||
sid: sid,
|
sid: sid,
|
||||||
saodangNum: 0
|
saodangNum: 0
|
||||||
};
|
};
|
||||||
this.changeInfo(uid, info.sid, { $set: info });
|
this.changeInfo(uid, info.sid, {$set: info});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 第二天 */
|
/** 第二天 */
|
||||||
@ -27,7 +27,7 @@ export class PataFun {
|
|||||||
useNum: 0,
|
useNum: 0,
|
||||||
saodangNum: 0
|
saodangNum: 0
|
||||||
};
|
};
|
||||||
this.changeInfo(uid, info.sid, { $set: setData });
|
this.changeInfo(uid, info.sid, {$set: setData});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info['_id']) {
|
if (info['_id']) {
|
||||||
@ -38,20 +38,19 @@ export class PataFun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**修改爬塔信息 */
|
/**修改爬塔信息 */
|
||||||
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, '$set'>) {
|
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, string>) {
|
||||||
|
await G.mongodb.collection('pata').updateOne(
|
||||||
G.mongodb.collection('pata').updateOne(
|
{uid: uid, sid: sid},
|
||||||
{ uid: uid, sid: sid },
|
|
||||||
change,
|
change,
|
||||||
{ upsert: true }
|
{upsert: true}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**获取爬塔红点 */
|
/**获取爬塔红点 */
|
||||||
static async getHongDian(uid: string) {
|
static async getHongDian(uid: string) {
|
||||||
let mydata = await this.getInfo(uid);
|
let mydata = await this.getInfo(uid);
|
||||||
let con = Object.keys(G.gc.patacom);
|
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) {
|
for (let idx in con) {
|
||||||
idx = con[idx];
|
idx = con[idx];
|
||||||
if (mydata.lv <= parseInt(idx)) {
|
if (mydata.lv <= parseInt(idx)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user