wallet tron transactions
This commit is contained in:
49
app/Models/Wallet/Tron/WalletTronBlockModel.php
Normal file
49
app/Models/Wallet/Tron/WalletTronBlockModel.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace App\Models\Wallet\Tron;
|
||||
|
||||
use App\Models\Wallet\Base\WalletBaseModel;
|
||||
use App\Tools\Math;
|
||||
use App\Tools\Times;
|
||||
|
||||
class WalletTronBlockModel extends WalletBaseModel
|
||||
{
|
||||
protected $table = 'wallet_tron_block';
|
||||
protected $primaryKey = 'id';
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'status',
|
||||
'block_id',
|
||||
'block_num',
|
||||
'block_timestamp',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
const STATUS_WAIT = 1;
|
||||
const STATUS_PROCESS = 2;
|
||||
const STATUS_FINISH = 3;
|
||||
const STATUS_FAIL = 4;
|
||||
const STATUS = [
|
||||
self::STATUS_WAIT => '等待',
|
||||
self::STATUS_PROCESS => '处理中',
|
||||
self::STATUS_FINISH => '完成',
|
||||
self::STATUS_FAIL => '处理失败',
|
||||
];
|
||||
|
||||
function insertByBlockNum($blockNum): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder|bool
|
||||
{
|
||||
$data = [
|
||||
'block_num' => $blockNum,
|
||||
'status' => self::STATUS_WAIT,
|
||||
'created_at' => Times::getNowDateTime(),
|
||||
|
||||
];
|
||||
return $this->addItem($data);
|
||||
}
|
||||
|
||||
function getLastBlockNumber()
|
||||
{
|
||||
return $this->newQuery()->orderBy('block_num', 'desc')->value('block_num');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user