|
@@ -172,12 +172,25 @@ class Sync_Base extends Singleton {
|
|
|
}
|
|
|
|
|
|
public function getNewestDatas($lower = null, $limit = 1000) {
|
|
|
- $cmd = "cleos -u {$GLOBALS['eosUrl']} get table {$this->code} {$this->code} {$this->codeTable} --index {$this->index} --key-type {$this->keyType} -l {$limit} ";
|
|
|
+ $url = "{$GLOBALS['eosUrl']}v1/chain/get_table_rows";
|
|
|
+
|
|
|
+ $objHttp = new dwHttp();
|
|
|
+ $data = [
|
|
|
+ 'scope' => $this->code,
|
|
|
+ 'code' => $this->code,
|
|
|
+ 'table' => $this->codeTable,
|
|
|
+ 'json' => true,
|
|
|
+ 'limit' => $limit,
|
|
|
+ 'key_type' => $this->keyType,
|
|
|
+ 'index_position' => $this->index,
|
|
|
+ ];
|
|
|
+
|
|
|
if ($lower) {
|
|
|
- $cmd .= " -L '{$lower}' ";
|
|
|
+ $data['lower_bound'] = $lower;
|
|
|
}
|
|
|
|
|
|
- $json = Eos::execCmd($cmd);
|
|
|
+ // 第一次2秒就超时
|
|
|
+ $json = $objHttp->post2($url, json_encode($data), 5, 2);
|
|
|
$datas = json_decode($json, true);
|
|
|
|
|
|
Eos::log("get {$this->code} {$this->codeTable} lower:{$lower}, count:" . count($datas['rows']));
|