Commit 95e79695 authored by shajiaiming's avatar shajiaiming

fix

parent f928ae53
...@@ -6,6 +6,7 @@ use api\base\BaseController; ...@@ -6,6 +6,7 @@ use api\base\BaseController;
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;
use common\models\psources\CoinPlatformWithHold;
use common\service\chain33\Chain33Service; use common\service\chain33\Chain33Service;
use Yii; use Yii;
...@@ -82,17 +83,35 @@ class WalletController extends BaseController ...@@ -82,17 +83,35 @@ class WalletController extends BaseController
$msg = 'success'; $msg = 'success';
$platform_id = Yii::$app->request->get('platform_id', ''); $platform_id = Yii::$app->request->get('platform_id', '');
$token = Yii::$app->request->get('address', ''); $token = Yii::$app->request->get('address', '');
if (empty($platform_id) || empty($token)) { $symbol = Yii::$app->request->get('symbol', '');
if (empty($platform_id) || empty($token) || empty($symbol)) {
$msg = '参数不能为空'; $msg = '参数不能为空';
$code = -1; $code = -1;
$data = null; $data = null;
goto doEnd; goto doEnd;
} }
$node = Yii::$app->params['chain_parallel']['primary'];
$chain_model = CoinPlatform::find()->select('chain_id')->where(['id' => $platform_id])->andWhere(['<>', 'chain_id', 0])->one();
if (empty($chain_model)) {
$msg = '此功能为付费功能,有兴趣请与销售联系';
$code = -1;
goto doEnd;
}
$platform = CoinPlatformWithHold::find()->select('exer, platform')->where(['id' => $chain_model->chain_id])->one();
if (empty($platform)) {
$msg = '此功能为付费功能,有兴趣请与销售联系';
$code = -1;
goto doEnd;
}
$node = Yii::$app->params['chain_nodes'][strtoupper($platform->platform)];
if (empty($node)) {
$msg = '此功能为付费功能,有兴趣请与销售联系';
$code = -1;
goto doEnd;
}
$service = new Chain33Service($node); $service = new Chain33Service($node);
$address[] = $token; $address[] = $token;
$execer = 'coins'; $result = $service->getBalance($address, $platform->exer, $symbol);
$result = $service->getBalance($address, $execer);
if (0 !== $result['code']) { if (0 !== $result['code']) {
$msg = '当前发币人数过多,请客官稍后再试'; $msg = '当前发币人数过多,请客官稍后再试';
$code = -1; $code = -1;
......
...@@ -256,12 +256,15 @@ class Chain33Service ...@@ -256,12 +256,15 @@ class Chain33Service
return $this->send($params, 'Chain33.Query'); return $this->send($params, 'Chain33.Query');
} }
public function getBalance($address, $execer) public function getBalance($address, $execer, $tokenSymbol = '')
{ {
$params = [ $params = [
'addresses' => $address, 'addresses' => $address,
'execer' => $execer 'execer' => $execer,
]; ];
if (!empty($tokenSymbol)) {
$params = array_merge($params, ['tokenSymbol' => $tokenSymbol]);
}
return $this->send($params, 'Chain33.GetBalance'); return $this->send($params, 'Chain33.GetBalance');
} }
......
...@@ -176,15 +176,26 @@ class IssueChainController extends BaseController ...@@ -176,15 +176,26 @@ class IssueChainController extends BaseController
{ {
$data = null; $data = null;
$group = Yii::$app->request->getGroup(); $group = Yii::$app->request->getGroup();
if ('administrator' == $group) { // if ('administrator' == $group) {
$chains = array_keys(Yii::$app->params['chain_nodes']); // $chains = array_keys(Yii::$app->params['chain_nodes']);
$platform = CoinPlatformWithHold::find()->select('id, platform, exer')->where(['in', 'platform', $chains])->all(); // $platform = CoinPlatformWithHold::find()->select('id, platform, exer')->where(['in', 'platform', $chains])->all();
// } else {
} else { // $platform_id = Yii::$app->request->getPlatformId();
$platform_id = Yii::$app->request->getPlatformId(); // $chain_model = CoinPlatform::find()->select('chain_id')->where(['id' => $platform_id])->andWhere(['<>', 'chain_id', 0])->one();
$chain_model = CoinPlatform::find()->select('chain_id')->where(['id' => $platform_id])->andWhere(['<>', 'chain_id', 0])->one(); // $platform = CoinPlatformWithHold::find()->select('id, platform, exer')->where(['id' => $chain_model->chain_id])->all();
$platform = CoinPlatformWithHold::find()->select('id, platform, exer')->where(['id' => $chain_model->chain_id])->all(); // }
$platform_id = Yii::$app->request->getPlatformId();
$chain_model = CoinPlatform::find()->select('chain_id')->where(['id' => $platform_id])->andWhere(['<>', 'chain_id', 0])->one();
if (empty($chain_model)) {
$msg = '此功能为付费功能,有兴趣请与销售联系';
$code = -1;
goto doEnd;
}
$platform = CoinPlatformWithHold::find()->select('id, platform, exer')->where(['id' => $chain_model->chain_id])->all();
if (empty($platform)) {
$msg = '此功能为付费功能,有兴趣请与销售联系';
$code = -1;
goto doEnd;
} }
foreach ($platform as $val) { foreach ($platform as $val) {
$val->tokens = []; $val->tokens = [];
...@@ -203,7 +214,7 @@ class IssueChainController extends BaseController ...@@ -203,7 +214,7 @@ class IssueChainController extends BaseController
if (!empty($coin_model)) { if (!empty($coin_model)) {
array_unshift($symbol, $coin_model->name); array_unshift($symbol, $coin_model->name);
} }
array_unshift($symbol, 'BTY'); //array_unshift($symbol, 'BTY');
$val->tokens = $symbol; $val->tokens = $symbol;
} }
unset($val->exer); unset($val->exer);
......
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