修正抽卡获得物品没有保存进库的bug
This commit is contained in:
parent
c99ccb328b
commit
cd1a821a33
@ -169,6 +169,7 @@ export default class CardController extends BaseController {
|
|||||||
const cfgMap = global.$cfg.get(BaseConst.ITEMCARD)
|
const cfgMap = global.$cfg.get(BaseConst.ITEMCARD)
|
||||||
let results: any = []
|
let results: any = []
|
||||||
const cardMap = account.cardMap
|
const cardMap = account.cardMap
|
||||||
|
let itemToSave: ItemInfo[] = []
|
||||||
for (let item of items) {
|
for (let item of items) {
|
||||||
if (item.type != ItemType.CARD) {
|
if (item.type != ItemType.CARD) {
|
||||||
results.push({
|
results.push({
|
||||||
@ -176,6 +177,7 @@ export default class CardController extends BaseController {
|
|||||||
used: 0,
|
used: 0,
|
||||||
count: item.count
|
count: item.count
|
||||||
});
|
});
|
||||||
|
itemToSave.push(item)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (item.type == ItemType.CARD &&!cfgMap.has(item.id)) {
|
if (item.type == ItemType.CARD &&!cfgMap.has(item.id)) {
|
||||||
@ -197,6 +199,9 @@ export default class CardController extends BaseController {
|
|||||||
heroid: data.unlocking
|
heroid: data.unlocking
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
let saveItem = new ItemInfo(item.id, 1, item.weight)
|
||||||
|
saveItem.type = item.type
|
||||||
|
itemToSave.push(saveItem)
|
||||||
results.push({
|
results.push({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
count: 1,
|
count: 1,
|
||||||
@ -215,6 +220,9 @@ export default class CardController extends BaseController {
|
|||||||
cardid: data.unlocking
|
cardid: data.unlocking
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
let saveItem = new ItemInfo(item.id, 1, item.weight)
|
||||||
|
saveItem.type = item.type
|
||||||
|
itemToSave.push(saveItem)
|
||||||
results.push({
|
results.push({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
count: 1,
|
count: 1,
|
||||||
@ -224,6 +232,7 @@ export default class CardController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await BagItem.addItems(accountid, itemToSave)
|
||||||
await account.save()
|
await account.save()
|
||||||
record.count -= count
|
record.count -= count
|
||||||
await record.save()
|
await record.save()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user