智能合约部分的结构体数据
struct CarInfo{
string name;
string description;
uint reward;
uint waitTime;
uint longitude;
uint latitude;
}
数据上传的处理逻辑
event NewCarInfo();
function addCarInfo(string memory _name,string memory _description,uint _reward, uint _waitTime,uint _longitude,uint _latitude) public {
CarInfo memory carInfo = CarInfo(_name,_description,_reward,_waitTime,_longitude,_latitude);
CarInfos[msg.sender].push(carInfo);
emit NewCarInfo();
}
获取数据的console输出
Result
0: "4"
1: "5"
2: BN
length: (...)
negative: (...)
red: (...)
words: (...)
__ob__: Observer {value: BN, dep: Dep, vmCount: 0}
get length: ƒ reactiveGetter()
set length: ƒ reactiveSetter(newVal)
get negative: ƒ reactiveGetter()
set negative: ƒ reactiveSetter(newVal)
get red: ƒ reactiveGetter()
set red: ƒ reactiveSetter(newVal)
get words: ƒ reactiveGetter()
set words: ƒ reactiveSetter(newVal)
__proto__: Object