Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
0730c54b
Commit
0730c54b
authored
Sep 27, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cross_chain' into 'master'
Feature/cross chain See merge request
!134
parents
bba41db2
7bef5cb9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
28 deletions
+59
-28
CrossChainController.php
api/controllers/CrossChainController.php
+23
-22
Zhaobi.php
common/service/exchange/Zhaobi.php
+0
-1
HuobiBuilder.php
common/service/exchange/factory/HuobiBuilder.php
+0
-0
CrossChainController.php
console/controllers/CrossChainController.php
+36
-5
No files found.
api/controllers/CrossChainController.php
View file @
0730c54b
...
...
@@ -82,28 +82,29 @@ class CrossChainController extends BaseController
->
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
{
//
$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
;
...
...
@@ -111,7 +112,7 @@ class CrossChainController extends BaseController
$model
->
msg
=
0
;
$model
->
save
();
continue
;
}
//
}
}
$code
=
0
;
$msg
=
'success'
;
...
...
common/service/exchange/Zhaobi.php
View file @
0730c54b
...
...
@@ -15,7 +15,6 @@ class Zhaobi extends Exchange implements ExchangeInterface
protected
$supported_symbol
=
'supported_symbol_zhaobi'
;
protected
$quotation_prefix
=
'quotation_zhaobi_'
;
protected
$base_url
=
'https://api.biqianbao.top'
;
#protected $base_url = 'https://api.biqianbao.top/api/data/basecoinprice?base=CNY&coin=SFT&platform=zhaobi';
public
function
symbolExists
(
$tag
=
'SFT'
,
$aim
=
"CNY"
)
{
...
...
common/service/exchange/factory/HuobiBuilder.php
View file @
0730c54b
console/controllers/CrossChainController.php
View file @
0730c54b
...
...
@@ -92,12 +92,21 @@ class CrossChainController extends Controller
return
0
;
}
//查询共识高度
//正式环境查询共识高度
//3步交易情况下需要做高度判断,2步交易无须判断
$node_params
=
[
'scheme'
=>
'https'
,
'host'
=>
'jiedian1.bityuan.com'
,
'port'
=>
8801
];
//测试环境查询共识高度
//2步交易情况下需要做高度判断
// $node_params = [
// 'scheme' => 'http',
// 'host' => '172.16.100.77',
// 'port' => 8801
// ];
$service
=
new
Chain33Service
(
$node_params
);
$result
=
$service
->
getHeight
();
$consensHeight
=
$result
[
'result'
][
'consensHeight'
];
...
...
@@ -111,10 +120,11 @@ class CrossChainController extends Controller
'host'
=>
str_replace
(
'//'
,
''
,
$node_params
[
1
]),
'port'
=>
isset
(
$node_params
[
2
])
?
$node_params
[
2
]
:
''
];
$service
=
new
Chain33Service
(
$node_params
);
$send_result
=
$val
[
'send_result'
];
$result
=
$service
->
QueryTransaction
(
$send_result
);
#
$result = $service->QueryTransaction($send_result);
$switch
=
true
;
$result
=
$this
->
queryTransaction
(
$node_params
,
$send_result
);
if
(
isset
(
$result
[
'result'
][
'actionName'
])
&&
'unknown'
==
$result
[
'result'
][
'actionName'
])
{
$redis
->
hdel
(
CoinCrossChain
::
CROSS_CHAIN_CACHE_FAIL
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]);
$query_result
=
'success'
;
...
...
@@ -157,10 +167,10 @@ class CrossChainController extends Controller
doEnd
:
if
(
CoinCrossChain
::
RECHARGE
==
$val
[
'is_with_draw'
]
&&
$val
[
'step'
]
==
2
&&
$switch
&&
isset
(
$height
)
&&
(
$consensHeight
<
$height
))
{
//3步交易情况下需要做高度判断,2步交易注释IF判断
if
(
CoinCrossChain
::
RECHARGE
==
(
int
)
$val
[
'is_with_draw'
]
&&
2
==
(
int
)
$val
[
'step'
]
&&
true
==
$switch
&&
isset
(
$height
)
&&
(
$consensHeight
<
$height
))
{
continue
;
}
$currentModel
=
CoinCrossChain
::
findOne
(
$val
[
'id'
]);
$currentModel
->
query_result
=
$query_result
;
$currentModel
->
msg
=
$msg
;
...
...
@@ -178,4 +188,24 @@ class CrossChainController extends Controller
echo
date
(
'Y-m-d H:i:s'
)
.
'查询完毕'
.
PHP_EOL
;
return
0
;
}
protected
function
queryTransaction
(
$node_params
,
$send_result
)
{
static
$result
=
[];
$service
=
new
Chain33Service
(
$node_params
);
$result
=
$service
->
QueryTransaction
(
$send_result
);
if
(
isset
(
$result
[
'result'
][
'actionName'
])
&&
'unknown'
==
$result
[
'result'
][
'actionName'
])
{
if
(
isset
(
$result
[
'result'
][
'tx'
][
'next'
]))
{
$this
->
queryTransaction
(
$node_params
,
$result
[
'result'
][
'tx'
][
'next'
]);
}
}
if
(
isset
(
$result
[
'result'
][
'receipt'
][
'ty'
])
&&
2
==
$result
[
'result'
][
'receipt'
][
'ty'
]){
if
(
isset
(
$result
[
'result'
][
'tx'
][
'next'
]))
{
$this
->
queryTransaction
(
$node_params
,
$result
[
'result'
][
'tx'
][
'next'
]);
}
}
return
$result
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment