Commit ccc3f167 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

Feature/optimize See merge request !87
parents f6911901 a9997d64
...@@ -223,9 +223,9 @@ class CoinController extends BaseController ...@@ -223,9 +223,9 @@ class CoinController extends BaseController
return ['code' => 0, 'data' => []]; return ['code' => 0, 'data' => []];
} }
foreach ($names as $key => $val) { foreach ($names as $key => $val) {
if(strpos($val, ',') !== false){ if (strpos($val, ',') !== false) {
$val_array = explode(',', $val); $val_array = explode(',', $val);
if('USDT' == strtoupper($val_array[0]) && 'BTC' == strtoupper($val_array[1])) { if ('USDT' == strtoupper($val_array[0]) && 'BTC' == strtoupper($val_array[1])) {
$condition[] = [$val_array[0], 'omni']; $condition[] = [$val_array[0], 'omni'];
continue; continue;
} }
...@@ -344,29 +344,29 @@ class CoinController extends BaseController ...@@ -344,29 +344,29 @@ 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 (empty($coin_name)) {
$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; $des = Yii::$app->des;
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']); $platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
$platform_with_hold['coins_name'] = ''; $platform_with_hold['coins_name'] = '';
return ['code' => 0, 'data' => $platform_with_hold]; return ['code' => 0, 'data' => $platform_with_hold];
} }
$platform_with_hold = CoinPlatformWithHold::getRecord($platform);
$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'] = $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';
$platform_with_hold['tokensymbol'] = $coin_name; $platform_with_hold['tokensymbol'] = $coin_name;
$platform_with_hold['fee'] = 0;
$coins_model = Coin::find()->select('name')->where(['platform' => $platform, 'treaty' => 2])->asArray()->one();
$platform_with_hold['coins_name'] = empty($coins_model) ? '' : $coins_model['name'];
} else { } else {
$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['coins_name'] = '';
} }
$platform_with_hold['fee'] = (float)sprintf("%0.4f", (double)$platform_with_hold['fee']);
$coins_model = Coin::find()->select('name')->where(['platform' => $platform, 'treaty' => 2])->asArray()->one();
$platform_with_hold['coins_name'] = empty($coins_model) ? '' : $coins_model['name'];
$service = new Chain33Business(); $service = new Chain33Business();
$result = $service->getProperFee(); $result = $service->getProperFee();
if (0 === $result['code']) { if (0 === $result['code']) {
......
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