Commit 2c58552f authored by shajiaiming's avatar shajiaiming

fix

parent ad55fa40
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace api\controllers; namespace api\controllers;
use api\base\BaseController; use api\base\BaseController;
use common\models\psources\Coin;
use common\models\psources\CoinAirDropTrade; use common\models\psources\CoinAirDropTrade;
use common\models\psources\CoinIssueTransfer; use common\models\psources\CoinIssueTransfer;
use common\models\psources\CoinPlatform; use common\models\psources\CoinPlatform;
...@@ -103,15 +104,37 @@ class WalletController extends BaseController ...@@ -103,15 +104,37 @@ class WalletController extends BaseController
$code = -1; $code = -1;
goto doEnd; goto doEnd;
} }
$node = Yii::$app->params['chain_nodes'][strtoupper($platform->platform)]; $node = Yii::$app->params['chain_nodes'][strtoupper($platform->platform)];
if (empty($node)) { if (empty($node)) {
$msg = '此功能为付费功能,有兴趣请与销售联系'; $msg = '此功能为付费功能,有兴趣请与销售联系';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
} }
$coin_model = Coin::find()->select('name, treaty')->where(['name' => strtoupper($symbol), 'platform' => $platform->platform])->one();
$service = new Chain33Service($node); $service = new Chain33Service($node);
$address[] = $token; $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']) { if (0 !== $result['code']) {
$msg = '当前发币人数过多,请客官稍后再试'; $msg = '当前发币人数过多,请客官稍后再试';
$code = -1; $code = -1;
......
...@@ -260,7 +260,7 @@ class Chain33Service ...@@ -260,7 +260,7 @@ class Chain33Service
{ {
$params = [ $params = [
'addresses' => $address, 'addresses' => $address,
'execer' => $execer, #'execer' => $execer,
]; ];
return $this->send($params, 'Chain33.GetBalance'); 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