Improved block page queries

This commit is contained in:
marcdeb1 2018-12-21 13:42:57 +01:00
parent 90eee866fc
commit f7318d64fc
2 changed files with 8 additions and 10 deletions

View file

@ -327,9 +327,7 @@ class MainController extends AppController {
} }
// Get the basic block transaction info // Get the basic block transaction info
$txs = $this->Transactions->find()->select(['id', 'input_count', 'output_count', 'hash', 'version'])->where(['block_hash_id' => $block->hash])->toArray(); $txs = $this->Transactions->find()->select(['Transactions.id', 'Transactions.input_count', 'Transactions.output_count', 'Transactions.hash', 'Transactions.version'])->select(['value' => 'sum(O.value)'])->leftJoin(['O' => 'output'], ['O.transaction_id = Transactions.id'])->where(['Transactions.block_hash_id' => $block->hash])->toArray();
$this->set('block', $block); $this->set('block', $block);
$this->set('blockTxs', $txs); $this->set('blockTxs', $txs);
} }
@ -400,7 +398,7 @@ class MainController extends AppController {
$this->loadModel('Addresses'); $this->loadModel('Addresses');
// exclude bHW58d37s1hBjj3wPBkn5zpCX3F8ZW3uWf (genesis block) // exclude bHW58d37s1hBjj3wPBkn5zpCX3F8ZW3uWf (genesis block)
$richList = $this->Addresses->find()->where(['Address <>' => 'bHW58d37s1hBjj3wPBkn5zpCX3F8ZW3uWf'])->order(['Balance' => 'DESC'])->limit(500)->toArray(); $richList = $this->Addresses->find()->where(['address <>' => 'bHW58d37s1hBjj3wPBkn5zpCX3F8ZW3uWf'])->order(['Balance' => 'DESC'])->limit(500)->toArray();
$priceRate = 0; $priceRate = 0;
//$priceInfo = json_decode($this->redis->get(self::lbcPriceKey)); //$priceInfo = json_decode($this->redis->get(self::lbcPriceKey));
@ -456,11 +454,11 @@ class MainController extends AppController {
$tagRequestAmount = 0; $tagRequestAmount = 0;
// Check for pending tag request // Check for pending tag request
$this->loadModel('TagAddressRequests'); //$this->loadModel('TagAddressRequests');
$pending = $this->TagAddressRequests->find()->where(['Address' => $addr, 'IsVerified <>' => 1])->first(); //$pending = $this->TagAddressRequests->find()->where(['Address' => $addr, 'IsVerified <>' => 1])->first();
if (!$pending) { //if (!$pending) {
$tagRequestAmount = '25.' . rand(11111111, 99999999); // $tagRequestAmount = '25.' . rand(11111111, 99999999);
} //}
$address = $this->Addresses->find()->where(['address' => $addr])->first(); $address = $this->Addresses->find()->where(['address' => $addr])->first();
if (!$address) { if (!$address) {

View file

@ -112,7 +112,7 @@
<td class="w300"><div><a href="/tx/<?php echo $tx->hash ?>"><?php echo $tx->hash ?></a></div></td> <td class="w300"><div><a href="/tx/<?php echo $tx->hash ?>"><?php echo $tx->hash ?></a></div></td>
<td class="right"><?php echo $tx->input_count ?></td> <td class="right"><?php echo $tx->input_count ?></td>
<td class="right"><?php echo $tx->output_count ?></td> <td class="right"><?php echo $tx->output_count ?></td>
<td class="right"><div title="<?php echo $tx->value() ?> LBC"><?php echo $this->Amount->formatCurrency($tx->value()) ?> LBC</div></td> <td class="right"><div title="<?php echo $tx->value ?> LBC"><?php echo $this->Amount->formatCurrency($tx->value()) ?> LBC</div></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>