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
accc1a5c
Commit
accc1a5c
authored
Sep 17, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into feature/issue_coin
parents
cf53079d
894eb0ac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
416 additions
and
169 deletions
+416
-169
CoinController.php
api/controllers/CoinController.php
+5
-1
CoinDogController.php
api/controllers/CoinDogController.php
+82
-0
CrossChainController.php
api/controllers/CrossChainController.php
+65
-4
GameBetController.php
api/controllers/GameBetController.php
+2
-2
ServiceController.php
api/controllers/ServiceController.php
+41
-36
CoinController.php
backend/controllers/CoinController.php
+2
-2
Curl.php
common/helpers/Curl.php
+0
-0
CoinCrossChain.php
common/models/psources/CoinCrossChain.php
+5
-2
Chain33Service.php
common/service/chain33/Chain33Service.php
+62
-41
CrossChainController.php
console/controllers/CrossChainController.php
+90
-44
GameBetController.php
console/controllers/GameBetController.php
+62
-28
AutoTransfer.sh
shell/AutoTransfer.sh
+0
-3
GameBet.sh
shell/GameBet.sh
+0
-3
QueryTransaction.sh
shell/QueryTransaction.sh
+0
-3
No files found.
api/controllers/CoinController.php
View file @
accc1a5c
...
@@ -131,7 +131,7 @@ class CoinController extends BaseController
...
@@ -131,7 +131,7 @@ class CoinController extends BaseController
if
(
$recommend
)
{
if
(
$recommend
)
{
$condition
[
'recommend'
]
=
$recommend
;
$condition
[
'recommend'
]
=
$recommend
;
}
}
$select
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'optional_name'
,
'nickname'
,
'platform'
,
'chain'
,
'treaty'
];
$select
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'
introduce'
,
'
optional_name'
,
'nickname'
,
'platform'
,
'chain'
,
'treaty'
];
$order_by
=
[
'sort'
=>
SORT_ASC
];
$order_by
=
[
'sort'
=>
SORT_ASC
];
$datas
=
CoinRecommend
::
getList
(
$page
,
$limit
,
$condition
,
$order_by
,
$select
);
$datas
=
CoinRecommend
::
getList
(
$page
,
$limit
,
$condition
,
$order_by
,
$select
);
//获取详细信息
//获取详细信息
...
@@ -143,6 +143,8 @@ class CoinController extends BaseController
...
@@ -143,6 +143,8 @@ class CoinController extends BaseController
foreach
(
$coin_infos
as
$key
=>
&
$val
)
{
foreach
(
$coin_infos
as
$key
=>
&
$val
)
{
$nickname
=
json_decode
(
$val
[
'nickname'
],
true
);
$nickname
=
json_decode
(
$val
[
'nickname'
],
true
);
$val
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$val
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$introduce
=
json_decode
(
$val
[
'introduce'
],
true
);
$val
[
'introduce'
]
=
$introduce
[
$this
->
lang
];
}
}
//获取行情信息
//获取行情信息
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
...
@@ -243,7 +245,9 @@ class CoinController extends BaseController
...
@@ -243,7 +245,9 @@ class CoinController extends BaseController
}
}
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$introduce
=
json_decode
(
$value
[
'introduce'
],
true
);
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$value
[
'introduce'
]
=
$introduce
[
$this
->
lang
];
$value
[
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
$value
[
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
$value
[
'chain_rmb'
]
=
isset
(
$value
[
'chain_quotation'
][
'rmb'
])
?
$value
[
'chain_quotation'
][
'rmb'
]
:
0
;
$value
[
'chain_rmb'
]
=
isset
(
$value
[
'chain_quotation'
][
'rmb'
])
?
$value
[
'chain_quotation'
][
'rmb'
]
:
0
;
$value
[
'chain_usd'
]
=
isset
(
$value
[
'chain_quotation'
][
'usd'
])
?
$value
[
'chain_quotation'
][
'usd'
]
:
0
;
$value
[
'chain_usd'
]
=
isset
(
$value
[
'chain_quotation'
][
'usd'
])
?
$value
[
'chain_quotation'
][
'usd'
]
:
0
;
...
...
api/controllers/CoinDogController.php
0 → 100644
View file @
accc1a5c
<?php
namespace
api\controllers
;
use
linslin\yii2\curl\Curl
;
use
Yii
;
use
api\base\BaseController
;
class
CoinDogController
extends
BaseController
{
public
function
actionArticle
()
{
$coindog
=
Yii
::
$app
->
params
[
'coindog'
];
$accessKey
=
$coindog
[
'accessKey'
];
$secretKey
=
$coindog
[
'secretKey'
];
$httpParams
=
array
(
'access_key'
=>
$accessKey
,
'date'
=>
time
()
);
$signParams
=
array_merge
(
$httpParams
,
array
(
'secret_key'
=>
$secretKey
));
ksort
(
$signParams
);
$signString
=
http_build_query
(
$signParams
);
$httpParams
[
'sign'
]
=
strtolower
(
md5
(
$signString
));
$url
=
$coindog
[
'article'
]
.
'?'
.
http_build_query
(
$httpParams
);
$curl
=
new
Curl
();
$resp
=
$curl
->
get
(
$url
,
false
);
return
[
'code'
=>
200
,
'data'
=>
$resp
,
'msg'
=>
'ok'
];
}
public
function
actionLive
()
{
$limit
=
Yii
::
$app
->
request
->
get
(
'limit'
,
20
);
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
$flag
=
Yii
::
$app
->
request
->
get
(
'flag'
,
'down'
);
$coindog
=
Yii
::
$app
->
params
[
'coindog'
];
$accessKey
=
$coindog
[
'accessKey'
];
$secretKey
=
$coindog
[
'secretKey'
];
$httpParams
=
array
(
'access_key'
=>
$accessKey
,
'date'
=>
time
()
);
$signParams
=
array_merge
(
$httpParams
,
array
(
'secret_key'
=>
$secretKey
));
ksort
(
$signParams
);
$signString
=
http_build_query
(
$signParams
);
$httpParams
=
[
'sign'
=>
strtolower
(
md5
(
$signString
)),
'limit'
=>
$limit
,
'id'
=>
$id
,
'flag'
=>
$flag
];
$url
=
$coindog
[
'live'
]
.
'?'
.
http_build_query
(
$httpParams
);
$curl
=
new
Curl
();
$resp
=
$curl
->
get
(
$url
,
false
);
if
(
!
isset
(
$resp
[
'list'
]))
{
$msg
=
'数据不存在'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$list
=
$resp
[
'list'
][
0
][
'lives'
];
foreach
(
$list
as
&
$item
)
{
preg_match_all
(
"/\【(.+?)\】/"
,
$item
[
'content'
],
$match
);
$item
[
'title'
]
=
$match
[
1
][
0
];
}
$code
=
0
;
$msg
=
'success'
;
doEnd
:
return
[
'code'
=>
$code
,
'data'
=>
$list
,
'msg'
=>
$msg
];
}
}
\ No newline at end of file
api/controllers/CrossChainController.php
View file @
accc1a5c
...
@@ -51,6 +51,8 @@ class CrossChainController extends BaseController
...
@@ -51,6 +51,8 @@ class CrossChainController extends BaseController
$model
=
new
CoinCrossChain
();
$model
=
new
CoinCrossChain
();
$data
[
'txhex'
]
=
$val
[
'tx'
];
$data
[
'txhex'
]
=
$val
[
'tx'
];
$data
[
'transfer_url'
]
=
$val
[
'url'
];
$data
[
'transfer_url'
]
=
$val
[
'url'
];
$data
[
'step'
]
=
$val
[
'step'
];
$data
[
'amount'
]
=
isset
(
$val
[
'amount'
])
?
$val
[
'amount'
]
:
0
;
$model
->
load
(
$data
,
''
);
$model
->
load
(
$data
,
''
);
$model
->
save
();
$model
->
save
();
}
}
...
@@ -61,12 +63,68 @@ class CrossChainController extends BaseController
...
@@ -61,12 +63,68 @@ class CrossChainController extends BaseController
return
[
'code'
=>
$code
,
'msg'
=>
$msg
];
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
()
public
function
actionTransferStatus
()
{
{
$code
=
-
1
;
$code
=
-
1
;
$msg
=
'fail'
;
$msg
=
'fail'
;
$data
=
null
;
$data
=
null
;
$step
=
0
;
$step
=
$amount
=
0
;
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
if
(
!
$request
->
isGet
)
{
if
(
!
$request
->
isGet
)
{
$msg
=
'请求错误!'
;
$msg
=
'请求错误!'
;
...
@@ -83,11 +141,13 @@ class CrossChainController extends BaseController
...
@@ -83,11 +141,13 @@ class CrossChainController extends BaseController
$model
=
CoinCrossChain
::
find
()
->
where
([
'address'
=>
$address
,
'is_with_draw'
=>
$is_with_draw
])
->
orderBy
(
"id desc"
)
->
limit
(
3
)
->
asArray
()
->
all
();
$model
=
CoinCrossChain
::
find
()
->
where
([
'address'
=>
$address
,
'is_with_draw'
=>
$is_with_draw
])
->
orderBy
(
"id desc"
)
->
limit
(
3
)
->
asArray
()
->
all
();
if
(
empty
(
$model
))
{
if
(
empty
(
$model
))
{
$msg
=
'数据不存在!'
;
$msg
=
'数据不存在!'
;
$code
=
0
;
goto
doEnd
;
goto
doEnd
;
}
}
sort
(
$model
);
sort
(
$model
);
foreach
(
$model
as
$key
=>
$val
)
{
foreach
(
$model
as
$key
=>
$val
)
{
$amount
=
$val
[
'amount'
];
//未交易
//未交易
if
(
'0'
==
$val
[
'send_result'
]
&&
'0'
==
$val
[
'query_result'
]
&&
'0'
==
$val
[
'msg'
])
{
if
(
'0'
==
$val
[
'send_result'
]
&&
'0'
==
$val
[
'query_result'
]
&&
'0'
==
$val
[
'msg'
])
{
$step
=
$key
+
1
;
$step
=
$key
+
1
;
...
@@ -111,7 +171,7 @@ class CrossChainController extends BaseController
...
@@ -111,7 +171,7 @@ class CrossChainController extends BaseController
goto
doEnd
;
goto
doEnd
;
}
}
//交易成功,查询失败
//交易成功,查询失败
if
(
true
==
$val
[
'send_result'
]
&&
'
fail'
=
=
$val
[
'query_result'
])
{
if
(
true
==
$val
[
'send_result'
]
&&
'
success'
!
=
$val
[
'query_result'
])
{
$step
=
$key
+
1
;
$step
=
$key
+
1
;
$code
=
-
1
;
$code
=
-
1
;
$msg
=
$val
[
'msg'
];
$msg
=
$val
[
'msg'
];
...
@@ -119,7 +179,7 @@ class CrossChainController extends BaseController
...
@@ -119,7 +179,7 @@ class CrossChainController extends BaseController
}
}
//交易成功,查询成功
//交易成功,查询成功
if
(
true
==
$val
[
'send_result'
]
&&
'success'
==
$val
[
'query_result'
]
&&
'success'
==
$val
[
'msg'
])
{
if
(
true
==
$val
[
'send_result'
]
&&
'success'
==
$val
[
'query_result'
]
&&
'success'
==
$val
[
'msg'
])
{
if
(
2
==
$key
){
if
(
2
==
$key
)
{
$step
=
(
2
==
$key
)
?
4
:
(
$key
+
2
);
$step
=
(
2
==
$key
)
?
4
:
(
$key
+
2
);
$code
=
0
;
$code
=
0
;
$msg
=
$val
[
'send_result'
];
$msg
=
$val
[
'send_result'
];
...
@@ -131,7 +191,8 @@ class CrossChainController extends BaseController
...
@@ -131,7 +191,8 @@ class CrossChainController extends BaseController
doEnd
:
doEnd
:
$data
=
[
$data
=
[
'step'
=>
$step
'step'
=>
$step
,
'amount'
=>
(
int
)
$amount
];
];
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
...
...
api/controllers/GameBetController.php
View file @
accc1a5c
...
@@ -23,10 +23,10 @@ class GameBetController extends BaseController
...
@@ -23,10 +23,10 @@ class GameBetController extends BaseController
}
}
$query
=
CoinGameBet
::
find
()
$query
=
CoinGameBet
::
find
()
->
select
(
'round, player, amount, height, guess_num,
guess_num
, rand_num, player_win, platform'
)
->
select
(
'round, player, amount, height, guess_num,
valid
, rand_num, player_win, platform'
)
->
where
(
'player= :player'
,[
':player'
=>
$player
])
->
where
(
'player= :player'
,[
':player'
=>
$player
])
->
andWhere
([
'platform'
=>
$platform
])
->
andWhere
([
'platform'
=>
$platform
])
#
->andWhere(['valid' => CoinGameBet::VAILD_TRUE])
//
->andWhere(['valid' => CoinGameBet::VAILD_TRUE])
->
orderBy
(
'update_time desc'
);
->
orderBy
(
'update_time desc'
);
$count
=
$query
->
count
();
$count
=
$query
->
count
();
...
...
api/controllers/ServiceController.php
View file @
accc1a5c
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
* Date: 2018/12/29
* Date: 2018/12/29
* Time: 16:26
* Time: 16:26
*/
*/
namespace
api\controllers
;
namespace
api\controllers
;
use
api\base\BaseController
;
use
api\base\BaseController
;
...
@@ -33,23 +34,23 @@ class ServiceController extends BaseController
...
@@ -33,23 +34,23 @@ class ServiceController extends BaseController
public
function
actionCoinTickers
()
public
function
actionCoinTickers
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$coinItems
=
$request
->
post
(
'names'
);
$coinItems
=
$request
->
post
(
'names'
);
if
(
!
$coinItems
)
{
if
(
!
$coinItems
)
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'币种不能为空'
];
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'币种不能为空'
];
}
}
if
(
!
is_array
(
$coinItems
))
{
if
(
!
is_array
(
$coinItems
))
{
$coinItems
=
[
$coinItems
];
$coinItems
=
[
$coinItems
];
}
}
$tol_coins
=
[
'ETC'
];
$tol_coins
=
[
'ETC'
];
$tickerData
=
[];
$tickerData
=
[];
if
(
$coinItems
)
{
if
(
$coinItems
)
{
foreach
(
$coinItems
as
$item
)
{
foreach
(
$coinItems
as
$item
)
{
$item
=
strtoupper
(
$item
);
$item
=
strtoupper
(
$item
);
if
(
in_array
(
$item
,
$tol_coins
))
{
if
(
in_array
(
$item
,
$tol_coins
))
{
$exchange
=
ExchangeFactory
::
createExchange
(
'HuoBi'
);
$exchange
=
ExchangeFactory
::
createExchange
(
'HuoBi'
);
if
(
$exchange
->
symbolExists
(
$item
))
{
if
(
$exchange
->
symbolExists
(
$item
))
{
$quotation
=
$exchange
->
getTicker
(
$item
);
$quotation
=
$exchange
->
getTicker
(
$item
);
if
(
$quotation
)
{
if
(
$quotation
)
{
//格式化行情数据
//格式化行情数据
foreach
(
$quotation
as
$key
=>
$value
)
{
foreach
(
$quotation
as
$key
=>
$value
)
{
$quotation
[
$key
]
=
(
float
)
sprintf
(
"%0.4f"
,
(
double
)
$value
);
$quotation
[
$key
]
=
(
float
)
sprintf
(
"%0.4f"
,
(
double
)
$value
);
...
@@ -58,30 +59,34 @@ class ServiceController extends BaseController
...
@@ -58,30 +59,34 @@ class ServiceController extends BaseController
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$rate
*
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$rate
*
$quotation
[
'last'
]);
}
}
}
}
}
else
{
}
else
{
$quotation
=
ExchangeBusiness
::
getquatation
(
$item
);
$quotation
=
ExchangeBusiness
::
getquatation
(
$item
);
}
}
if
(
!
$quotation
)
{
if
(
!
$quotation
)
{
//使用Coin服务
//使用Coin服务
try
{
try
{
$coinServer
=
CoinFactory
::
createCoin
(
$item
,
''
,
''
);
$coinServer
=
CoinFactory
::
createCoin
(
$item
,
''
,
''
);
$tickerData
[
$item
][
'rmb'
]
=
$coinServer
->
getPrice
();
$tickerData
[
$item
][
'rmb'
]
=
$coinServer
->
getPrice
();
$tickerData
[
$item
][
'last'
]
=
$coinServer
->
getDollar
();
$tickerData
[
$item
][
'last'
]
=
$coinServer
->
getDollar
();
$tickerData
[
$item
][
'low'
]
=
$coinServer
->
getLow
();
$tickerData
[
$item
][
'low'
]
=
$coinServer
->
getLow
();
$tickerData
[
$item
][
'high'
]
=
$coinServer
->
getHigh
();
$tickerData
[
$item
][
'high'
]
=
$coinServer
->
getHigh
();
$tickerData
[
$item
][
'open'
]
=
$coinServer
->
getDollar
();
$tickerData
[
$item
][
'usd'
]
=
$coinServer
->
getDollar
();
$coinServer
->
__destruct
();
$coinServer
->
__destruct
();
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
$tickerData
[
$item
][
'rmb'
]
=
0
;
$tickerData
[
$item
][
'rmb'
]
=
0
;
$tickerData
[
$item
][
'last'
]
=
0
;
$tickerData
[
$item
][
'last'
]
=
0
;
$tickerData
[
$item
][
'low'
]
=
0
;
$tickerData
[
$item
][
'low'
]
=
0
;
$tickerData
[
$item
][
'high'
]
=
0
;
$tickerData
[
$item
][
'high'
]
=
0
;
$tickerData
[
$item
][
'open'
]
=
0
;
$tickerData
[
$item
][
'usd'
]
=
0
;
\Yii
::
error
(
$exception
->
getMessage
());
\Yii
::
error
(
$exception
->
getMessage
());
}
}
}
else
{
}
else
{
$tickerData
[
$item
]
=
$quotation
;
$tickerData
[
$item
]
=
$quotation
;
}
}
}
}
return
[
'code'
=>
0
,
'data'
=>
$tickerData
,
'msg'
=>
'行情获取成功'
];
return
[
'code'
=>
0
,
'data'
=>
$tickerData
,
'msg'
=>
'行情获取成功'
];
}
}
}
}
...
@@ -94,13 +99,13 @@ class ServiceController extends BaseController
...
@@ -94,13 +99,13 @@ class ServiceController extends BaseController
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
6
);
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
6
);
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
1
);
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
1
);
$coin_recommendItems
=
$this
->
coinRecommendList
(
$platform_id
,
$type
);
$coin_recommendItems
=
$this
->
coinRecommendList
(
$platform_id
,
$type
);
$fields
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'nickname'
,
'chain'
,
'platform'
];
$fields
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'nickname'
,
'chain'
,
'platform'
];
$rows
=
Coin
::
getSelectList
(
1
,
999
,
$fields
,[[
'in'
,
'id'
,
$coin_recommendItems
]]);
$rows
=
Coin
::
getSelectList
(
1
,
999
,
$fields
,
[[
'in'
,
'id'
,
$coin_recommendItems
]]);
foreach
(
$rows
[
'data'
]
as
$key
=>
&
$value
)
{
foreach
(
$rows
[
'data'
]
as
$key
=>
&
$value
)
{
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
}
}
return
[
'code'
=>
0
,
'data'
=>
$rows
,
'msg'
=>
'币种列表获取成功'
];
return
[
'code'
=>
0
,
'data'
=>
$rows
,
'msg'
=>
'币种列表获取成功'
];
}
}
/**
/**
...
@@ -109,9 +114,9 @@ class ServiceController extends BaseController
...
@@ -109,9 +114,9 @@ class ServiceController extends BaseController
*/
*/
private
function
coinRecommendList
(
$platform_id
,
$type
=
1
)
private
function
coinRecommendList
(
$platform_id
,
$type
=
1
)
{
{
$recommend_list
=
CoinRecommend
::
find
()
->
select
(
'cid'
)
->
where
([
'platform_id'
=>
$platform_id
,
'type'
=>
$type
])
->
all
();
$recommend_list
=
CoinRecommend
::
find
()
->
select
(
'cid'
)
->
where
([
'platform_id'
=>
$platform_id
,
'type'
=>
$type
])
->
all
();
if
(
$recommend_list
)
{
if
(
$recommend_list
)
{
$coin_ids
=
array_column
(
$recommend_list
,
'cid'
);
$coin_ids
=
array_column
(
$recommend_list
,
'cid'
);
return
$coin_ids
;
return
$coin_ids
;
}
}
return
[];
return
[];
...
@@ -124,15 +129,15 @@ class ServiceController extends BaseController
...
@@ -124,15 +129,15 @@ class ServiceController extends BaseController
public
function
actionFee
()
public
function
actionFee
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$coin
=
$request
->
post
(
'name'
);
$coin
=
$request
->
post
(
'name'
);
if
(
!
$coin
)
{
if
(
!
$coin
)
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'币种不能为空'
];
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'币种不能为空'
];
}
}
$fee
=
MinerFee
::
find
()
->
where
([
'platform'
=>
$coin
,
'type'
=>
2
])
->
select
(
'id,platform,type,fee,create_at,update_at'
)
->
asArray
()
->
one
();
$fee
=
MinerFee
::
find
()
->
where
([
'platform'
=>
$coin
,
'type'
=>
2
])
->
select
(
'id,platform,type,fee,create_at,update_at'
)
->
asArray
()
->
one
();
if
(
!
$fee
)
{
if
(
!
$fee
)
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'旷工费未设置'
];
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'旷工费未设置'
];
}
}
return
[
'code'
=>
0
,
'data'
=>
$fee
,
'msg'
=>
'旷工费获取成功'
];
return
[
'code'
=>
0
,
'data'
=>
$fee
,
'msg'
=>
'旷工费获取成功'
];
}
}
/**
/**
...
@@ -141,8 +146,8 @@ class ServiceController extends BaseController
...
@@ -141,8 +146,8 @@ class ServiceController extends BaseController
*/
*/
private
function
getRate
()
private
function
getRate
()
{
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Bty"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Bty"
);
$rate
=
$exchange
->
getTicker
(
"BTY"
,
"USDT"
);
$rate
=
$exchange
->
getTicker
(
"BTY"
,
"USDT"
);
return
(
float
)
$rate
[
'rmb'
]
/
$rate
[
'last'
];
return
(
float
)
$rate
[
'rmb'
]
/
$rate
[
'last'
];
}
}
...
@@ -153,12 +158,12 @@ class ServiceController extends BaseController
...
@@ -153,12 +158,12 @@ class ServiceController extends BaseController
public
function
actionChain
()
public
function
actionChain
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$currency
=
$request
->
post
(
'currency'
,
''
);
$currency
=
$request
->
post
(
'currency'
,
''
);
$coin
=
Coin
::
find
()
->
where
([
'name'
=>
$currency
])
->
select
(
'name,nickname,chain'
)
->
asArray
()
->
one
();
$coin
=
Coin
::
find
()
->
where
([
'name'
=>
$currency
])
->
select
(
'name,nickname,chain'
)
->
asArray
()
->
one
();
if
(
$coin
)
{
if
(
$coin
)
{
return
[
'code'
=>
0
,
'data'
=>
$coin
];
return
[
'code'
=>
0
,
'data'
=>
$coin
];
}
}
return
[
'code'
=>
-
1
,
'msg'
=>
'币种不存在'
];
return
[
'code'
=>
-
1
,
'msg'
=>
'币种不存在'
];
}
}
}
}
backend/controllers/CoinController.php
View file @
accc1a5c
...
@@ -92,7 +92,7 @@ class CoinController extends BaseController
...
@@ -92,7 +92,7 @@ class CoinController extends BaseController
if
(
isset
(
$data
[
'optional_name'
]))
{
if
(
isset
(
$data
[
'optional_name'
]))
{
$data
[
'optional_name'
]
=
strtoupper
(
$data
[
'optional_name'
]);
$data
[
'optional_name'
]
=
strtoupper
(
$data
[
'optional_name'
]);
}
}
$data
[
'name'
]
=
strtoupper
(
$data
[
'name'
]
);
$data
[
'name'
]
=
strtoupper
(
trim
(
$data
[
'name'
])
);
$data
[
'platform'
]
=
strtolower
(
$data
[
'platform'
]);
$data
[
'platform'
]
=
strtolower
(
$data
[
'platform'
]);
$data
[
'chain'
]
=
strtoupper
(
$data
[
'chain'
]);
$data
[
'chain'
]
=
strtoupper
(
$data
[
'chain'
]);
$lang
=
[
$lang
=
[
...
@@ -105,7 +105,7 @@ class CoinController extends BaseController
...
@@ -105,7 +105,7 @@ class CoinController extends BaseController
$nickname
=
[];
$nickname
=
[];
$introduce
=
[];
$introduce
=
[];
foreach
(
$nickname_arr
as
$key
=>
$val
)
{
foreach
(
$nickname_arr
as
$key
=>
$val
)
{
$nickname
[
$lang
[
$key
]]
=
$val
;
$nickname
[
$lang
[
$key
]]
=
trim
(
$val
)
;
}
}
foreach
(
$introduce_arr
as
$key
=>
$val
)
{
foreach
(
$introduce_arr
as
$key
=>
$val
)
{
$introduce
[
$lang
[
$key
]]
=
$val
;
$introduce
[
$lang
[
$key
]]
=
$val
;
...
...
common/helpers/Curl.php
View file @
accc1a5c
This diff is collapsed.
Click to expand it.
common/models/psources/CoinCrossChain.php
View file @
accc1a5c
...
@@ -10,6 +10,9 @@ class CoinCrossChain extends BaseActiveRecord
...
@@ -10,6 +10,9 @@ class CoinCrossChain extends BaseActiveRecord
const
WITHDRAW
=
0
;
const
WITHDRAW
=
0
;
const
RECHARGE
=
1
;
const
RECHARGE
=
1
;
const
CROSS_CHAIN_TRANSFERING
=
'cross_chain_transfering'
;
const
CROSS_CHAIN_CACHE_FAIL
=
'cross_chain_fail'
;
public
static
function
getDb
()
public
static
function
getDb
()
{
{
return
Yii
::
$app
->
get
(
'p_sources'
);
return
Yii
::
$app
->
get
(
'p_sources'
);
...
@@ -28,14 +31,14 @@ class CoinCrossChain extends BaseActiveRecord
...
@@ -28,14 +31,14 @@ class CoinCrossChain extends BaseActiveRecord
{
{
return
[
return
[
[[
'is_with_draw'
,
'address'
,
'txhex'
,
'transfer_url'
],
'required'
],
[[
'is_with_draw'
,
'address'
,
'txhex'
,
'transfer_url'
],
'required'
],
[
'transfer_number'
,
'safe'
]
[
[
'transfer_number'
,
'amount'
,
'step'
,
'send_result'
,
'query_result'
,
'msg'
]
,
'safe'
]
];
];
}
}
public
function
scenarios
()
public
function
scenarios
()
{
{
$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'
,
'amount'
,
'step'
,
'send_result'
,
'query_result'
,
'msg'
],
];
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
}
...
...
common/service/chain33/Chain33Service.php
View file @
accc1a5c
...
@@ -20,7 +20,7 @@ class Chain33Service
...
@@ -20,7 +20,7 @@ class Chain33Service
public
function
__construct
(
$parameter
=
[])
public
function
__construct
(
$parameter
=
[])
{
{
if
(
empty
(
$parameter
))
{
if
(
empty
(
$parameter
))
{
$this
->
node_params
=
Yii
::
$app
->
params
[
'chain33'
];
$this
->
node_params
=
Yii
::
$app
->
params
[
'chain33'
];
}
else
{
}
else
{
$this
->
node_params
=
$parameter
;
$this
->
node_params
=
$parameter
;
...
@@ -31,8 +31,8 @@ class Chain33Service
...
@@ -31,8 +31,8 @@ class Chain33Service
{
{
$config
=
$this
->
node_params
;
$config
=
$this
->
node_params
;
$scheme
=
$config
[
'scheme'
]
??
'http'
;
$scheme
=
$config
[
'scheme'
]
??
'http'
;
$host
=
$config
[
'host'
]
??
'127.0.0.1'
;
$host
=
$config
[
'host'
]
??
'127.0.0.1'
;
$port
=
(
string
)
$config
[
'port'
]
??
''
;
$port
=
(
string
)
$config
[
'port'
]
??
''
;
if
(
$port
)
{
if
(
$port
)
{
return
$scheme
.
'://'
.
$host
.
':'
.
$port
;
return
$scheme
.
'://'
.
$host
.
':'
.
$port
;
}
else
{
}
else
{
...
@@ -44,9 +44,9 @@ class Chain33Service
...
@@ -44,9 +44,9 @@ class Chain33Service
{
{
$data
=
[
$data
=
[
'jsonrpc'
=>
'2.0'
,
'jsonrpc'
=>
'2.0'
,
'id'
=>
0
,
'id'
=>
0
,
'method'
=>
$method
,
'method'
=>
$method
,
'params'
=>
[],
'params'
=>
[],
];
];
if
(
!
empty
(
$params
))
{
if
(
!
empty
(
$params
))
{
$data
[
'params'
][]
=
$params
;
$data
[
'params'
][]
=
$params
;
...
@@ -56,7 +56,11 @@ class Chain33Service
...
@@ -56,7 +56,11 @@ class Chain33Service
public
function
send
(
$params
=
[],
$method
=
'Chain33.Query'
)
public
function
send
(
$params
=
[],
$method
=
'Chain33.Query'
)
{
{
$ch
=
new
Curl
();
$timeout
=
[
'connect_timeout'
=>
50000
,
'timeout_ms'
=>
40000
];
$ch
=
new
Curl
(
$timeout
);
$jsonrpc
=
self
::
jsonRpcBuild
(
$params
,
$method
);
$jsonrpc
=
self
::
jsonRpcBuild
(
$params
,
$method
);
$ch
->
setHeader
(
'Content-Type'
,
'application/json'
);
$ch
->
setHeader
(
'Content-Type'
,
'application/json'
);
$ch
->
setRawPostData
(
$jsonrpc
);
$ch
->
setRawPostData
(
$jsonrpc
);
...
@@ -124,7 +128,7 @@ class Chain33Service
...
@@ -124,7 +128,7 @@ class Chain33Service
* 获取地址下的所有token资产
* 获取地址下的所有token资产
*
*
* @param string|array $address
* @param string|array $address
* @param string
$symbol
* @param string $symbol
* @return array
* @return array
*/
*/
public
function
getAccountTokenAssets
(
$address
,
$symbol
)
public
function
getAccountTokenAssets
(
$address
,
$symbol
)
...
@@ -133,8 +137,8 @@ class Chain33Service
...
@@ -133,8 +137,8 @@ class Chain33Service
$address
=
[
$address
];
$address
=
[
$address
];
}
}
$params
=
[
$params
=
[
"addresses"
=>
$address
,
"addresses"
=>
$address
,
"execer"
=>
"user.p.guodun.token"
,
"execer"
=>
"user.p.guodun.token"
,
"tokenSymbol"
=>
$symbol
"tokenSymbol"
=>
$symbol
];
];
return
$this
->
send
(
$params
,
'token.GetTokenBalance'
);
return
$this
->
send
(
$params
,
'token.GetTokenBalance'
);
...
@@ -147,18 +151,18 @@ class Chain33Service
...
@@ -147,18 +151,18 @@ class Chain33Service
* @param $to
* @param $to
* @param $amount
* @param $amount
* @param string $note
* @param string $note
* @param bool
$isToken
* @param bool $isToken
* @param string $tokenSymbol
* @param string $tokenSymbol
* @return array
* @return array
*/
*/
public
function
extractToken
(
$from
,
$to
,
$amount
,
$note
=
''
,
$isToken
=
true
,
$tokenSymbol
=
''
)
public
function
extractToken
(
$from
,
$to
,
$amount
,
$note
=
''
,
$isToken
=
true
,
$tokenSymbol
=
''
)
{
{
$params
=
[
$params
=
[
"from"
=>
$to
,
"from"
=>
$to
,
"to"
=>
$from
,
"to"
=>
$from
,
"amount"
=>
-
$amount
,
"amount"
=>
-
$amount
,
"note"
=>
$note
,
"note"
=>
$note
,
"isToken"
=>
$isToken
?
true
:
false
,
"isToken"
=>
$isToken
?
true
:
false
,
"tokenSymbol"
=>
strtoupper
(
$tokenSymbol
)
"tokenSymbol"
=>
strtoupper
(
$tokenSymbol
)
];
];
return
$this
->
send
(
$params
,
'Chain33.SendToAddress'
);
return
$this
->
send
(
$params
,
'Chain33.SendToAddress'
);
...
@@ -171,18 +175,18 @@ class Chain33Service
...
@@ -171,18 +175,18 @@ class Chain33Service
* @param $to
* @param $to
* @param $amount
* @param $amount
* @param string $note
* @param string $note
* @param bool
$isToken
* @param bool $isToken
* @param string $tokenSymbol
* @param string $tokenSymbol
* @return array
* @return array
*/
*/
public
function
transToken
(
$from
,
$to
,
$amount
,
$note
=
''
,
$isToken
=
true
,
$tokenSymbol
=
''
)
public
function
transToken
(
$from
,
$to
,
$amount
,
$note
=
''
,
$isToken
=
true
,
$tokenSymbol
=
''
)
{
{
$params
=
[
$params
=
[
"from"
=>
$from
,
"from"
=>
$from
,
"to"
=>
$to
,
"to"
=>
$to
,
"amount"
=>
$amount
,
"amount"
=>
$amount
,
"note"
=>
$note
,
"note"
=>
$note
,
"isToken"
=>
$isToken
?
true
:
false
,
"isToken"
=>
$isToken
?
true
:
false
,
"tokenSymbol"
=>
strtoupper
(
$tokenSymbol
)
"tokenSymbol"
=>
strtoupper
(
$tokenSymbol
)
];
];
return
$this
->
send
(
$params
,
'Chain33.SendToAddress'
);
return
$this
->
send
(
$params
,
'Chain33.SendToAddress'
);
...
@@ -191,25 +195,25 @@ class Chain33Service
...
@@ -191,25 +195,25 @@ class Chain33Service
public
function
createTokenRawTransaction
(
$to
,
$amount
,
$isToken
,
$tokenSymbol
,
$fee
,
$note
,
$execer
)
public
function
createTokenRawTransaction
(
$to
,
$amount
,
$isToken
,
$tokenSymbol
,
$fee
,
$note
,
$execer
)
{
{
$params
=
[
$params
=
[
"to"
=>
$to
,
"to"
=>
$to
,
"amount"
=>
$amount
,
"amount"
=>
$amount
,
"isToken"
=>
$isToken
,
"isToken"
=>
$isToken
,
"tokenSymbol"
=>
$tokenSymbol
,
"tokenSymbol"
=>
$tokenSymbol
,
"fee"
=>
$fee
,
"fee"
=>
$fee
,
"note"
=>
$note
,
"note"
=>
$note
,
"execer"
=>
$execer
,
"execer"
=>
$execer
,
];
];
return
$this
->
send
(
$params
,
'Chain33.CreateRawTransaction'
);
return
$this
->
send
(
$params
,
'Chain33.CreateRawTransaction'
);
}
}
public
function
createRawTransaction
(
$to
,
$amount
,
$fee
,
$note
,
$execer
)
public
function
createRawTransaction
(
$to
,
$amount
,
$fee
,
$note
,
$execer
)
{
{
$params
=
[
$params
=
[
"to"
=>
$to
,
"to"
=>
$to
,
"amount"
=>
$amount
,
"amount"
=>
$amount
,
"fee"
=>
$fee
,
"fee"
=>
$fee
,
"note"
=>
$note
,
"note"
=>
$note
,
"execer"
=>
$execer
,
"execer"
=>
$execer
,
];
];
...
@@ -274,11 +278,11 @@ class Chain33Service
...
@@ -274,11 +278,11 @@ class Chain33Service
public
function
structureTrade
(
$amount
,
$execName
,
$fee
,
$isToken
=
True
,
$to
,
$tokenSymbol
=
''
)
public
function
structureTrade
(
$amount
,
$execName
,
$fee
,
$isToken
=
True
,
$to
,
$tokenSymbol
=
''
)
{
{
$params
=
[
$params
=
[
"amount"
=>
$amount
,
"amount"
=>
$amount
,
"execName"
=>
$execName
,
"execName"
=>
$execName
,
"fee"
=>
$fee
,
"fee"
=>
$fee
,
"isToken"
=>
$isToken
?
true
:
false
,
"isToken"
=>
$isToken
?
true
:
false
,
"to"
=>
$to
,
"to"
=>
$to
,
"tokenSymbol"
=>
strtoupper
(
$tokenSymbol
)
"tokenSymbol"
=>
strtoupper
(
$tokenSymbol
)
];
];
return
$this
->
send
(
$params
,
'Chain33.CreateRawTransaction'
);
return
$this
->
send
(
$params
,
'Chain33.CreateRawTransaction'
);
...
@@ -287,21 +291,38 @@ class Chain33Service
...
@@ -287,21 +291,38 @@ class Chain33Service
public
function
signTrade
(
$addr
,
$expire
=
'2h'
,
$txHex
)
public
function
signTrade
(
$addr
,
$expire
=
'2h'
,
$txHex
)
{
{
$params
=
[
$params
=
[
"addr"
=>
$addr
,
"addr"
=>
$addr
,
"expire"
=>
$expire
,
"expire"
=>
$expire
,
"txHex"
=>
$txHex
"txHex"
=>
$txHex
];
];
return
$this
->
send
(
$params
,
'Chain33.SignRawTx'
);
return
$this
->
send
(
$params
,
'Chain33.SignRawTx'
);
}
}
public
function
getBlock2MainInfo
(
$start
,
$end
)
{
$params
=
[
"Start"
=>
$start
,
"End"
=>
$end
,
];
return
$this
->
send
(
$params
,
'paracross.GetBlock2MainInfo'
);
}
public
function
sendTrade
(
$data
)
public
function
sendTrade
(
$data
)
{
{
$params
=
[
$params
=
[
"data"
=>
$data
,
"data"
=>
$data
,
];
];
return
$this
->
send
(
$params
,
'Chain33.SendTransaction'
);
return
$this
->
send
(
$params
,
'Chain33.SendTransaction'
);
}
}
public
function
getHeight
(
$params
=
[])
{
$params
=
[
"data"
=>
'user.p.game.'
,
];
return
$this
->
send
(
$params
,
'paracross.GetHeight'
);
}
/**
/**
* 获取最新的区块
* 获取最新的区块
*/
*/
...
@@ -329,12 +350,12 @@ class Chain33Service
...
@@ -329,12 +350,12 @@ class Chain33Service
public
function
getTxByAddr
(
$addr
,
$flag
,
$count
,
$direction
,
$height
,
$index
)
public
function
getTxByAddr
(
$addr
,
$flag
,
$count
,
$direction
,
$height
,
$index
)
{
{
$params
=
[
$params
=
[
'addr'
=>
$addr
,
'addr'
=>
$addr
,
'flag'
=>
$flag
,
'flag'
=>
$flag
,
'count'
=>
$count
,
'count'
=>
$count
,
'direction'
=>
$direction
,
'direction'
=>
$direction
,
'height'
=>
$height
,
'height'
=>
$height
,
'index'
=>
$index
'index'
=>
$index
];
];
return
$this
->
send
(
$params
,
'Chain33.GetTxByAddr'
);
return
$this
->
send
(
$params
,
'Chain33.GetTxByAddr'
);
}
}
...
@@ -359,9 +380,9 @@ class Chain33Service
...
@@ -359,9 +380,9 @@ class Chain33Service
public
function
unLockWallet
(
$password
)
public
function
unLockWallet
(
$password
)
{
{
$params
=
[
$params
=
[
'passwd'
=>
$password
,
'passwd'
=>
$password
,
'walletorticket'
=>
false
,
'walletorticket'
=>
false
,
'timeout'
=>
30
'timeout'
=>
30
];
];
return
$this
->
send
(
$params
,
'Chain33.UnLock'
);
return
$this
->
send
(
$params
,
'Chain33.UnLock'
);
}
}
...
...
console/controllers/CrossChainController.php
View file @
accc1a5c
...
@@ -14,71 +14,95 @@ class CrossChainController extends Controller
...
@@ -14,71 +14,95 @@ class CrossChainController extends Controller
*
*
* @return array
* @return array
*/
*/
public
function
actionAutoTransfer
()
public
function
actionAutoTransfer
(
$step
,
$is_with_draw
)
{
{
$model
=
CoinCrossChain
::
find
()
->
where
([
'send_result'
=>
"0"
])
->
limit
(
20
)
->
groupBy
(
'transfer_number'
)
->
orderBy
(
'id'
)
->
asArray
()
->
all
();
$redis
=
Yii
::
$app
->
redis
;
$model
=
CoinCrossChain
::
find
()
->
where
([
'send_result'
=>
"0"
,
'step'
=>
(
int
)
$step
,
'is_with_draw'
=>
(
int
)
$is_with_draw
,
'query_result'
=>
'0'
])
->
asArray
()
->
all
();
if
(
empty
(
$model
))
{
if
(
empty
(
$model
))
{
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无跨链交易计划'
.
PHP_EOL
;
echo
date
(
'Y-m-d H:i:s'
)
.
'
STEP: '
.
$step
.
'
暂无跨链交易计划'
.
PHP_EOL
;
return
0
;
return
0
;
}
}
$current_time
=
time
();
foreach
(
$model
as
$val
)
{
foreach
(
$model
as
$val
)
{
$isExist
=
CoinCrossChain
::
find
()
if
(
$step
>
1
)
{
->
where
([
'transfer_number'
=>
$val
[
'transfer_number'
]])
$isExist
=
CoinCrossChain
::
find
()
->
andWhere
([
'<'
,
'id'
,
(
int
)
$val
[
'id'
]])
->
where
([
'transfer_number'
=>
$val
[
'transfer_number'
]])
->
orderBy
(
'id desc'
)
->
andWhere
([
'<'
,
'id'
,
(
int
)
$val
[
'id'
]])
->
asArray
()
->
orderBy
(
'id desc'
)
->
one
();
->
asArray
()
//上一步发送成功,未查询
->
one
();
if
(
'success'
!=
$isExist
[
'query_result'
]
&&
!
empty
(
$isExist
))
{
//上一步发送成功,未查询
if
(
'success'
!=
$isExist
[
'query_result'
]
&&
!
empty
(
$isExist
))
{
continue
;
}
}
$cache_transfering_time
=
$redis
->
hget
(
CoinCrossChain
::
CROSS_CHAIN_TRANSFERING
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]
.
':'
.
$val
[
'id'
]);
if
(
true
==
$cache_transfering_time
)
{
continue
;
continue
;
}
}
$redis
->
hmset
(
CoinCrossChain
::
CROSS_CHAIN_TRANSFERING
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]
.
':'
.
$val
[
'id'
],
$current_time
);
//go(function () use ($val
) {
go
(
function
()
use
(
$val
,
$redis
)
{
//
\Co::sleep(0.5);
\Co
::
sleep
(
0.5
);
$transfer_url
=
$val
[
'transfer_url'
];
$transfer_url
=
$val
[
'transfer_url'
];
$transfer_url
=
explode
(
':'
,
$transfer_url
);
$transfer_url
=
explode
(
':'
,
$transfer_url
);
$node_params
=
[
$node_params
=
[
'scheme'
=>
$transfer_url
[
0
],
'scheme'
=>
$transfer_url
[
0
],
'host'
=>
str_replace
(
'//'
,
''
,
$transfer_url
[
1
]),
'host'
=>
str_replace
(
'//'
,
''
,
$transfer_url
[
1
]),
'port'
=>
isset
(
$transfer_url
[
2
])
?
$transfer_url
[
2
]
:
''
'port'
=>
isset
(
$transfer_url
[
2
])
?
$transfer_url
[
2
]
:
''
,
];
];
$service
=
new
Chain33Service
(
$node_params
);
$service
=
new
Chain33Service
(
$node_params
);
$sign_str
=
$val
[
'txhex'
];
$sign_str
=
$val
[
'txhex'
];
$result
=
$service
->
sendTransaction
(
$sign_str
);
$result
=
$service
->
sendTransaction
(
$sign_str
);
if
(
0
!=
$result
[
'code'
])
{
if
(
0
==
$result
[
'code'
])
{
$msg
=
$result
[
'msg'
];
$send_result
=
$result
[
'result'
];
goto
doEnd
;
$currentModel
=
CoinCrossChain
::
findOne
(
$val
[
'id'
]);
}
$send_result
=
$result
[
'result'
];
doEnd
:
$currentModel
=
CoinCrossChain
::
findOne
(
$val
[
'id'
]);
if
(
isset
(
$msg
))
{
$currentModel
->
msg
=
$msg
;
}
if
(
isset
(
$send_result
))
{
$currentModel
->
send_result
=
$send_result
;
$currentModel
->
send_result
=
$send_result
;
$currentModel
->
msg
=
0
;
$currentModel
->
save
();
$redis
->
hdel
(
CoinCrossChain
::
CROSS_CHAIN_TRANSFERING
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]
.
':'
.
$val
[
'id'
]);
}
}
$currentModel
->
save
();
//});
if
(
0
!=
$result
[
'code'
]
&&
(
true
==
strstr
(
$result
[
'msg'
],
'Balance'
)))
{
$currentModel
=
CoinCrossChain
::
findOne
(
$val
[
'id'
]);
$currentModel
->
msg
=
$result
[
'msg'
];
$currentModel
->
save
();
$redis
->
hdel
(
CoinCrossChain
::
CROSS_CHAIN_TRANSFERING
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]
.
':'
.
$val
[
'id'
]);
}
else
if
(
0
!=
$result
[
'code'
]
&&
(
false
==
strstr
(
$result
[
'msg'
],
'ErrDupTx'
)))
{
$redis
->
hdel
(
CoinCrossChain
::
CROSS_CHAIN_TRANSFERING
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]
.
':'
.
$val
[
'id'
]);
}
else
{
}
});
}
}
echo
date
(
'Y-m-d H:i:s'
)
.
'跨链交易成功'
.
PHP_EOL
;
echo
date
(
'Y-m-d H:i:s'
)
.
'
STEP: '
.
$step
.
'
跨链交易成功'
.
PHP_EOL
;
return
0
;
return
0
;
}
}
public
function
actionQueryTransaction
()
public
function
actionQueryTransaction
()
{
{
$model
=
CoinCrossChain
::
find
()
->
where
([
'<>'
,
'send_result'
,
'0'
])
->
andWhere
([
'msg'
=>
'0'
])
->
limit
(
20
)
->
asArray
()
->
all
();
$redis
=
Yii
::
$app
->
redis
;
$model
=
CoinCrossChain
::
find
()
->
where
([
'<>'
,
'send_result'
,
'0'
])
->
andWhere
([
'msg'
=>
'0'
])
->
asArray
()
->
all
();
if
(
empty
(
$model
))
{
if
(
empty
(
$model
))
{
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无跨链交易计划'
.
PHP_EOL
;
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无跨链交易计划'
.
PHP_EOL
;
return
0
;
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
)
{
foreach
(
$model
as
$val
)
{
$node_params
=
$val
[
'transfer_url'
];
$node_params
=
$val
[
'transfer_url'
];
$node_params
=
explode
(
':'
,
$node_params
);
$node_params
=
explode
(
':'
,
$node_params
);
...
@@ -90,30 +114,53 @@ class CrossChainController extends Controller
...
@@ -90,30 +114,53 @@ class CrossChainController extends Controller
$service
=
new
Chain33Service
(
$node_params
);
$service
=
new
Chain33Service
(
$node_params
);
$send_result
=
$val
[
'send_result'
];
$send_result
=
$val
[
'send_result'
];
$result
=
$service
->
QueryTransaction
(
$send_result
);
$result
=
$service
->
QueryTransaction
(
$send_result
);
if
(
-
1
==
$result
[
'code'
])
{
$switch
=
true
;
if
(
'tx not exist'
==
$result
[
'msg'
])
continue
;
$msg
=
$result
[
'msg'
];
$query_result
=
$result
[
'code'
];
goto
doEnd
;
// echo date('Y-m-d H:i:s') . 'ID:' . $val['id'] . '查询错误' . PHP_EOL;
// continue;
}
if
(
isset
(
$result
[
'result'
][
'actionName'
])
&&
'unknown'
==
$result
[
'result'
][
'actionName'
])
{
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'
;
$query_result
=
'success'
;
$msg
=
'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'
])
{
}
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'
;
$query_result
=
'success'
;
$msg
=
'success'
;
$msg
=
'success'
;
$height
=
isset
(
$result
[
'result'
][
'height'
])
?
$result
[
'result'
][
'height'
]
:
0
;
goto
doEnd
;
}
else
{
}
else
{
$query_result
=
'fail'
;
$cache_error_time
=
$redis
->
hget
(
CoinCrossChain
::
CROSS_CHAIN_CACHE_FAIL
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]);
foreach
(
$result
[
'result'
][
'receipt'
][
'logs'
]
as
$log
)
{
if
(
false
==
$cache_error_time
)
{
if
(
is_array
(
$log
[
'log'
]))
continue
;
$redis
->
hmset
(
CoinCrossChain
::
CROSS_CHAIN_CACHE_FAIL
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
],
$current_time
);
$msg
=
isset
(
$log
[
'log'
])
?
$log
[
'log'
]
:
'查询错误'
;
continue
;
}
if
((
$current_time
-
$cache_error_time
)
<
60
)
{
continue
;
}
$redis
->
hdel
(
CoinCrossChain
::
CROSS_CHAIN_CACHE_FAIL
,
$val
[
'address'
]
.
':'
.
$val
[
'is_with_draw'
]);
if
(
-
1
==
$result
[
'code'
])
{
$msg
=
$result
[
'msg'
];
$query_result
=
$result
[
'code'
];
$switch
=
false
;
goto
doEnd
;
}
else
{
$query_result
=
'fail'
;
foreach
(
$result
[
'result'
][
'receipt'
][
'logs'
]
as
$log
)
{
if
(
is_array
(
$log
[
'log'
]))
continue
;
$msg
=
isset
(
$log
[
'log'
])
?
$log
[
'log'
]
:
'查询错误'
;
}
$switch
=
false
;
goto
doEnd
;
}
}
}
}
doEnd
:
doEnd
:
if
(
CoinCrossChain
::
RECHARGE
==
$val
[
'is_with_draw'
]
&&
$val
[
'step'
]
==
2
&&
$switch
&&
isset
(
$height
)
&&
(
$consensHeight
<
$height
))
{
continue
;
}
$currentModel
=
CoinCrossChain
::
findOne
(
$val
[
'id'
]);
$currentModel
=
CoinCrossChain
::
findOne
(
$val
[
'id'
]);
$currentModel
->
query_result
=
$query_result
;
$currentModel
->
query_result
=
$query_result
;
$currentModel
->
msg
=
$msg
;
$currentModel
->
msg
=
$msg
;
...
@@ -121,7 +168,6 @@ class CrossChainController extends Controller
...
@@ -121,7 +168,6 @@ class CrossChainController extends Controller
$count
=
CoinCrossChain
::
find
()
->
where
([
'transfer_number'
=>
$val
[
'transfer_number'
]])
->
andWhere
([
'query_result'
=>
'success'
])
->
count
();
$count
=
CoinCrossChain
::
find
()
->
where
([
'transfer_number'
=>
$val
[
'transfer_number'
]])
->
andWhere
([
'query_result'
=>
'success'
])
->
count
();
if
(
3
==
$count
)
{
if
(
3
==
$count
)
{
$redis
=
Yii
::
$app
->
redis
;
$key
=
$val
[
'address'
]
.
'_'
.
$val
[
'is_with_draw'
];
$key
=
$val
[
'address'
]
.
'_'
.
$val
[
'is_with_draw'
];
if
(
$redis
->
exists
(
$key
))
{
if
(
$redis
->
exists
(
$key
))
{
$redis
->
del
(
$key
);
$redis
->
del
(
$key
);
...
...
console/controllers/GameBetController.php
View file @
accc1a5c
...
@@ -4,6 +4,7 @@ namespace console\controllers;
...
@@ -4,6 +4,7 @@ namespace console\controllers;
use
common\business\Chain33Business
;
use
common\business\Chain33Business
;
use
common\models\psources\CoinGameBet
;
use
common\models\psources\CoinGameBet
;
use
common\service\chain33\Chain33Service
;
use
yii\console\Controller
;
use
yii\console\Controller
;
use
Yii
;
use
Yii
;
...
@@ -17,47 +18,46 @@ class GameBetController extends Controller
...
@@ -17,47 +18,46 @@ class GameBetController extends Controller
public
function
actionGameStatus
()
public
function
actionGameStatus
()
{
{
$nodes
=
\Yii
::
$app
->
params
[
'chain_parallel'
][
'wasm'
];
$nodes
=
\Yii
::
$app
->
params
[
'chain_parallel'
][
'wasm'
];
if
(
empty
(
$nodes
))
{
if
(
empty
(
$nodes
))
{
echo
date
(
'Y-m-d H:i:s'
)
.
'无节点'
.
PHP_EOL
;
echo
date
(
'Y-m-d H:i:s'
)
.
'无节点'
.
PHP_EOL
;
return
0
;
return
0
;
}
}
foreach
(
$nodes
as
$key
=>
$node
)
{
foreach
(
$nodes
as
$key
=>
$node
)
{
$service
=
new
Chain33Business
();
$service
=
new
Chain33Business
();
$result
=
$service
->
getGameStatus
(
$node
);
$result
=
$service
->
getGameStatus
(
$node
);
if
(
0
!==
$result
[
'code'
])
{
if
(
0
!==
$result
[
'code'
])
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
$result
[
'msg'
]
.
PHP_EOL
;
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
$result
[
'msg'
]
.
PHP_EOL
;
continue
;
continue
;
}
}
$queryResultItems
=
$result
[
'result'
]
??
[];
$queryResultItems
=
$result
[
'result'
]
??
[];
if
(
empty
(
$queryResultItems
))
{
if
(
empty
(
$queryResultItems
))
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'error'
.
PHP_EOL
;
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'error'
.
PHP_EOL
;
continue
;
continue
;
}
}
$resultJSON
=
json_decode
(
$queryResultItems
[
'queryResultItems'
][
0
][
'resultJSON'
],
true
);
$resultJSON
=
json_decode
(
$queryResultItems
[
'queryResultItems'
][
0
][
'resultJSON'
],
true
);
$current_round
=
$resultJSON
[
'current_round'
];
$current_round
=
$resultJSON
[
'current_round'
];
$cache_current_round
=
Yii
::
$app
->
redis
->
get
(
'chain33_game_bet_status_'
.
$key
);
$cache_current_round
=
Yii
::
$app
->
redis
->
get
(
'chain33_game_bet_status_'
.
$key
);
if
(
empty
(
$cache_current_round
))
{
if
(
empty
(
$cache_current_round
))
{
$cache_current_round
=
CoinGameBet
::
find
()
->
where
([
'platform'
=>
$key
])
->
max
(
'round'
);
$cache_current_round
=
CoinGameBet
::
find
()
->
where
([
'platform'
=>
$key
])
->
max
(
'round'
);
Yii
::
$app
->
redis
->
set
(
'chain33_game_bet_status_'
.
$key
,
$cache_current_round
,
'EX'
,
300
);
Yii
::
$app
->
redis
->
set
(
'chain33_game_bet_status_'
.
$key
,
$cache_current_round
,
'EX'
,
300
);
}
}
$cache_current_round
=
(
false
==
$cache_current_round
?
0
:
$cache_current_round
);
$cache_current_round
=
(
false
==
$cache_current_round
?
0
:
$cache_current_round
);
if
(
$cache_current_round
>=
$current_round
)
{
if
(
$cache_current_round
>=
$current_round
)
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据已为最新'
.
PHP_EOL
;
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据已为最新'
.
PHP_EOL
;
continue
;
continue
;
}
}
Yii
::
$app
->
redis
->
set
(
'chain33_game_bet_status_'
.
$key
,
$current_round
,
'EX'
,
300
);
Yii
::
$app
->
redis
->
set
(
'chain33_game_bet_status_'
.
$key
,
$current_round
,
'EX'
,
300
);
$result
=
$service
->
getBetStatus
(
$cache_current_round
,
$current_round
,
''
,
$node
);
$result
=
$service
->
getBetStatus
(
$cache_current_round
,
$current_round
,
''
,
$node
);
if
(
0
!==
$result
[
'code'
])
{
if
(
0
!==
$result
[
'code'
])
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
continue
;
continue
;
}
}
$queryResultItems
=
$result
[
'result'
]
??
[];
$queryResultItems
=
$result
[
'result'
]
??
[];
if
(
empty
(
$queryResultItems
))
{
if
(
empty
(
$queryResultItems
))
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
continue
;
continue
;
}
}
$platform
=
$key
;
$platform
=
$key
;
...
@@ -69,7 +69,7 @@ class GameBetController extends Controller
...
@@ -69,7 +69,7 @@ class GameBetController extends Controller
];
];
}
}
CoinGameBet
::
loadArray
(
$datas
);
CoinGameBet
::
loadArray
(
$datas
);
echo
$platform
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据更新成功'
.
PHP_EOL
;
echo
$platform
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据更新成功'
.
PHP_EOL
;
continue
;
continue
;
}
}
return
0
;
return
0
;
...
@@ -77,44 +77,66 @@ class GameBetController extends Controller
...
@@ -77,44 +77,66 @@ class GameBetController extends Controller
public
function
actionBetUpdate
()
public
function
actionBetUpdate
()
{
{
$service
=
new
Chain33Business
();
$node_params
=
[
'scheme'
=>
'https'
,
'host'
=>
'jiedian1.bityuan.com'
,
'port'
=>
8801
];
$result
=
$service
->
getLastHeader
(
$node_params
);
$main_height
=
isset
(
$result
[
'result'
][
'height'
])
?
$result
[
'result'
][
'height'
]
:
0
;
$safe_main_height
=
$main_height
-
14
;
$nodes
=
\Yii
::
$app
->
params
[
'chain_parallel'
][
'wasm'
];
$nodes
=
\Yii
::
$app
->
params
[
'chain_parallel'
][
'wasm'
];
if
(
empty
(
$nodes
))
{
if
(
empty
(
$nodes
))
{
echo
date
(
'Y-m-d H:i:s'
)
.
'无节点'
.
PHP_EOL
;
echo
date
(
'Y-m-d H:i:s'
)
.
'无节点'
.
PHP_EOL
;
return
0
;
return
0
;
}
}
foreach
(
$nodes
as
$key
=>
$node
)
{
foreach
(
$nodes
as
$key
=>
$node
)
{
$service
=
new
Chain33
Business
(
);
$service
=
new
Chain33
Service
(
$node
);
$result
=
$service
->
getLastHeader
(
$node
);
$result
=
$service
->
getLastHeader
(
);
$height
=
$result
[
'result'
][
'height'
];
$height
=
$result
[
'result'
][
'height'
];
$main_info
=
$service
->
getBlock2MainInfo
(
$height
-
14
,
$height
);
if
(
!
isset
(
$main_info
[
'result'
][
'items'
]))
continue
;
$items
=
$main_info
[
'result'
][
'items'
];
$items
=
$this
->
arraySort
(
$items
,
'mainHeight'
);
$safe_height
=
0
;
foreach
(
$items
as
$item
)
{
if
(
$safe_main_height
>
$item
[
'mainHeight'
])
{
$safe_height
=
$item
[
'height'
];
break
;
}
}
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'当前主链高度为:'
.
$main_height
.
';当前平行链高度为:'
.
$height
.
';当前安全高度为:'
.
$safe_height
.
PHP_EOL
;
$models
=
CoinGameBet
::
find
()
->
select
(
'round'
)
->
where
([
$models
=
CoinGameBet
::
find
()
->
select
(
'round'
)
->
where
([
'and'
,
'and'
,
[
'valid'
=>
CoinGameBet
::
VAILD_FALSE
],
[
'valid'
=>
CoinGameBet
::
VAILD_FALSE
],
[
'<'
,
'height'
,
$
height
-
12
],
[
'<'
,
'height'
,
$
safe_height
],
[
'platform'
=>
$key
]
[
'platform'
=>
$key
]
])
->
all
();
])
->
all
();
if
(
empty
(
$models
))
{
if
(
empty
(
$models
))
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'无需更新的数据'
.
PHP_EOL
;
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'无需更新的数据'
.
PHP_EOL
;
continue
;
continue
;
}
}
$valid_arr
=
[];
$valid_arr
=
[];
foreach
(
$models
as
$model
)
{
foreach
(
$models
as
$model
)
{
$valid_arr
[]
=
$model
->
round
;
$valid_arr
[]
=
$model
->
round
;
}
}
$result
=
$service
->
getBetStatus
(
''
,
''
,
$valid_arr
,
$node
);
$business
=
new
Chain33Business
();
if
(
0
!==
$result
[
'code'
]){
$result
=
$business
->
getBetStatus
(
''
,
''
,
$valid_arr
,
$node
);
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
if
(
0
!==
$result
[
'code'
])
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
continue
;
continue
;
}
}
$queryResultItems
=
$result
[
'result'
]
??
[];
$queryResultItems
=
$result
[
'result'
]
??
[];
if
(
empty
(
$queryResultItems
))
{
if
(
empty
(
$queryResultItems
))
{
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
echo
$key
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据错误'
.
PHP_EOL
;
continue
;
continue
;
}
}
$platform
=
$key
;
$platform
=
$key
;
foreach
(
$queryResultItems
[
'queryResultItems'
]
as
$key
=>
$val
){
foreach
(
$queryResultItems
[
'queryResultItems'
]
as
$key
=>
$val
)
{
if
(
false
==
$val
[
'found'
])
continue
;
if
(
false
==
$val
[
'found'
])
continue
;
$resultArr
=
json_decode
(
$val
[
'resultJSON'
],
true
);
$resultArr
=
json_decode
(
$val
[
'resultJSON'
],
true
);
CoinGameBet
::
updateAll
([
CoinGameBet
::
updateAll
([
'amount'
=>
$resultArr
[
'amount'
],
'amount'
=>
$resultArr
[
'amount'
],
'height'
=>
$resultArr
[
'height'
],
'height'
=>
$resultArr
[
'height'
],
...
@@ -122,14 +144,25 @@ class GameBetController extends Controller
...
@@ -122,14 +144,25 @@ class GameBetController extends Controller
'rand_num'
=>
$resultArr
[
'rand_num'
],
'rand_num'
=>
$resultArr
[
'rand_num'
],
'player_win'
=>
$resultArr
[
'player_win'
],
'player_win'
=>
$resultArr
[
'player_win'
],
'valid'
=>
CoinGameBet
::
VAILD_TRUE
'valid'
=>
CoinGameBet
::
VAILD_TRUE
],[
],
[
'round'
=>
$resultArr
[
'round'
],
'round'
=>
$resultArr
[
'round'
],
'platform'
=>
$platform
'platform'
=>
$platform
]);
]);
}
}
echo
$platform
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据更新成功'
.
PHP_EOL
;
echo
$platform
.
':'
.
date
(
'Y-m-d H:i:s'
)
.
'数据更新成功'
.
PHP_EOL
;
continue
;
continue
;
}
}
return
0
;
return
0
;
}
}
protected
function
arraySort
(
$array
,
$keys
,
$sort
=
SORT_DESC
)
{
$keysValue
=
[];
foreach
(
$array
as
$k
=>
$v
)
{
$keysValue
[
$k
]
=
$v
[
$keys
];
}
array_multisort
(
$keysValue
,
$sort
,
$array
);
return
$array
;
}
}
}
\ No newline at end of file
shell/AutoTransfer.sh
deleted
100644 → 0
View file @
cf53079d
#!/bin/bash
while
true
;
do
php /var/www/html/token_pwallet/yii cross-chain/auto-transfer
>>
/var/www/html/auto-transfer.log 2>&1
;
sleep
15
;
done
&
\ No newline at end of file
shell/GameBet.sh
deleted
100644 → 0
View file @
cf53079d
#!/bin/bash
while
true
;
do
php /var/www/html/token_pwallet/yii game-bet/game-status
>>
/var/log/game-bet.log 2>&1
;
sleep
5
;
done
&
\ No newline at end of file
shell/QueryTransaction.sh
deleted
100644 → 0
View file @
cf53079d
#!/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
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