Merge branch 'new-CounterFire' of http://git.kingsome.cn/huangjinming/CounterFireGames into new-CounterFire

This commit is contained in:
yuyongdong 2024-06-29 14:30:04 +08:00
commit ae8ab187e1

View File

@ -112,7 +112,31 @@ const addCart = async (val) => {
}
]
}
try {
let res = await marketplaceList.getCartListState()
if (res.data && res.data.length) {
let exists = res.data.find(item => {
return item.nft.token_id == val.nft.token_id && item.nft.contract_address == val.nft.contract_address
})
if (exists) {
message.error('already in the shopping cart')
return
}
const currency = res.data[0].event?.data?.buy[0].contract_address || ''
const type = res.data[0].event?.data?.buy[0].item_type || ''
const currentCurrency = val.event?.data?.buy[0].contract_address || ''
const currentType = val.event?.data?.buy[0].item_type || ''
if (currency != currentCurrency || type != currentType) {
// TODO:
message.error('Please add the same type of item to the shopping cart')
return
}
}
const { errcode, errmsg } = await marketplaceList.addCartListState(data)
console.log(errcode, errmsg)
if(errcode == 0) {