Commit 7a940eae authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/20190718' into 'master'

调整 See merge request !63
parents b637efc4 e0b188e6
......@@ -347,42 +347,32 @@ class CoinController extends BaseController
$request = Yii::$app->request;
$platform = $request->get('platform', '');
$coin_name = $request->get('coinname', '');
if ($platform && $coin_name) {
if (empty($coin_name)) {
$platform_with_hold = CoinPlatformWithHold::getRecord($platform);
$coin_info = Coin::find()->select('treaty')->where(['name' => strtoupper($coin_name)])->asArray()->one();
if ($platform_with_hold) {
$des = Yii::$app->des;
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
if(1 == $coin_info['treaty']){
$platform_with_hold['exer'] = 'user.p.'. $platform .'.token';
$platform_with_hold['tokensymbol'] = $coin_name;
$platform_with_hold['fee'] = 0;
} else {
$platform_with_hold['exer'] = 'user.p.'. $platform .'.coins';
$platform_with_hold['tokensymbol'] = $platform .'.coins';
$platform_with_hold['fee'] = (float)sprintf("%0.4f", (double)$platform_with_hold['fee']);
}
$service = new Chain33Business();
$result = $service->getProperFee();
if(0 === $result['code']) {
$platform_with_hold['bty_fee'] = (float)sprintf("%0.4f", $result['result']['properFee'] / 1e8);
} else {
$platform_with_hold['bty_fee'] = (float)sprintf("%0.4f", Yii::$app->params['bty_fee']);
}
return ['code' => 0, 'data' => $platform_with_hold];
} else {
$data = [
'id' => 0,
'platform' => '',
'address' => '',
'private_key' => '',
'exer' => ''
];
return ['code' => 0, 'data' => $data];
}
$des = Yii::$app->des;
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
return ['code' => 0, 'data' => $platform_with_hold];
}
$platform_with_hold = CoinPlatformWithHold::getRecord($platform);
$coin_info = Coin::find()->select('treaty')->where(['name' => strtoupper($coin_name)])->asArray()->one();
$des = Yii::$app->des;
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
if (1 == $coin_info['treaty']) {
$platform_with_hold['exer'] = 'user.p.' . $platform . '.token';
$platform_with_hold['tokensymbol'] = $coin_name;
$platform_with_hold['fee'] = 0;
} else {
$platform_with_hold['exer'] = 'user.p.' . $platform . '.coins';
$platform_with_hold['tokensymbol'] = $platform . '.coins';
$platform_with_hold['fee'] = (float)sprintf("%0.4f", (double)$platform_with_hold['fee']);
}
$service = new Chain33Business();
$result = $service->getProperFee();
if (0 === $result['code']) {
$platform_with_hold['bty_fee'] = (float)sprintf("%0.4f", $result['result']['properFee'] / 1e8);
} 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