Commit 2c58552f authored by shajiaiming's avatar shajiaiming

fix

parent ad55fa40
......@@ -3,6 +3,7 @@
namespace api\controllers;
use api\base\BaseController;
use common\models\psources\Coin;
use common\models\psources\CoinAirDropTrade;
use common\models\psources\CoinIssueTransfer;
use common\models\psources\CoinPlatform;
......@@ -103,15 +104,37 @@ class WalletController extends BaseController
$code = -1;
goto doEnd;
}
$node = Yii::$app->params['chain_nodes'][strtoupper($platform->platform)];
if (empty($node)) {
$msg = '此功能为付费功能,有兴趣请与销售联系';
$code = -1;
goto doEnd;
}
$coin_model = Coin::find()->select('name, treaty')->where(['name' => strtoupper($symbol), 'platform' => $platform->platform])->one();
$service = new Chain33Service($node);
$address[] = $token;
$result = $service->getTokenBalance($address, $platform->exer, $symbol);
$switch = false;
if (empty($coin_model)) {
$execer = $platform->exer;
} else {
if (1 == $coin_model->treaty) {
$execer = 'user.p.' . $chain_model->chain->platform . '.token';
} else {
$execer = 'user.p.' . $chain_model->chain->platform . '.coins';
$switch = true;
}
}
if (false == $switch) {
$result = $service->getTokenBalance($address, $execer, $symbol);
} else {
$result = $service->getBalance($address, $execer);
}
if (0 !== $result['code']) {
$msg = '当前发币人数过多,请客官稍后再试';
$code = -1;
......
......@@ -260,7 +260,7 @@ class Chain33Service
{
$params = [
'addresses' => $address,
'execer' => $execer,
#'execer' => $execer,
];
return $this->send($params, 'Chain33.GetBalance');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment