|
|
@@ -1,45 +1,69 @@
|
|
|
-import http from "axios";
|
|
|
+import http from 'axios'
|
|
|
+import NumKit from '@/plugins/kit/NumKit'
|
|
|
|
|
|
export default class EthMev {
|
|
|
static async getEthMevData(block, hash, dataVague, page=1, size=200) {
|
|
|
- let url = '/ethmev/findByHashOrBlockOrDataVague'
|
|
|
-
|
|
|
- return http.post(url, {
|
|
|
+ const url = '/ethmev/findByHashOrBlockOrDataVague'
|
|
|
+ const rst = await http.post(url, {
|
|
|
block: block,
|
|
|
hash: hash,
|
|
|
dataVague: dataVague,
|
|
|
limit1: (page - 1) * size,
|
|
|
limit2: size
|
|
|
- });
|
|
|
+ })
|
|
|
+
|
|
|
+ return rst.data
|
|
|
}
|
|
|
|
|
|
static async getEthMevPendingData(block, hash, dataVague, page=1, size=200) {
|
|
|
- let url = '/ethmev/findByHashOrBlockOrDataVaguePending'
|
|
|
-
|
|
|
- return http.post(url, {
|
|
|
+ const url = '/ethmev/findByHashOrBlockOrDataVaguePending'
|
|
|
+ const rst = await http.post(url, {
|
|
|
block: block,
|
|
|
hash: hash,
|
|
|
dataVague: dataVague,
|
|
|
limit1: (page - 1) * size,
|
|
|
limit2: size
|
|
|
- });
|
|
|
+ })
|
|
|
+
|
|
|
+ return rst.data
|
|
|
}
|
|
|
|
|
|
static async deleteByHash(hash) {
|
|
|
- let url = '/ethmev/deleteByHash'
|
|
|
-
|
|
|
- return http.post(url, {
|
|
|
+ const url = '/ethmev/deleteByHash'
|
|
|
+ const rst = await http.post(url, {
|
|
|
hash: hash
|
|
|
- });
|
|
|
+ })
|
|
|
+
|
|
|
+ return rst.data
|
|
|
}
|
|
|
|
|
|
static async appendOrUpdate(block, hash, dataVague) {
|
|
|
- let url = '/ethmev/appendOrUpdate'
|
|
|
-
|
|
|
- return http.post(url, {
|
|
|
+ const url = '/ethmev/appendOrUpdate'
|
|
|
+ const rst = await http.post(url, {
|
|
|
block: block,
|
|
|
hash: hash,
|
|
|
dataVague: dataVague
|
|
|
})
|
|
|
+
|
|
|
+ return rst.data
|
|
|
+ }
|
|
|
+
|
|
|
+ static generateTableDataByDbData(historyList) {
|
|
|
+ historyList.map(function (history) {
|
|
|
+ try {
|
|
|
+ let dataObj = history.dataObj
|
|
|
+
|
|
|
+ history.tradeInfo = dataObj.tradeInfo
|
|
|
+ history.from = dataObj.fromAdd
|
|
|
+ history.to = dataObj.toAdd
|
|
|
+ history.gasPrice = NumKit._N(parseInt(dataObj.gasPrice) / (1E9), 2)
|
|
|
+ history.index = dataObj.index
|
|
|
+ history.type = dataObj.type
|
|
|
+ history.state = dataObj.status
|
|
|
+ history.pending = dataObj.pending
|
|
|
+ } catch (e) {
|
|
|
+ history.tradeInfo = []
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|