商店:bug修复
This commit is contained in:
@@ -52,12 +52,12 @@ export class ShopHandler {
|
|||||||
let sid = session.get('sid');
|
let sid = session.get('sid');
|
||||||
let serverId = session.get('serverId');
|
let serverId = session.get('serverId');
|
||||||
|
|
||||||
let { activityId, shopItemId, count } = msg;
|
let { activityId = 0, shopItemId, count } = msg;
|
||||||
if( count < 0) return resResult(STATUS.WRONG_PARMS);
|
if( count < 0) return resResult(STATUS.WRONG_PARMS);
|
||||||
|
|
||||||
let dicShopItem = await getShopDicById(activityId, shopItemId, roleId, serverId);
|
let dicShopItem = await getShopDicById(activityId, shopItemId, roleId, serverId);
|
||||||
if(!dicShopItem) return STATUS.DIC_DATA_NOT_FOUND;
|
if(!dicShopItem) return STATUS.DIC_DATA_NOT_FOUND;
|
||||||
if(dicShopItem['productID']) return resResult(STATUS.CAN_NOT_PURCHASE);
|
if(dicShopItem['productID'] && dicShopItem['productID'] != '&') return resResult(STATUS.CAN_NOT_PURCHASE);
|
||||||
|
|
||||||
let userShop = await UserShopModel.findByRoleAndItem(roleId, activityId, dicShopItem);
|
let userShop = await UserShopModel.findByRoleAndItem(roleId, activityId, dicShopItem);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ async function getShopListByData(shop: number, type: number, userShopRecs: UserS
|
|||||||
|
|
||||||
|
|
||||||
export async function getShopDicById(activityId: number, itemId: number, roleId: string, serverId: number) {
|
export async function getShopDicById(activityId: number, itemId: number, roleId: string, serverId: number) {
|
||||||
if(activityId == 0) {
|
if(!activityId || activityId == 0) {
|
||||||
return gameData.shopItem.get(itemId);
|
return gameData.shopItem.get(itemId);
|
||||||
} else {
|
} else {
|
||||||
let activityData = await getShopActivityById(roleId, serverId, activityId);
|
let activityData = await getShopActivityById(roleId, serverId, activityId);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { SHOP_REFRESH_TYPE } from "../../consts";
|
|||||||
import { ActivityModelType } from "../../db/Activity";
|
import { ActivityModelType } from "../../db/Activity";
|
||||||
import { UserShopType } from "../../db/UserShop";
|
import { UserShopType } from "../../db/UserShop";
|
||||||
import { UserShopTypeType } from "../../db/UserShopType";
|
import { UserShopTypeType } from "../../db/UserShopType";
|
||||||
|
import { gameData } from "../../pubUtils/data";
|
||||||
import { nowSeconds } from "../../pubUtils/timeUtil";
|
import { nowSeconds } from "../../pubUtils/timeUtil";
|
||||||
import { ActivityBase } from "../activityField/activityField";
|
import { ActivityBase } from "../activityField/activityField";
|
||||||
|
|
||||||
@@ -140,10 +141,14 @@ export class ShopReturnData {
|
|||||||
|
|
||||||
public addUserRecords(record: UserShopType) {
|
public addUserRecords(record: UserShopType) {
|
||||||
if(!record || record.shop != this.shop || record.type != this.type) return;
|
if(!record || record.shop != this.shop || record.type != this.type) return;
|
||||||
let dic = this.dic.find(cur => cur.id == record.itemId);
|
if(this.activityId > 0) {
|
||||||
if(!dic || (dic.createTime && dic.createTime != record.createTime)) return;
|
let dic = this.dic.find(cur => cur.id == record.itemId);
|
||||||
|
if(!dic || (dic.createTime && dic.createTime != record.createTime)) return;
|
||||||
|
} else {
|
||||||
|
if(!gameData.shopItem.has(record.itemId)) return;
|
||||||
|
}
|
||||||
let recordResult = new ShopReturnRecordData(record);
|
let recordResult = new ShopReturnRecordData(record);
|
||||||
if(recordResult && recordResult.shopItemId) this.records.push(recordResult)
|
if(recordResult && recordResult.shopItemId && recordResult.buyCount) this.records.push(recordResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
public setReadRecord(record: UserShopTypeType) {
|
public setReadRecord(record: UserShopTypeType) {
|
||||||
|
|||||||
Reference in New Issue
Block a user