坚固性不能循环并写入数据吗?必须一一写吗? 这是我的智能合约功能:
function purchaseItem1(address _to, uint256[] _tokenId) public {
address _from;
for(uint i = 0; i < _tokenId.length; i++){
_from = itemOwner[_tokenId[i]];
itemOwnerCount[_to] = itemOwnerCount[_to]+1;
itemOwnerCount[_from] = itemOwnerCount[_from]-1;
itemOwner[_tokenId[i]] = _to;
items[_tokenId[i]].available = false;
availableCount = availableCount-1;
}
}
在我的前端,我有一组具有相同名称的复选框。 在检查了其中一些内容之后,我将以uint [] tokenId的形式将数组中的值传递。