Commit 9caa5fae authored by shajiaiming's avatar shajiaiming

fix

parent cf907411
......@@ -51,6 +51,7 @@ class CrossChainController extends BaseController
$model = new CoinCrossChain();
$data['txhex'] = $val['tx'];
$data['transfer_url'] = $val['url'];
$data['step'] = $val['step'];
$model->load($data, '');
$model->save();
}
......@@ -61,6 +62,62 @@ class CrossChainController extends BaseController
return ['code' => $code, 'msg' => $msg];
}
public function actionFixTransfer()
{
$code = -1;
$request = Yii::$app->request;
if (!$request->isPost) {
$msg = '请求错误!';
goto doEnd;
}
$post = $request->post();
$data['is_with_draw'] = (false == $post['isWithdraw']) ? 0 : 1;
$data['address'] = $post['address'];
foreach ($post['txs'] as $key => $val) {
$model = CoinCrossChain::find()->where(['is_with_draw' => $data['is_with_draw']])
->andWhere(['address' => $data['address']])
->andWhere(['step' => $val['step']])
->andWhere(['<>', 'msg', 'success'])
->one();
if(false == $model) continue;
$node_params = $model->transfer_url;
$node_params = explode(':', $node_params);
$node_params = [
'scheme' => $node_params[0],
'host' => str_replace('//', '', $node_params[1]),
'port' => isset($node_params[2]) ? $node_params[2] : ''
];
$service = new Chain33Service($node_params);
$send_result = $model->send_result;
$result = $service->QueryTransaction($send_result);
if (isset($result['result']['actionName']) && 'unknown' == $result['result']['actionName']) {
$model->query_result = 'success';
$model->msg = 'success';
$model->save();
continue;
} else if (isset($result['result']['receipt']['ty']) && 2 == $result['result']['receipt']['ty']) {
$model->query_result = 'success';
$model->msg = 'success';
$model->save();
continue;
} else {
$model->txhex = $val['tx'];
$model->transfer_url = $val['url'];
$model->send_result = 0;
$model->query_result = 0;
$model->msg = 0;
$model->save();
continue;
}
}
$code = 0;
$msg = 'success';
doEnd :
return ['code' => $code, 'msg' => $msg];
}
public function actionTransferStatus()
{
$code = -1;
......@@ -119,7 +176,7 @@ class CrossChainController extends BaseController
}
//交易成功,查询成功
if (true == $val['send_result'] && 'success' == $val['query_result'] && 'success' == $val['msg']) {
if (2 == $key){
if (2 == $key) {
$step = (2 == $key) ? 4 : ($key + 2);
$code = 0;
$msg = $val['send_result'];
......
......@@ -28,14 +28,14 @@ class CoinCrossChain extends BaseActiveRecord
{
return [
[['is_with_draw', 'address', 'txhex', 'transfer_url'], 'required'],
['transfer_number', 'safe']
[['transfer_number', 'step', 'send_result', 'query_result', 'msg'], 'safe']
];
}
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['is_with_draw', 'address', 'txhex', 'transfer_url', 'transfer_number'],
self:: SCENARIOS_CREATE => ['is_with_draw', 'address', 'txhex', 'transfer_url', 'transfer_number', 'step', 'send_result', 'query_result', 'msg'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
......
#!/bin/bash
while true; do php /data_wallet/bwallet/dev_token_config/yii game-bet/bet-update >> /data_wallet/bwallet/bet-update.log 2>&1; sleep 2; done &
\ No newline at end of file
while true; do php /var/www/html/token_pwallet/yii game-bet/bet-update >> /var/log/bet-update.log 2>&1; sleep 2; done &
\ No newline at end of file
#!/bin/bash
while true; do php /data_wallet/bwallet/dev_token_config/yii game-bet/game-status >> /data_wallet/bwallet/game-status.log 2>&1; sleep 5; done &
\ No newline at end of file
while true; do php /var/www/html/token_pwallet/yii game-bet/game-status >> /var/log/game-status.log 2>&1; sleep 5; done &
\ No newline at end of file
#!/bin/bash
while true; do php /var/www/html/token_pwallet/yii cross-chain/query-transaction >> /var/www/html/query-transaction.log 2>&1; sleep 20; done &
\ No newline at end of file
while true; do php /var/www/html/token_pwallet/yii cross-chain/query-transaction >> /var/www/html/query-transaction.log 2>&1; sleep 5; done &
\ No newline at end of file
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