Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix

This commit is contained in:
ciniao 2023-12-25 14:33:01 +08:00
commit 1244a99c4c
6 changed files with 15 additions and 9 deletions

View File

@ -11,7 +11,7 @@ export default async function (call: ApiCall<ReqBuy, ResBuy>) {
let uid = shopId != "2" ? call.uid : call.conn.gud.ghId
let shopData = await ShopFun.getShopData(uid, shopId);
let shopData = await ShopFun.getShopData(uid, shopId, call.conn.gud.lv);
let shopItem = shopData.shopItems[index];

View File

@ -17,7 +17,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let uid = shopId != "2" ? call.uid : call.conn.gud.ghId
let shopData = await ShopFun.getShopData(uid, shopId)
let shopData = await ShopFun.getShopData(uid, shopId, call.conn.gud.lv)
call.succ(shopData);
}

View File

@ -1,7 +1,7 @@
import { ApiCall } from "tsrpc";
import { PlayerFun } from '../../public/player';
import { ShopFun } from '../../public/shop';
import { ReqRefresh, ResRefresh } from "../../shared/protocols/shop/PtlRefresh";
import {ApiCall} from "tsrpc";
import {PlayerFun} from '../../public/player';
import {ShopFun} from '../../public/shop';
import {ReqRefresh, ResRefresh} from "../../shared/protocols/shop/PtlRefresh";
export default async function (call: ApiCall<ReqRefresh, ResRefresh>) {
let shopId = call.req.shopId;
@ -9,7 +9,7 @@ export default async function (call: ApiCall<ReqRefresh, ResRefresh>) {
let uid = shopId != "2" ? call.uid : call.conn.gud.ghId
let shopData = await ShopFun.getShopData(uid, shopId);
let shopData = await ShopFun.getShopData(uid, shopId, call.conn.gud.lv);
if (!shopData) return call.error(globalThis.lng.shop_1);
@ -46,6 +46,6 @@ export default async function (call: ApiCall<ReqRefresh, ResRefresh>) {
await ShopFun.changeShopData(uid, shopId, change);
let { buyNum, shopItems, ...ops } = change;
let {buyNum, shopItems, ...ops} = change;
call.succ({buyNum: buyNum, shopItems: shopItems, ...ops});
}

View File

@ -1213,6 +1213,7 @@ type gc_shop = k_v<{
'npcImg': number
/** 商店看板娘说话 */
'npcText': string
'version': string | number
}>;
type gc_shopcom = k_v<{

View File

@ -4,4 +4,5 @@ import {ResOpen} from '../shared/protocols/shop/PtlOpen';
export type CollectionShop = ResOpen & {
uid: string; // 玩家uid
shopId: string; // 商店id
version: string | number;
};

View File

@ -94,7 +94,7 @@ export class ShopFun {
)).value
}
static async getShopData(uid: string, shopId: string) {
static async getShopData(uid: string, shopId: string, lv: number) {
let where = {
uid: uid,
shopId: shopId
@ -114,6 +114,10 @@ export class ShopFun {
await this.changeShopData(uid, shopId, {useFreeRefreshNum: 0, lastFreeRefreshTime: G.time});
}
if (shopConf.version && shopConf.version != shopData.version) {
await this.changeShopData(uid, shopId, {shopItems: this.getShopItems(shopId, lv)})
}
return shopData
}