Commit 659b769f authored by shajiaiming's avatar shajiaiming

fix

parent 16a40b9a
...@@ -429,18 +429,10 @@ class CoinController extends BaseController ...@@ -429,18 +429,10 @@ class CoinController extends BaseController
$platform = $request->get('platform', ''); $platform = $request->get('platform', '');
$coin_name = $request->get('coinname', ''); $coin_name = $request->get('coinname', '');
$platform_with_hold = CoinPlatformWithHold::getRecord($platform); $platform_with_hold = CoinPlatformWithHold::getRecord($platform);
if (empty($platform_with_hold)) {
return ['code' => 0, 'data' => null];
}
if (empty($coin_name)) {
$des = Yii::$app->des;
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
$platform_with_hold['coins_name'] = '';
return ['code' => 0, 'data' => $platform_with_hold];
}
$coin_info = Coin::find()->select('treaty')->where(['name' => strtoupper($coin_name), 'platform' => $platform])->asArray()->one(); $coin_info = Coin::find()->select('treaty')->where(['name' => strtoupper($coin_name), 'platform' => $platform])->asArray()->one();
$des = Yii::$app->des; $des = Yii::$app->des;
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']); $platform_with_hold['private_key'] = isset($platform_with_hold['private_key']) ? $des->encrypt($platform_with_hold['private_key']) : '';
if (1 == $coin_info['treaty']) { if (1 == $coin_info['treaty']) {
$platform_with_hold['exer'] = 'user.p.' . $platform . '.token'; $platform_with_hold['exer'] = 'user.p.' . $platform . '.token';
if ('BTY' !== strtoupper($platform)) { if ('BTY' !== strtoupper($platform)) {
...@@ -452,7 +444,7 @@ class CoinController extends BaseController ...@@ -452,7 +444,7 @@ class CoinController extends BaseController
$platform_with_hold['exer'] = 'user.p.' . $platform . '.coins'; $platform_with_hold['exer'] = 'user.p.' . $platform . '.coins';
$platform_with_hold['tokensymbol'] = $platform . '.coins'; $platform_with_hold['tokensymbol'] = $platform . '.coins';
} }
$platform_with_hold['fee'] = (float)sprintf("%0.4f", (double)$platform_with_hold['fee']); $platform_with_hold['fee'] = isset($platform_with_hold['fee']) ? (float)sprintf("%0.4f", (double)$platform_with_hold['fee']) : 0;
$coins_model = Coin::find()->select('name')->where(['platform' => $platform, 'treaty' => 2])->asArray()->one(); $coins_model = Coin::find()->select('name')->where(['platform' => $platform, 'treaty' => 2])->asArray()->one();
$platform_with_hold['coins_name'] = empty($coins_model) ? '' : $coins_model['name']; $platform_with_hold['coins_name'] = empty($coins_model) ? '' : $coins_model['name'];
$service = new Chain33Business(); $service = new Chain33Business();
......
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