|
23 | 23 |
|
24 | 24 | use Exception; |
25 | 25 |
|
| 26 | +use Illuminate\Database\Query\Builder; |
26 | 27 | use Illuminate\Http\JsonResponse; |
27 | 28 | use Illuminate\Http\RedirectResponse; |
28 | 29 | use Illuminate\Http\Response; |
@@ -61,12 +62,13 @@ class MainController extends Controller{ |
61 | 62 |
|
62 | 63 | public function __construct(){ |
63 | 64 | $this->redis = RedisFacade::connection()->client(); |
64 | | - $this->rpcUrl = config('lbry.rpc_url'); |
65 | | - try { |
| 65 | + try{ |
66 | 66 | $this->redis->info('mem'); |
67 | | - } catch (RedisException) { |
| 67 | + }catch(RedisException){ |
68 | 68 | $this->redis = null; |
69 | 69 | } |
| 70 | + |
| 71 | + $this->rpcUrl = config('lbry.rpc_url'); |
70 | 72 | } |
71 | 73 |
|
72 | 74 | /** |
@@ -118,7 +120,10 @@ protected function _getLatestPrice(): string{ |
118 | 120 | } |
119 | 121 | } |
120 | 122 |
|
121 | | - $lbcUsdPrice = (isset($priceInfo->price) && ($priceInfo->price > 0)) ? '$' . $priceInfo->price : 'N/A'; |
| 123 | + $lbcUsdPrice = 'N/A'; |
| 124 | + if(isset($priceInfo->price) && $priceInfo->price>0){ |
| 125 | + $lbcUsdPrice = '$'.$priceInfo->price; |
| 126 | + } |
122 | 127 | return $lbcUsdPrice; |
123 | 128 | } |
124 | 129 |
|
@@ -419,7 +424,7 @@ public function tx($hash = null): JsonResponse|Response|RedirectResponse|View{ |
419 | 424 | $input->input_addresses = $inputAddresses; |
420 | 425 | } |
421 | 426 |
|
422 | | - $outputs = Output::query()->addSelect(['spend_input_hash' => 'I.transaction_hash', 'spend_input_id' => 'I.id'])->where('Outputs.transaction_id',$tx->id)->leftJoin('Inputs','id','=','Outputs.spent_by_input_id')->orderBy('Outputs.vout')->get(); |
| 427 | + $outputs = Output::query()->where('output.transaction_id',$tx->id)->leftJoin('input AS i','i.id','=','output.spent_by_input_id')->addSelect('output.*')->addSelect(['i.transaction_hash AS spend_input_hash','i.id AS spend_input_id'])->orderBy('output.vout')->get(); |
423 | 428 | for ($i = 0; $i < count($outputs); $i++) { |
424 | 429 | $outputs[$i]->IsClaim = (strpos($outputs[$i]->script_pub_key_asm, 'CLAIM') > -1); |
425 | 430 | $outputs[$i]->IsSupportClaim = (strpos($outputs[$i]->script_pub_key_asm, 'SUPPORT_CLAIM') > -1); |
@@ -557,6 +562,7 @@ public function address($addr = null): JsonResponse|Response|RedirectResponse|Vi |
557 | 562 | 'RIGHT JOIN (SELECT transaction_id, debit_amount, credit_amount FROM transaction_address ' . |
558 | 563 | ' WHERE address_id = ?) TA ON TA.transaction_id = T.id ' . |
559 | 564 | 'ORDER BY transaction_time DESC LIMIT %d, %d', $offset, $pageLimit), [$address->id]); |
| 565 | + |
560 | 566 | $recentTxs = $stmt->fetchAll(PDO::FETCH_OBJ); |
561 | 567 |
|
562 | 568 | foreach($transactionAddresses as $ta) { |
|
0 commit comments