Commit e0b188e6 authored by shajiaiming's avatar shajiaiming

调整

parent cc964726
......@@ -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);
$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();
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';
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['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']) {
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];
}
} else {
return ['code' => 1, 'data' => [], 'msg' => '平台参数或币种名称不能为空'];
}
}
}
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