瀏覽代碼

交易查询功能完成

BF-202210271038\Administrator 3 年之前
父節點
當前提交
439eab283e
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. 3 1
      app/Console/Kernel.php
  2. 5 2
      app/Servers/BroadcastServer.php

+ 3 - 1
app/Console/Kernel.php

@@ -7,6 +7,7 @@ use App\Console\Commands\ClearUserCommand;
 use App\Console\Commands\CodeCommand;
 use App\Console\Commands\ContractCommand;
 use App\Console\Commands\CouponCommand;
+use App\Console\Commands\GetCommand;
 use App\Console\Commands\OrderAffirm;
 use App\Console\Commands\OrderAutoExpressl;
 use App\Console\Commands\OrderFinish;
@@ -32,7 +33,8 @@ class Kernel extends ConsoleKernel
         //
         TestCommand::class,
         ContractCommand::class,
-        SendCommand::class
+        SendCommand::class,
+        GetCommand::class
     ];
 
     /**

+ 5 - 2
app/Servers/BroadcastServer.php

@@ -4,6 +4,7 @@
 namespace App\Servers;
 
 use App\Models\Broadcast;
+use App\Models\ContractDistribution;
 use App\Servers\Icon\BanRPC;
 use App\Servers\Icon\Utils;
 use Web3p\EthereumTx\Transaction;
@@ -78,7 +79,7 @@ class BroadcastServer
      */
     public  function getBroadcast()
     {
-        $list = Broadcast::where('status', '2')->select(['id', 'm_id', 'from', 'to', 'send_money', 'value', 'coin_id', 'type', 'sign', 'money', 'from_key', 'coin_id', 'hash', 'send_money', 'order_id'])->limit(100)->get();
+        $list = Broadcast::where('status', '2')->select(['id', 'm_id', 'from', 'to', 'value', 'coin_id', 'type', 'sign', 'money', 'from_key', 'coin_id', 'hash', 'order_id'])->limit(100)->get();
         $ret_type=false;
         if (empty($list)) return $ret_type;
         $bnbServer=BanRPC::creatServer();
@@ -89,14 +90,16 @@ class BroadcastServer
                 continue;
             } else {
                 //交易已完成 返回数据格式数据 ,将数据json保存
+                $distribution=ContractDistribution::where('id',$value->{'order_id'})->where('type',$value->{'type'})->first();
                 if ($receipt['status'] != '0x1') {
                     $update_info['error'] = '广播提交失败';
                     $update_info['status'] = 3;
+                    $distribution->update(['status' => 2]);
                 } else {
                     $update_info['status'] = 4;
                     $update_info['end_time'] = time();
+                    $distribution->update(['status' => 3]);
                 }
-
             }
         }
         return $list->count();