Commit 2b52d11e authored by shajiaming's avatar shajiaming

solve conflict

parents 4ac48a38 1a13a480
......@@ -2,6 +2,7 @@
namespace api\controllers;
use common\models\psources\Coin;
use common\service\chain33\Chain33Service;
use Yii;
use api\base\BaseController;
......@@ -92,7 +93,7 @@ class WalletChainController extends BaseController
'port' => isset($post['port']) ? $post['port'] : '',
'wallet_address' => isset($post['wallet_address']) ? $post['wallet_address'] : '',
'status' => WalletChain::STATUS_NO,
'origin' => WalletChain::ORIGIN_MANAGE,
'origin' => WalletChain::ORIGIN_USER,
'fee' => isset($post['fee']) ? $post['fee'] : '',
'hash' => isset($post['hash']) ? $post['hash'] : ''
];
......@@ -119,6 +120,8 @@ class WalletChainController extends BaseController
goto doEnd;
}
$this->syncCoin(['platform' => $params['platform'], 'token' => $params['token']]);
$chain_update = WalletChain::find()->where(['id' => $id])->one();
$chain_update->setScenario(WalletChain::SCENARIOS_UPDATE);
$chain_update->status = WalletChain::STATUS_YES;
......@@ -165,4 +168,15 @@ class WalletChainController extends BaseController
doEnd :
return ['code' => $this->code, 'data' => $this->data, 'msg' => $this->msg];
}
public function syncCoin($params = [])
{
$model = new Coin();
$model->nickname = ['ja' => '', 'en-US' => '', 'zh-CN' => ''];
$model->name = $params['token'];
$model->platform = $params['platform'];
$model->chain = 'BTY';
$model->platform_id = 1;
$model->save();
}
}
......@@ -413,7 +413,7 @@ class Chain33Service
'payload' => [
'status' => 1,
'queryAll' => true,
'symbolOnly' => true
//'symbolOnly' => true
]
];
return $this->send($params, 'Chain33.Query');
......
......@@ -2,8 +2,10 @@
namespace console\controllers;
use common\components\Tools;
use common\models\psources\CoinIssueRevokeRecord;
use common\models\psources\CoinPlatformWithHold;
use common\models\psources\WalletChain;
use Yii;
use yii\console\Controller;
use yii\helpers\ArrayHelper;
......@@ -368,6 +370,43 @@ class IssueChainTransferController extends Controller
return 0;
}
public function actionAsynCoin()
{
$chains = WalletChain::find()->select('host, platform')
->where(['status' => 1, 'origin' => WalletChain::ORIGIN_USER])
->asArray()
->all();
foreach ($chains as $chain){
$node = [
'scheme' => 'http',
'host' => $chain['host'],
'port' => 8901
];
$chain_service = new Chain33Service($node);
$result = $chain_service->getTokens('token', 'GetTokens');
if (null != $result['error']) continue;
$tokens = isset($result['result']['tokens']) ? $result['result']['tokens'] : null;
if (null == $tokens) continue;
foreach ($tokens as $key => $token) {
$model_coin = Coin::find()->where(['name' => $token['symbol'], 'platform' => $chain['platform'], 'chain' => 'BTY'])->one();
if (empty($model_coin)) {
$model = new Coin();
$model->name = $token['symbol'];
$model->sid = $token['name'];
$model->nickname = ['ja' => '', 'en-US' => '', 'zh-CN' => ''];
$model->introduce = ['ja' => '', 'en-US' => '', 'zh-CN' => $token['introduction']];
$model->platform = $chain['platform'];
$model->publish_count = $token['total'];
$model->chain = 'BTY';
$model->platform_id = 1;
$model->treaty = 1;
$model->save();
}
}
}
}
public function syncCoin($params = [])
{
......
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