Realtme action improvements
This commit is contained in:
parent
cbee21c07c
commit
dfd7af81f9
3 changed files with 7 additions and 10 deletions
|
@ -220,19 +220,15 @@ class MainController extends AppController {
|
|||
$this->loadModel('Transactions');
|
||||
|
||||
// load 10 blocks and transactions
|
||||
$conn = ConnectionManager::get('default');
|
||||
$blocks = $this->Blocks->find()->select(['height', 'block_time', 'transaction_hashes'])->order(['height' => 'desc'])->limit(10)->toArray();
|
||||
for ($i = 0; $i < count($blocks); $i++) {
|
||||
$tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
|
||||
$blocks[$i]->transaction_count = count($tx_hashes);
|
||||
}
|
||||
|
||||
$stmt = $conn->execute('SELECT T.id, T.hash, T.input_count, T.output_count, IFNULL(T.transaction_time, T.created_at) AS TxTime ' .
|
||||
'FROM transaction T ORDER BY created_at DESC LIMIT 10');
|
||||
$txs = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$transactions = $this->Transactions->find()->select(['id', 'hash', 'input_count', 'output_count', 'transaction_time', 'created_at'])->order(['created_at' => 'desc'])->limit(10)->toArray();
|
||||
$this->set('blocks', $blocks);
|
||||
$this->set('txs', $txs);
|
||||
$this->set('txs', $transactions);
|
||||
}
|
||||
|
||||
public function find() {
|
||||
|
|
|
@ -59,8 +59,9 @@ $ctTag = $claim->getContentTag();
|
|||
<div class="label half-width">Author</div>
|
||||
<div class="label half-width">License</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="value half-width" title="<?php echo strlen(trim($claim->author)) > 0 ? $claim->author : '<em>Unspecified</em>' ?>"><?php echo strlen(trim($claim->author)) > 0 ? $claim->author : '<em>Unspecified</em>' ?></div>
|
||||
<!--
|
||||
<div class="value half-width" title="<?php echo strlen(trim($claim->license)) > 0 ? $claim->license : '' ?>">
|
||||
<?php if (strlen(trim($claim->LicenseUrl)) > 0): ?><a href="<?php echo $claim->LicenseUrl ?>" rel="nofollow" target="_blank"><?php endif; ?>
|
||||
<?php echo strlen(trim($claim->License)) > 0 ? $claim->License : '<em>Unspecified</em>' ?>
|
||||
|
|
|
@ -153,9 +153,9 @@
|
|||
|
||||
<tbody>
|
||||
<?php foreach ($txs as $tx): ?>
|
||||
<tr data-hash="<?php echo $tx->Hash ?>" data-time="<?php echo $tx->TxTime ?>">
|
||||
<td class="w200"><div><a href="/tx/<?php echo $tx->Hash ?>" target="_blank"><?php echo $tx->Hash ?></a></div></td>
|
||||
<td><?php echo \Carbon\Carbon::createFromTimestamp($tx->TxTime)->diffForHumans(); ?></td>
|
||||
<tr data-hash="<?php echo $tx->Hash ?>" data-time="<?php echo $tx->transaction_time ?>">
|
||||
<td class="w200"><div><a href="/tx/<?php echo $tx->hash ?>" target="_blank"><?php echo $tx->hash ?></a></div></td>
|
||||
<td><?php echo $tx->created_at->diffForHumans(); ?></td>
|
||||
<td class="right"><?php echo $tx->input_count ?></td>
|
||||
<td class="right"><?php echo $tx->output_count ?></td>
|
||||
<td class="right"><?php echo number_format($tx->value(), 8, '.', '') ?> LBC</td>
|
||||
|
|
Loading…
Reference in a new issue