|
|
@@ -77,25 +77,26 @@ export default class TxModel {
|
|
|
}
|
|
|
|
|
|
static parseLocalRecord(remoteRecord) {
|
|
|
+ //需要对每种数据做 验证没有,则需要做默认属性值
|
|
|
try {
|
|
|
let localRecord = {}
|
|
|
|
|
|
- localRecord.hash = remoteRecord.hash
|
|
|
+ localRecord.hash = (remoteRecord.hash === null ? '' : remoteRecord.hash)
|
|
|
localRecord.blockNumber = (remoteRecord.blockNumber === null ? 0 : remoteRecord.blockNumber)
|
|
|
- localRecord.comment = remoteRecord.comment
|
|
|
- localRecord.from = remoteRecord.fromAddress
|
|
|
- localRecord.to = remoteRecord.toAddress
|
|
|
- localRecord.gasPrice = TxModel.parseGasPrice(remoteRecord.gasPriceStr)
|
|
|
- localRecord.timestamp = remoteRecord.timestamp ? remoteRecord.timestamp : 0
|
|
|
- localRecord.transferList = remoteRecord.transferList
|
|
|
+ localRecord.comment = (remoteRecord.comment === null ? '' : remoteRecord.comment)
|
|
|
+ localRecord.from = (remoteRecord.fromAddress === null ? '' : remoteRecord.fromAddress)
|
|
|
+ localRecord.to = (remoteRecord.toAddress === null ? '' : remoteRecord.toAddress)
|
|
|
+ localRecord.gasPrice = TxModel.parseGasPrice((remoteRecord.gasPriceStr === null ? '' : remoteRecord.gasPriceStr))
|
|
|
+ localRecord.timestamp = remoteRecord.timestamp === null ? 0 : remoteRecord.timestamp
|
|
|
+ localRecord.transferList = (remoteRecord.transferList === null ? {} : remoteRecord.transferList)
|
|
|
localRecord.fromName = remoteRecord.fromName
|
|
|
localRecord.toName = remoteRecord.toName
|
|
|
- localRecord.status = parseInt(remoteRecord.status)
|
|
|
- localRecord.index = parseInt(remoteRecord.transactionIndex === null ? "-1" : remoteRecord.transactionIndex)
|
|
|
- localRecord.type = remoteRecord.tradeType
|
|
|
+ localRecord.status = (remoteRecord.status === null ? '' : parseInt(remoteRecord.status))
|
|
|
+ localRecord.index = remoteRecord.transactionIndex === null ? '' : parseInt(remoteRecord.transactionIndex)
|
|
|
+ localRecord.type = (remoteRecord.tradeType === null ? '' : remoteRecord.tradeType)
|
|
|
// if (isNaN(localRecord.type))
|
|
|
- if (localRecord.type === NaN || localRecord.type === null || localRecord.type === undefined)
|
|
|
- localRecord.type = ''
|
|
|
+ // if (localRecord.type === NaN || localRecord.type === null || localRecord.type === undefined)
|
|
|
+ // localRecord.type = ''
|
|
|
|
|
|
|
|
|
// transferList的format
|
|
|
@@ -115,12 +116,13 @@ export default class TxModel {
|
|
|
|
|
|
return localRecord
|
|
|
} catch (e) {
|
|
|
+ console.log('数据解析出现异常:', e)
|
|
|
return undefined
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static parseGasPrice(gasPriceStr) {
|
|
|
- if (!gasPriceStr) {
|
|
|
+ if (gasPriceStr == '') {
|
|
|
return -1
|
|
|
}
|
|
|
|