Commit 61a5fbe4 authored by shajiaiming's avatar shajiaiming

fix

parent cdc890c4
...@@ -100,26 +100,27 @@ class IssueChainController extends BaseController ...@@ -100,26 +100,27 @@ class IssueChainController extends BaseController
public function actionSetCharge() public function actionSetCharge()
{ {
$data = null; $data = null;
$platform_id = Yii::$app->request->getPlatformId();
$result = Yii::$app->request->post(); $result = Yii::$app->request->post();
$group = Yii::$app->request->getGroup();
if ('administrator' == $group) {
$platform_id = isset($result['platform_id']) ? (int)$result['platform_id'] : 0;
} else {
$platform_id = Yii::$app->request->getPlatformId();
}
$issue_charge = isset($result['issue_charge']) ? $result['issue_charge'] : ''; $issue_charge = isset($result['issue_charge']) ? $result['issue_charge'] : '';
$charge_unit = isset($result['charge_unit']) ? strtoupper($result['charge_unit']) : ''; $charge_unit = isset($result['charge_unit']) ? strtoupper($result['charge_unit']) : '';
$id = isset($result['platform_id']) ? (int)$result['platform_id'] : 0;
if (false == $issue_charge || false == $charge_unit) { if (false == $issue_charge || false == $charge_unit || false == $platform_id) {
$msg = '提交数据有误'; $msg = '提交数据有误';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
} }
if (1 == $platform_id) {
$platform_id = $id;
}
$chain_model = CoinPlatform::find()->where(['id' => $platform_id])->one(); $chain_model = CoinPlatform::find()->where(['id' => $platform_id])->one();
if (false == $chain_model) { if (false == $chain_model) {
$msg = '不存在的链'; $msg = '数据不存在';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
} }
...@@ -146,8 +147,8 @@ class IssueChainController extends BaseController ...@@ -146,8 +147,8 @@ class IssueChainController extends BaseController
public function actionManageReview() public function actionManageReview()
{ {
$data = null; $data = null;
$platform_id = Yii::$app->request->getPlatformId(); $group = Yii::$app->request->getGroup();
if (1 != $platform_id) { if ('administrator' == $group) {
$msg = '当前账户无权限操作'; $msg = '当前账户无权限操作';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -176,34 +177,38 @@ class IssueChainController extends BaseController ...@@ -176,34 +177,38 @@ 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(); if (empty($chain_model)) {
// } $msg = '尚未开通此功能';
$platform_id = Yii::$app->request->getPlatformId(); $code = -1;
$chain_model = CoinPlatform::find()->select('chain_id')->where(['id' => $platform_id])->andWhere(['<>', 'chain_id', 0])->one(); goto doEnd;
if (empty($chain_model)) { }
$msg = '此功能为付费功能,有兴趣请与销售联系'; $platform = CoinPlatformWithHold::find()->select('id, platform, exer')->where(['id' => $chain_model->chain_id])->one();
$code = -1; if (empty($platform)) {
goto doEnd; $msg = '尚未开通此功能';
} $code = -1;
$platform = CoinPlatformWithHold::find()->select('id, platform, exer')->where(['id' => $chain_model->chain_id])->all(); goto doEnd;
if (empty($platform)) { }
$msg = '此功能为付费功能,有兴趣请与销售联系'; if (!isset(Yii::$app->params['chain_nodes'][strtoupper($platform->platform)])) {
$code = -1; $msg = '尚未开通此功能';
goto doEnd; $code = -1;
goto doEnd;
}
$platform = array($platform);
} }
foreach ($platform as $val) { foreach ($platform as $val) {
$val->tokens = []; $val->tokens = [];
if (!empty($val->exer)) { if (!empty($val->exer)) {
$node = Yii::$app->params['chain_nodes'][strtoupper($val->platform)]; $node = Yii::$app->params['chain_nodes'][strtoupper($val->platform)];
$service = new Chain33Service($node); $service = new Chain33Service($node);
$funcName = 'GetTokens'; $funcName = 'GetTokens';
$result = $service->getTokens($val->exer, $funcName); $result = $service->getTokens($val->exer, $funcName);
if (isset($result['code']) && 0 == $result['code']) { if (isset($result['code']) && 0 == $result['code']) {
$symbol = []; $symbol = [];
foreach ($result['result']['tokens'] as $temp) { foreach ($result['result']['tokens'] as $temp) {
......
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