Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix
This commit is contained in:
commit
fb28f2d4e7
@ -12,7 +12,7 @@ export default async function (call: ApiCall<ReqFight, ResFight>) {
|
|||||||
let change: Partial<ResOpen> = {};
|
let change: Partial<ResOpen> = {};
|
||||||
let data = await DxltFun.getData(call);
|
let data = await DxltFun.getData(call);
|
||||||
|
|
||||||
if (data.killBoss >= G.gc.dxlt_com.dayFightLayer) return call.error(globalThis.lng.dixialeitai_2);
|
if (data.killBoss >= G.gc.dxlt_com.dayFightLayer) return call.error(globalThis.lng.dixialeitai_13);
|
||||||
if (G.gc.dxlt_layer[data.curLayer].type != 1) return call.error(globalThis.lng.dixialeitai_3);
|
if (G.gc.dxlt_layer[data.curLayer].type != 1) return call.error(globalThis.lng.dixialeitai_3);
|
||||||
if (data.over) return call.error(globalThis.lng.dixialeitai_4);
|
if (data.over) return call.error(globalThis.lng.dixialeitai_4);
|
||||||
if (!data.heros[call.req]) return call.error(globalThis.lng.dixialeitai_5);
|
if (!data.heros[call.req]) return call.error(globalThis.lng.dixialeitai_5);
|
||||||
|
@ -131,6 +131,7 @@ class Lng {
|
|||||||
dixialeitai_10 = "dixialeitai_10";
|
dixialeitai_10 = "dixialeitai_10";
|
||||||
dixialeitai_11 = "dixialeitai_11";
|
dixialeitai_11 = "dixialeitai_11";
|
||||||
dixialeitai_12 = "dixialeitai_12";
|
dixialeitai_12 = "dixialeitai_12";
|
||||||
|
dixialeitai_13 = "dixialeitai_13";
|
||||||
|
|
||||||
email_1 = "email_1";
|
email_1 = "email_1";
|
||||||
email_2 = "email_2";
|
email_2 = "email_2";
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import {CollectionShop} from '../module/collection_shop';
|
import { CollectionShop } from '../module/collection_shop';
|
||||||
import {ResOpen, shopItem} from '../shared/protocols/shop/PtlOpen';
|
import { ResOpen, shopItem } from '../shared/protocols/shop/PtlOpen';
|
||||||
import {PublicShared} from '../shared/public/public';
|
import { PublicShared } from '../shared/public/public';
|
||||||
import {ShiwuFun} from './shiwu';
|
import { ShiwuFun } from './shiwu';
|
||||||
|
|
||||||
type shopData = ResOpen;
|
type shopData = ResOpen;
|
||||||
type changeData = {
|
type changeData = {
|
||||||
[k in keyof shopData]: shopData[k]
|
[k in keyof (shopData & { version?: number | string })]: (shopData & { version?: number | string })[k]
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ShopFun {
|
export class ShopFun {
|
||||||
@ -48,13 +48,13 @@ export class ShopFun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async changeShopData(uid: string, shopId: string, change: Partial<changeData>) {
|
static async changeShopData(uid: string, shopId: string, change: Partial<changeData>) {
|
||||||
let where = {uid: uid, shopId: shopId}
|
let where = { uid: uid, shopId: shopId }
|
||||||
G.mongodb.collection("shop").updateOne(where, {$set: change})
|
G.mongodb.collection("shop").updateOne(where, { $set: change })
|
||||||
}
|
}
|
||||||
|
|
||||||
static async initShopData(uid: string, shopId: string) {
|
static async initShopData(uid: string, shopId: string) {
|
||||||
let gud = await G.mongodb.collection("user").findOne({uid: uid}, {
|
let gud = await G.mongodb.collection("user").findOne({ uid: uid }, {
|
||||||
projection: {lv: 1, _id: 0}
|
projection: { lv: 1, _id: 0 }
|
||||||
})
|
})
|
||||||
let lv = gud?.lv || 1;
|
let lv = gud?.lv || 1;
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ export class ShopFun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (await G.mongodb.collection("shop").findOneAndUpdate(
|
return (await G.mongodb.collection("shop").findOneAndUpdate(
|
||||||
{uid: uid, shopId: shopId},
|
{ uid: uid, shopId: shopId },
|
||||||
{
|
{
|
||||||
$set: {
|
$set: {
|
||||||
buyNum: {},
|
buyNum: {},
|
||||||
@ -80,7 +80,7 @@ export class ShopFun {
|
|||||||
lastFreeRefreshTime: G.time
|
lastFreeRefreshTime: G.time
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{upsert: true, returnDocument: 'after'}
|
{ upsert: true, returnDocument: 'after' }
|
||||||
)).value
|
)).value
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,11 +101,12 @@ export class ShopFun {
|
|||||||
if (shopConf.freeRefreshInterval > 0 && G.time - shopData.lastFreeRefreshTime >= shopConf.freeRefreshInterval) {
|
if (shopConf.freeRefreshInterval > 0 && G.time - shopData.lastFreeRefreshTime >= shopConf.freeRefreshInterval) {
|
||||||
shopData.useFreeRefreshNum = 0;
|
shopData.useFreeRefreshNum = 0;
|
||||||
shopData.lastFreeRefreshTime = G.time;
|
shopData.lastFreeRefreshTime = G.time;
|
||||||
await this.changeShopData(uid, shopId, {useFreeRefreshNum: 0, lastFreeRefreshTime: G.time});
|
await this.changeShopData(uid, shopId, { useFreeRefreshNum: 0, lastFreeRefreshTime: G.time });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shopConf.version && shopConf.version != shopData.version) {
|
if (shopConf.version && shopConf.version != shopData.version) {
|
||||||
await this.changeShopData(uid, shopId, {shopItems: this.getShopItems(shopId, lv)})
|
shopData.shopItems = this.getShopItems(shopId, lv);
|
||||||
|
await this.changeShopData(uid, shopId, { shopItems: shopData.shopItems, version: shopConf.version });
|
||||||
}
|
}
|
||||||
|
|
||||||
return shopData
|
return shopData
|
||||||
|
Loading…
Reference in New Issue
Block a user