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
9da8c83d
Commit
9da8c83d
authored
Dec 14, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
69907aaa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
CoinController.php
api/controllers/CoinController.php
+58
-0
No files found.
api/controllers/CoinController.php
View file @
9da8c83d
...
...
@@ -109,6 +109,64 @@ class CoinController extends BaseController
}
/**
* 获取推介币种列表(新)
*/
public
function
actionGetNewRecList
()
{
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
999
);
$platform_id
=
$request
->
post
(
'platform_id'
,
1
);
//默认币钱包
$recommend
=
$request
->
post
(
'recommend'
,
''
);
$condition
=
[
'platform_id'
=>
$platform_id
];
if
(
$recommend
)
{
$condition
[
'recommend'
]
=
$recommend
;
}
$select
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'nickname'
,
'platform'
,
'chain'
];
$datas
=
CoinRecommend
::
getList
(
$page
,
$limit
,
$condition
,
[],
$select
);
//获取详细信息
$coin_recommends
=
&
$datas
[
'data'
];
if
(
!
empty
(
$coin_recommends
))
{
$coin_ids
=
array_column
(
$coin_recommends
,
'cid'
);
//获取币种信息
$coin_infos
=
Coin
::
getCoinInfoByIds
(
$coin_ids
,
$select
,
'id'
);
//获取行情信息
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
$coin_names
=
array_merge
(
$coin_names
,
array_column
(
$coin_infos
,
'chain'
));
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$coin_names
);
if
(
$coin_infos
)
{
array_shift
(
$select
);
foreach
(
$coin_recommends
as
$key
=>
&
$value
)
{
$temp_key
=
$coin_infos
[
$value
[
'cid'
]][
'name'
];
foreach
(
$select
as
$item
)
{
$value
[
$item
]
=
$coin_infos
[
$value
[
'cid'
]][
$item
];
if
(
$value
[
'platform_id'
]
!=
2
)
{
//国盾币不需要行情
$value
[
'low'
]
=
$coin_quotations
[
$temp_key
][
'low'
];
$value
[
'high'
]
=
$coin_quotations
[
$temp_key
][
'high'
];
$value
[
'last'
]
=
$coin_quotations
[
$temp_key
][
'last'
];
$value
[
'rmb'
]
=
$coin_quotations
[
$temp_key
][
'rmb'
];
}
else
{
$value
[
'low'
]
=
0
;
$value
[
'high'
]
=
0
;
$value
[
'last'
]
=
0
;
$value
[
'rmb'
]
=
0
;
}
}
$value
[
'id'
]
=
$value
[
'cid'
];
$value
[
'sid'
]
=
ucfirst
(
$value
[
'sid'
]);
$value
[
'chain_quotation'
]
=
$coin_quotations
[
$coin_infos
[
$value
[
'cid'
]][
'chain'
]];
unset
(
$value
[
'create_time'
],
$value
[
'update_time'
],
$value
[
'cid'
]);
}
unset
(
$key
,
$value
);
}
}
return
$datas
;
}
/**
* 矿工费获取
*
* 根据name获取
...
...
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