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
cbd6f4d0
Commit
cbd6f4d0
authored
Jul 19, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f4c21ec8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
78 deletions
+90
-78
CoinController.php
api/controllers/CoinController.php
+90
-77
CoinPlatformWithHold.php
common/models/psources/CoinPlatformWithHold.php
+0
-1
No files found.
api/controllers/CoinController.php
View file @
cbd6f4d0
...
@@ -35,7 +35,7 @@ class CoinController extends BaseController
...
@@ -35,7 +35,7 @@ class CoinController extends BaseController
public
function
actionGetCoinById
()
public
function
actionGetCoinById
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
post
(
'id'
,
0
);
$id
=
$request
->
post
(
'id'
,
0
);
if
(
$id
)
{
if
(
$id
)
{
$ret
=
CoinBusiness
::
getCoinAllById
(
$id
);
$ret
=
CoinBusiness
::
getCoinAllById
(
$id
);
if
(
$ret
)
{
if
(
$ret
)
{
...
@@ -55,9 +55,9 @@ class CoinController extends BaseController
...
@@ -55,9 +55,9 @@ class CoinController extends BaseController
*/
*/
public
function
actionGetRecList
()
public
function
actionGetRecList
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
post
(
'page'
,
1
);
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
999
);
$limit
=
$request
->
post
(
'limit'
,
999
);
$platform_id
=
$request
->
post
(
'platform_id'
,
2
);
//默认币钱包
$platform_id
=
$request
->
post
(
'platform_id'
,
2
);
//默认币钱包
if
(
$platform_id
==
1
)
{
if
(
$platform_id
==
1
)
{
$platform_id
=
3
;
$platform_id
=
3
;
...
@@ -73,7 +73,7 @@ class CoinController extends BaseController
...
@@ -73,7 +73,7 @@ class CoinController extends BaseController
$condition
[
'recommend'
]
=
$recommend
;
$condition
[
'recommend'
]
=
$recommend
;
}
}
$select
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'nickname'
,
'platform'
,
'chain'
];
$select
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'nickname'
,
'platform'
,
'chain'
];
$datas
=
CoinRecommend
::
getList
(
$page
,
$limit
,
$condition
,
[],
$select
);
$datas
=
CoinRecommend
::
getList
(
$page
,
$limit
,
$condition
,
[],
$select
);
//获取详细信息
//获取详细信息
$coin_recommends
=
&
$datas
[
'data'
];
$coin_recommends
=
&
$datas
[
'data'
];
if
(
!
empty
(
$coin_recommends
))
{
if
(
!
empty
(
$coin_recommends
))
{
...
@@ -81,8 +81,8 @@ class CoinController extends BaseController
...
@@ -81,8 +81,8 @@ class CoinController extends BaseController
//获取币种信息
//获取币种信息
$coin_infos
=
Coin
::
getCoinInfoByIds
(
$coin_ids
,
$select
,
'id'
);
$coin_infos
=
Coin
::
getCoinInfoByIds
(
$coin_ids
,
$select
,
'id'
);
//获取行情信息
//获取行情信息
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
$coin_names
=
array_merge
(
$coin_names
,
array_column
(
$coin_infos
,
'chain'
));
$coin_names
=
array_merge
(
$coin_names
,
array_column
(
$coin_infos
,
'chain'
));
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$coin_names
);
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$coin_names
);
if
(
$coin_infos
)
{
if
(
$coin_infos
)
{
...
@@ -93,19 +93,19 @@ class CoinController extends BaseController
...
@@ -93,19 +93,19 @@ class CoinController extends BaseController
$value
[
$item
]
=
$coin_infos
[
$value
[
'cid'
]][
$item
];
$value
[
$item
]
=
$coin_infos
[
$value
[
'cid'
]][
$item
];
if
(
$value
[
'platform_id'
]
!=
2
)
{
if
(
$value
[
'platform_id'
]
!=
2
)
{
//国盾币不需要行情
//国盾币不需要行情
$value
[
'low'
]
=
$coin_quotations
[
$temp_key
][
'low'
];
$value
[
'low'
]
=
$coin_quotations
[
$temp_key
][
'low'
];
$value
[
'high'
]
=
$coin_quotations
[
$temp_key
][
'high'
];
$value
[
'high'
]
=
$coin_quotations
[
$temp_key
][
'high'
];
$value
[
'last'
]
=
$coin_quotations
[
$temp_key
][
'last'
];
$value
[
'last'
]
=
$coin_quotations
[
$temp_key
][
'last'
];
$value
[
'rmb'
]
=
$coin_quotations
[
$temp_key
][
'rmb'
];
$value
[
'rmb'
]
=
$coin_quotations
[
$temp_key
][
'rmb'
];
}
else
{
}
else
{
$value
[
'low'
]
=
0
;
$value
[
'low'
]
=
0
;
$value
[
'high'
]
=
0
;
$value
[
'high'
]
=
0
;
$value
[
'last'
]
=
0
;
$value
[
'last'
]
=
0
;
$value
[
'rmb'
]
=
0
;
$value
[
'rmb'
]
=
0
;
}
}
}
}
$value
[
'id'
]
=
$value
[
'cid'
];
$value
[
'id'
]
=
$value
[
'cid'
];
$value
[
'sid'
]
=
ucfirst
(
$value
[
'sid'
]);
$value
[
'sid'
]
=
ucfirst
(
$value
[
'sid'
]);
$value
[
'chain_quotation'
]
=
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]];
$value
[
'chain_quotation'
]
=
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]];
unset
(
$value
[
'create_time'
],
$value
[
'update_time'
],
$value
[
'cid'
]);
unset
(
$value
[
'create_time'
],
$value
[
'update_time'
],
$value
[
'cid'
]);
}
}
...
@@ -120,9 +120,9 @@ class CoinController extends BaseController
...
@@ -120,9 +120,9 @@ class CoinController extends BaseController
*/
*/
public
function
actionGetNewRecList
()
public
function
actionGetNewRecList
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
post
(
'page'
,
1
);
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
999
);
$limit
=
$request
->
post
(
'limit'
,
999
);
$platform_id
=
$request
->
post
(
'platform_id'
,
1
);
//默认币钱包
$platform_id
=
$request
->
post
(
'platform_id'
,
1
);
//默认币钱包
$recommend
=
$request
->
post
(
'recommend'
,
''
);
$recommend
=
$request
->
post
(
'recommend'
,
''
);
...
@@ -132,20 +132,20 @@ class CoinController extends BaseController
...
@@ -132,20 +132,20 @@ class CoinController extends BaseController
}
}
$select
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'nickname'
,
'platform'
,
'chain'
,
'treaty'
];
$select
=
[
'id'
,
'sid'
,
'icon'
,
'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
);
//获取详细信息
//获取详细信息
$coin_recommends
=
&
$datas
[
'data'
];
$coin_recommends
=
&
$datas
[
'data'
];
if
(
!
empty
(
$coin_recommends
))
{
if
(
!
empty
(
$coin_recommends
))
{
$coin_ids
=
array_column
(
$coin_recommends
,
'cid'
);
$coin_ids
=
array_column
(
$coin_recommends
,
'cid'
);
//获取币种信息
//获取币种信息
$coin_infos
=
Coin
::
getCoinInfoByIds
(
$coin_ids
,
$select
,
'id'
);
$coin_infos
=
Coin
::
getCoinInfoByIds
(
$coin_ids
,
$select
,
'id'
);
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
];
}
}
//获取行情信息
//获取行情信息
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
$coin_names
=
array_merge
(
$coin_names
,
array_column
(
$coin_infos
,
'chain'
));
$coin_names
=
array_merge
(
$coin_names
,
array_column
(
$coin_infos
,
'chain'
));
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$coin_names
);
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$coin_names
);
if
(
$coin_infos
)
{
if
(
$coin_infos
)
{
...
@@ -156,21 +156,21 @@ class CoinController extends BaseController
...
@@ -156,21 +156,21 @@ class CoinController extends BaseController
$value
[
$item
]
=
$coin_infos
[
$value
[
'cid'
]][
$item
];
$value
[
$item
]
=
$coin_infos
[
$value
[
'cid'
]][
$item
];
if
(
$value
[
'platform_id'
]
!=
2
)
{
if
(
$value
[
'platform_id'
]
!=
2
)
{
//国盾币不需要行情
//国盾币不需要行情
$value
[
'low'
]
=
$coin_quotations
[
$temp_key
][
'low'
];
$value
[
'low'
]
=
$coin_quotations
[
$temp_key
][
'low'
];
$value
[
'high'
]
=
$coin_quotations
[
$temp_key
][
'high'
];
$value
[
'high'
]
=
$coin_quotations
[
$temp_key
][
'high'
];
$value
[
'last'
]
=
$coin_quotations
[
$temp_key
][
'last'
];
$value
[
'last'
]
=
$coin_quotations
[
$temp_key
][
'last'
];
$value
[
'rmb'
]
=
$coin_quotations
[
$temp_key
][
'rmb'
];
$value
[
'rmb'
]
=
$coin_quotations
[
$temp_key
][
'rmb'
];
$value
[
'usd'
]
=
$coin_quotations
[
$temp_key
][
'usd'
]
??
0
;
$value
[
'usd'
]
=
$coin_quotations
[
$temp_key
][
'usd'
]
??
0
;
}
else
{
}
else
{
$value
[
'low'
]
=
0
;
$value
[
'low'
]
=
0
;
$value
[
'high'
]
=
0
;
$value
[
'high'
]
=
0
;
$value
[
'last'
]
=
0
;
$value
[
'last'
]
=
0
;
$value
[
'rmb'
]
=
0
;
$value
[
'rmb'
]
=
0
;
$value
[
'usd'
]
=
0
;
$value
[
'usd'
]
=
0
;
}
}
}
}
$value
[
'id'
]
=
$value
[
'cid'
];
$value
[
'id'
]
=
$value
[
'cid'
];
$value
[
'sid'
]
=
ucfirst
(
$value
[
'sid'
]);
$value
[
'sid'
]
=
ucfirst
(
$value
[
'sid'
]);
$value
[
'chain_quotation'
]
=
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]];
$value
[
'chain_quotation'
]
=
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]];
$value
[
'chain_rmb'
]
=
isset
(
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'rmb'
])
?
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'rmb'
]
:
0
;
$value
[
'chain_rmb'
]
=
isset
(
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'rmb'
])
?
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'rmb'
]
:
0
;
$value
[
'chain_usd'
]
=
isset
(
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'usd'
])
?
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'usd'
]
:
0
;
$value
[
'chain_usd'
]
=
isset
(
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'usd'
])
?
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]][
'usd'
]
:
0
;
...
@@ -179,7 +179,7 @@ class CoinController extends BaseController
...
@@ -179,7 +179,7 @@ class CoinController extends BaseController
unset
(
$key
,
$value
);
unset
(
$key
,
$value
);
}
}
}
}
if
(
!
$datas
[
'data'
])
{
if
(
!
$datas
[
'data'
])
{
$datas
[
'data'
]
=
null
;
$datas
[
'data'
]
=
null
;
}
}
return
$datas
;
return
$datas
;
...
@@ -195,20 +195,20 @@ class CoinController extends BaseController
...
@@ -195,20 +195,20 @@ class CoinController extends BaseController
public
function
actionGetMinerFeeByName
()
public
function
actionGetMinerFeeByName
()
{
{
$names
=
Yii
::
$app
->
request
->
post
(
'name'
);
$names
=
Yii
::
$app
->
request
->
post
(
'name'
);
$coin
=
Coin
::
findOne
([
'name'
=>
$names
]);
$coin
=
Coin
::
findOne
([
'name'
=>
$names
]);
if
(
$coin
)
{
if
(
$coin
)
{
$chain
=
$coin
->
chain
;
$chain
=
$coin
->
chain
;
$miner_fee
=
MinerFee
::
find
()
->
where
([
'platform'
=>
$chain
,
'type'
=>
1
])
->
one
();
$miner_fee
=
MinerFee
::
find
()
->
where
([
'platform'
=>
$chain
,
'type'
=>
1
])
->
one
();
if
(
!
$miner_fee
)
{
if
(
!
$miner_fee
)
{
throw
new
Exception
(
'8'
,
'旷工费未设置'
);
throw
new
Exception
(
'8'
,
'旷工费未设置'
);
}
}
}
else
{
}
else
{
//如果coin为null,$coin->minerFee会抛出Trying to get property 'minerFee' of non-object",code=>8
//如果coin为null,$coin->minerFee会抛出Trying to get property 'minerFee' of non-object",code=>8
throw
new
Exception
(
'8'
,
'币种不存在'
);
throw
new
Exception
(
'8'
,
'币种不存在'
);
}
}
$result
=
(
array
)
$miner_fee
->
getAttributes
();
$result
=
(
array
)
$miner_fee
->
getAttributes
();
$result
[
'min'
]
=
number_format
(
$result
[
'min'
],
6
);
$result
[
'min'
]
=
number_format
(
$result
[
'min'
],
6
);
$result
[
'max'
]
=
number_format
(
$result
[
'max'
],
6
);
$result
[
'max'
]
=
number_format
(
$result
[
'max'
],
6
);
return
$result
;
return
$result
;
}
}
...
@@ -217,28 +217,28 @@ class CoinController extends BaseController
...
@@ -217,28 +217,28 @@ class CoinController extends BaseController
*/
*/
public
function
actionCoinIndex
()
public
function
actionCoinIndex
()
{
{
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$platforms
=
[];
$platforms
=
[];
$newNames
=
[];
$newNames
=
[];
if
(
!
$names
)
{
if
(
!
$names
)
{
return
[
'code'
=>
0
,
'data'
=>
[]];
return
[
'code'
=>
0
,
'data'
=>
[]];
}
}
foreach
(
$names
as
$item
)
{
foreach
(
$names
as
$item
)
{
$item_array
=
explode
(
','
,
$item
);
$item_array
=
explode
(
','
,
$item
);
$newNames
[]
=
$item_array
[
0
];
$newNames
[]
=
$item_array
[
0
];
if
(
isset
(
$item_array
[
1
]))
{
if
(
isset
(
$item_array
[
1
]))
{
if
(
!
in_array
(
$item_array
[
1
],
$platforms
))
{
if
(
!
in_array
(
$item_array
[
1
],
$platforms
))
{
$platforms
[]
=
$item_array
[
1
];
$platforms
[]
=
$item_array
[
1
];
}
}
}
}
}
}
$condition
=
[[
'in'
,
'name'
,
$newNames
]];
$condition
=
[[
'in'
,
'name'
,
$newNames
]];
if
(
$platforms
)
{
if
(
$platforms
)
{
$condition
[]
=
[
'in'
,
'platform'
,
$platforms
];
$condition
[]
=
[
'in'
,
'platform'
,
$platforms
];
}
}
$result
=
ExchangeBusiness
::
getApiListForIndex
(
1
,
999
,
$condition
);
$result
=
ExchangeBusiness
::
getApiListForIndex
(
1
,
999
,
$condition
);
if
(
$result
)
{
if
(
$result
)
{
$chains
=
array_unique
(
array_column
(
$result
[
'data'
],
'chain'
));
$chains
=
array_unique
(
array_column
(
$result
[
'data'
],
'chain'
));
$chain_quotation
=
[];
$chain_quotation
=
[];
foreach
(
$chains
as
$key
=>
$value
)
{
foreach
(
$chains
as
$key
=>
$value
)
{
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
...
@@ -261,23 +261,23 @@ class CoinController extends BaseController
...
@@ -261,23 +261,23 @@ class CoinController extends BaseController
*/
*/
public
function
actionSearchCoinByName
()
public
function
actionSearchCoinByName
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$name
=
$request
->
post
(
'name'
,
''
);
$name
=
$request
->
post
(
'name'
,
''
);
$page
=
$request
->
post
(
'page'
,
1
);
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
10
);
$limit
=
$request
->
post
(
'limit'
,
10
);
$platform_ids
=
$request
->
post
(
'platform_id'
,
null
);
$platform_ids
=
$request
->
post
(
'platform_id'
,
null
);
$condition
=
[[
'in'
,
'chain'
,
[
'ETH'
,
'DCR'
,
'BTC'
,
'BTY'
]]];
$condition
=
[[
'in'
,
'chain'
,
[
'ETH'
,
'DCR'
,
'BTC'
,
'BTY'
]]];
if
(
!
empty
(
$name
))
{
if
(
!
empty
(
$name
))
{
$condition
[]
=
[
'or'
,
[
'address'
=>
$name
],
[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
$condition
[]
=
[
'or'
,
[
'address'
=>
$name
],
[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
}
}
if
(
$platform_ids
)
{
if
(
$platform_ids
)
{
/* $platform_id_arr = explode(',', $platform_ids);
/* $platform_id_arr = explode(',', $platform_ids);
$condition_arr = ['OR'];
$condition_arr = ['OR'];
foreach ($platform_id_arr as $key => $value) {
foreach ($platform_id_arr as $key => $value) {
array_push($condition_arr, ['=', 'platform_id', $value]);
array_push($condition_arr, ['=', 'platform_id', $value]);
}
}
$condition[] = $condition_arr;*/
$condition[] = $condition_arr;*/
$condition
[]
=
[
'>'
,
"find_in_set(
$platform_ids
, platform_id)"
,
0
];
$condition
[]
=
[
'>'
,
"find_in_set(
$platform_ids
, platform_id)"
,
0
];
}
}
...
@@ -285,10 +285,10 @@ class CoinController extends BaseController
...
@@ -285,10 +285,10 @@ class CoinController extends BaseController
if
(
empty
(
$result
))
{
if
(
empty
(
$result
))
{
return
[
'code'
=>
0
,
'count'
=>
0
,
'data'
=>
[]];
return
[
'code'
=>
0
,
'count'
=>
0
,
'data'
=>
[]];
}
}
$total
=
$result
[
'total'
];
$total
=
$result
[
'total'
];
$result
=
$result
[
'data'
];
$result
=
$result
[
'data'
];
if
(
$result
)
{
if
(
$result
)
{
$chains
=
array_unique
(
array_column
(
$result
,
'chain'
));
$chains
=
array_unique
(
array_column
(
$result
,
'chain'
));
$chain_quotation
=
[];
$chain_quotation
=
[];
foreach
(
$chains
as
$key
=>
$value
)
{
foreach
(
$chains
as
$key
=>
$value
)
{
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
...
@@ -314,8 +314,8 @@ class CoinController extends BaseController
...
@@ -314,8 +314,8 @@ class CoinController extends BaseController
public
function
actionTransaction
()
public
function
actionTransaction
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$name
=
$request
->
post
(
'name'
,
''
);
$name
=
$request
->
post
(
'name'
,
''
);
$txhash
=
$request
->
post
(
'txhash'
,
''
);
$txhash
=
$request
->
post
(
'txhash'
,
''
);
if
(
$name
&&
$txhash
)
{
if
(
$name
&&
$txhash
)
{
return
BrowerBusiness
::
getTransStatus
(
$name
,
$txhash
);
return
BrowerBusiness
::
getTransStatus
(
$name
,
$txhash
);
}
}
...
@@ -329,12 +329,12 @@ class CoinController extends BaseController
...
@@ -329,12 +329,12 @@ class CoinController extends BaseController
public
function
actionGetBrowerByPlatform
()
public
function
actionGetBrowerByPlatform
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$platform
=
$request
->
post
(
'platform'
,
''
);
$platform
=
$request
->
post
(
'platform'
,
''
);
if
(
$platform
)
{
if
(
$platform
)
{
$brower_url
=
Yii
::
$app
->
redis
->
hget
(
'platform_brower_info'
,
$platform
);
$brower_url
=
Yii
::
$app
->
redis
->
hget
(
'platform_brower_info'
,
$platform
);
return
[
'code'
=>
0
,
'data'
=>
$brower_url
];
return
[
'code'
=>
0
,
'data'
=>
$brower_url
];
}
else
{
}
else
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数不能为空'
];
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数不能为空'
];
}
}
}
}
...
@@ -344,14 +344,27 @@ class CoinController extends BaseController
...
@@ -344,14 +344,27 @@ class CoinController extends BaseController
public
function
actionGetWithHold
()
public
function
actionGetWithHold
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$platform
=
$request
->
get
(
'platform'
,
''
);
$platform
=
$request
->
get
(
'platform'
,
''
);
if
(
$platform
){
$coin_name
=
$request
->
get
(
'coinname'
,
''
);
if
(
$platform
&&
$coin_name
)
{
$platform_with_hold
=
CoinPlatformWithHold
::
getRecord
(
$platform
);
$platform_with_hold
=
CoinPlatformWithHold
::
getRecord
(
$platform
);
if
(
$platform_with_hold
){
$coin_info
=
Coin
::
find
()
->
select
(
'treaty'
)
->
where
([
'name'
=>
strtoupper
(
$coin_name
)])
->
asArray
()
->
one
();
if
(
$platform_with_hold
)
{
$des
=
Yii
::
$app
->
des
;
$des
=
Yii
::
$app
->
des
;
$platform_with_hold
[
'private_key'
]
=
$des
->
encrypt
(
$platform_with_hold
[
'private_key'
]);
$platform_with_hold
[
'private_key'
]
=
$des
->
encrypt
(
$platform_with_hold
[
'private_key'
]);
return
[
'code'
=>
0
,
'data'
=>
$platform_with_hold
];
if
(
1
==
$coin_info
[
'treaty'
]){
}
else
{
$platform_with_hold
[
'exer'
]
=
'user.p.'
.
$platform
.
'.token'
;
$platform_with_hold
[
'tokensymbol'
]
=
$platform
;
$platform_with_hold
[
'fee'
]
=
0
;
}
else
{
$platform_with_hold
[
'exer'
]
=
'user.p.'
.
$platform
.
'.coins'
;
$platform_with_hold
[
'tokensymbol'
]
=
$platform
.
'.coins'
;
$platform_with_hold
[
'fee'
]
=
(
float
)
sprintf
(
"%0.4f"
,
(
double
)
$platform_with_hold
[
'fee'
]);
}
$platform_with_hold
[
'bty_fee'
]
=
(
float
)
sprintf
(
"%0.4f"
,
(
double
)
Yii
::
$app
->
params
[
'bty_fee'
]);;
return
[
'code'
=>
0
,
'data'
=>
$platform_with_hold
];
}
else
{
$data
=
[
$data
=
[
'id'
=>
0
,
'id'
=>
0
,
'platform'
=>
''
,
'platform'
=>
''
,
...
@@ -361,8 +374,8 @@ class CoinController extends BaseController
...
@@ -361,8 +374,8 @@ class CoinController extends BaseController
];
];
return
[
'code'
=>
0
,
'data'
=>
$data
];
return
[
'code'
=>
0
,
'data'
=>
$data
];
}
}
}
else
{
}
else
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数
不能为空'
];
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数或币种名称
不能为空'
];
}
}
}
}
}
}
common/models/psources/CoinPlatformWithHold.php
View file @
cbd6f4d0
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
* Time: 17:37
* Time: 17:37
*/
*/
namespace
common\models\psources
;
namespace
common\models\psources
;
use
Yii
;
class
CoinPlatformWithHold
extends
BaseActiveRecord
class
CoinPlatformWithHold
extends
BaseActiveRecord
{
{
...
...
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