35 lines
963 B
PHP
Executable File
35 lines
963 B
PHP
Executable File
<?php
|
|
namespace wstmart\app\controller;
|
|
/**
|
|
* ============================================================================
|
|
* 默认控制器
|
|
*/
|
|
class Chain3 extends Chain3base{
|
|
public function __construct(){
|
|
parent::__construct();
|
|
$this->wei = 8;
|
|
}
|
|
/**
|
|
*查询ect余额
|
|
*
|
|
* @return void
|
|
*/
|
|
public function get_Balance(){
|
|
$address = $this->getCoinbase();//trim(input('post.address'));
|
|
$this->web3->eth->getBalance($address , function ($err, $balance) {
|
|
if ($err !== null) {
|
|
exit(jsonReturn($err->getMessage()));
|
|
// echo 'Error: ' . $err->getMessage();
|
|
//return;
|
|
}else{
|
|
$my_balance = $balance->toString();
|
|
$my_balance = $my_balance/pow(10,$this->wei);
|
|
$data['balance'] = $my_balance;
|
|
exit(jsonReturn('',1,$data));
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
}
|