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
f3fa169f
Commit
f3fa169f
authored
Sep 09, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
6cd520d8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
Chain33Service.php
common/service/chain33/Chain33Service.php
+8
-0
CrossChainController.php
console/controllers/CrossChainController.php
+21
-1
No files found.
common/service/chain33/Chain33Service.php
View file @
f3fa169f
...
...
@@ -306,6 +306,14 @@ class Chain33Service
return
$this
->
send
(
$params
,
'Chain33.SendTransaction'
);
}
public
function
getHeight
(
$params
=
[])
{
$params
=
[
"data"
=>
'user.p.game.'
,
];
return
$this
->
send
(
$params
,
'paracross.GetHeight'
);
}
/**
* 获取最新的区块
*/
...
...
console/controllers/CrossChainController.php
View file @
f3fa169f
...
...
@@ -84,6 +84,17 @@ class CrossChainController extends Controller
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无跨链交易计划'
.
PHP_EOL
;
return
0
;
}
//查询共识高度
$node_params
=
[
'scheme'
=>
'https'
,
'host'
=>
'jiedian1.bityuan.com'
,
'port'
=>
8801
];
$service
=
new
Chain33Service
(
$node_params
);
$result
=
$service
->
getHeight
();
$consensHeight
=
$result
[
'result'
][
'consensHeight'
];
$current_time
=
time
();
foreach
(
$model
as
$val
)
{
$node_params
=
$val
[
'transfer_url'
];
...
...
@@ -96,16 +107,18 @@ class CrossChainController extends Controller
$service
=
new
Chain33Service
(
$node_params
);
$send_result
=
$val
[
'send_result'
];
$result
=
$service
->
QueryTransaction
(
$send_result
);
$switch
=
true
;
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'
;
$msg
=
'success'
;
$height
=
isset
(
$result
[
'result'
][
'height'
])
?
$result
[
'result'
][
'height'
]
:
0
;
goto
doEnd
;
}
else
if
(
isset
(
$result
[
'result'
][
'receipt'
][
'ty'
])
&&
2
==
$result
[
'result'
][
'receipt'
][
'ty'
])
{
$redis
->
hdel
(
CoinCrossChain
::
CROSS_CHAIN_CACHE_FAIL
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]);
$query_result
=
'success'
;
$msg
=
'success'
;
$height
=
isset
(
$result
[
'result'
][
'height'
])
?
$result
[
'result'
][
'height'
]
:
0
;
goto
doEnd
;
}
else
{
$cache_error_time
=
$redis
->
hget
(
CoinCrossChain
::
CROSS_CHAIN_CACHE_FAIL
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]);
...
...
@@ -122,6 +135,7 @@ class CrossChainController extends Controller
if
(
-
1
==
$result
[
'code'
])
{
$msg
=
$result
[
'msg'
];
$query_result
=
$result
[
'code'
];
$switch
=
false
;
goto
doEnd
;
}
else
{
$query_result
=
'fail'
;
...
...
@@ -129,11 +143,17 @@ class CrossChainController extends Controller
if
(
is_array
(
$log
[
'log'
]))
continue
;
$msg
=
isset
(
$log
[
'log'
])
?
$log
[
'log'
]
:
'查询错误'
;
}
$switch
=
false
;
goto
doEnd
;
}
}
doEnd
:
if
(
CoinCrossChain
::
RECHARGE
==
$val
[
'is_with_draw'
]
&&
$switch
&&
isset
(
$height
)
&&
(
$consensHeight
<
$height
))
{
continue
;
}
$currentModel
=
CoinCrossChain
::
findOne
(
$val
[
'id'
]);
$currentModel
->
query_result
=
$query_result
;
$currentModel
->
msg
=
$msg
;
...
...
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