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
41d0099a
Commit
41d0099a
authored
Dec 02, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into feature/optimize
parents
76bf604c
f6fd63ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
CoinController.php
api/controllers/CoinController.php
+6
-2
TickerController.php
api/controllers/TickerController.php
+5
-1
TickerController.php
console/controllers/TickerController.php
+1
-0
No files found.
api/controllers/CoinController.php
View file @
41d0099a
...
...
@@ -245,11 +245,15 @@ class CoinController extends BaseController
foreach
(
$chains
as
$key
=>
$value
)
{
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
}
$last
[]
=
1
;
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
if
(
false
!=
$currency
)
{
if
(
1111
==
$this
->
currency_id
)
{
$last
[]
=
1
;
}
else
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_boc_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
}
}
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
if
(
!
isset
(
$value
[
'nickname'
])
||
empty
(
$value
[
'nickname'
]))
continue
;
...
...
@@ -260,7 +264,7 @@ class CoinController extends BaseController
$value
[
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
$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_country_rate'] = (float)sprintf("%0.4f", $last[0] * $value['chain_rmb']);
$value
[
'chain_country_rate'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$value
[
'chain_rmb'
]);
$value
[
'country_rate'
]
=
(
false
==
$currency
)
?
$value
[
'chain_rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$value
[
'rmb'
]);
}
return
$result
;
...
...
api/controllers/TickerController.php
View file @
41d0099a
...
...
@@ -357,9 +357,13 @@ class TickerController extends BaseController
$msg
=
'请求参数错误!'
;
goto
doEnd
;
}
$currency
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
all
();
$currency
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
orderBy
(
'sort'
)
->
all
();
foreach
(
$currency
as
$val
)
{
if
(
1111
==
$val
->
currency
->
pj_id
)
{
$rate
=
(
string
)
1
;
}
else
{
list
(
$rate
)
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_boc_'
.
'CNY_'
.
$val
->
currency
->
symbol
,
'last'
);
}
$val
->
pj_id
=
$val
->
currency
->
pj_id
;
$val
->
pj_name
=
$val
->
currency
->
pj_name
;
$val
->
pj_symbol
=
$val
->
currency
->
pj_symbol
;
...
...
console/controllers/TickerController.php
View file @
41d0099a
...
...
@@ -38,6 +38,7 @@ class TickerController extends Controller
$currency_model
=
CoinSupportedCurrency
::
find
()
->
groupBy
(
'currency_id'
)
->
all
();
$curl
=
new
Curl
();
foreach
(
$currency_model
as
$val
)
{
if
(
1111
==
$val
->
currency
->
pj_id
)
continue
;
go
(
function
()
use
(
$val
,
$curl
)
{
\Co
::
sleep
(
0.5
);
$response
=
$curl
->
setPostParams
([
...
...
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