Commit e0b188e6 authored by shajiaiming's avatar shajiaiming

调整

parent cc964726
...@@ -347,42 +347,32 @@ class CoinController extends BaseController ...@@ -347,42 +347,32 @@ class CoinController extends BaseController
$request = Yii::$app->request; $request = Yii::$app->request;
$platform = $request->get('platform', ''); $platform = $request->get('platform', '');
$coin_name = $request->get('coinname', ''); $coin_name = $request->get('coinname', '');
if ($platform && $coin_name) { if (empty($coin_name)) {
$platform_with_hold = CoinPlatformWithHold::getRecord($platform); $platform_with_hold = CoinPlatformWithHold::getRecord($platform);
$coin_info = Coin::find()->select('treaty')->where(['name' => strtoupper($coin_name)])->asArray()->one(); $des = Yii::$app->des;
if ($platform_with_hold) { $platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
$des = Yii::$app->des; return ['code' => 0, 'data' => $platform_with_hold];
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']); }
if(1 == $coin_info['treaty']){ $platform_with_hold = CoinPlatformWithHold::getRecord($platform);
$platform_with_hold['exer'] = 'user.p.'. $platform .'.token'; $coin_info = Coin::find()->select('treaty')->where(['name' => strtoupper($coin_name)])->asArray()->one();
$platform_with_hold['tokensymbol'] = $coin_name; $des = Yii::$app->des;
$platform_with_hold['fee'] = 0; $platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
} else { if (1 == $coin_info['treaty']) {
$platform_with_hold['exer'] = 'user.p.'. $platform .'.coins'; $platform_with_hold['exer'] = 'user.p.' . $platform . '.token';
$platform_with_hold['tokensymbol'] = $platform .'.coins'; $platform_with_hold['tokensymbol'] = $coin_name;
$platform_with_hold['fee'] = (float)sprintf("%0.4f", (double)$platform_with_hold['fee']); $platform_with_hold['fee'] = 0;
} } else {
$service = new Chain33Business(); $platform_with_hold['exer'] = 'user.p.' . $platform . '.coins';
$result = $service->getProperFee(); $platform_with_hold['tokensymbol'] = $platform . '.coins';
if(0 === $result['code']) { $platform_with_hold['fee'] = (float)sprintf("%0.4f", (double)$platform_with_hold['fee']);
$platform_with_hold['bty_fee'] = (float)sprintf("%0.4f", $result['result']['properFee'] / 1e8); }
} else { $service = new Chain33Business();
$platform_with_hold['bty_fee'] = (float)sprintf("%0.4f", Yii::$app->params['bty_fee']); $result = $service->getProperFee();
} if (0 === $result['code']) {
$platform_with_hold['bty_fee'] = (float)sprintf("%0.4f", $result['result']['properFee'] / 1e8);
return ['code' => 0, 'data' => $platform_with_hold];
} else {
$data = [
'id' => 0,
'platform' => '',
'address' => '',
'private_key' => '',
'exer' => ''
];
return ['code' => 0, 'data' => $data];
}
} else { } else {
return ['code' => 1, 'data' => [], 'msg' => '平台参数或币种名称不能为空']; $platform_with_hold['bty_fee'] = (float)sprintf("%0.4f", Yii::$app->params['bty_fee']);
} }
return ['code' => 0, 'data' => $platform_with_hold];
} }
} }
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