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
c8997076
Commit
c8997076
authored
Mar 14, 2022
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into 'master'
fix See merge request
!499
parents
9de92d26
5e2cb024
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
CoinController.php
api/controllers/CoinController.php
+5
-6
TickerController.php
api/controllers/TickerController.php
+1
-1
WalletCoinController.php
api/controllers/WalletCoinController.php
+8
-5
No files found.
api/controllers/CoinController.php
View file @
c8997076
...
...
@@ -250,7 +250,7 @@ class CoinController extends BaseController
foreach
(
$chains
as
$key
=>
$value
)
{
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
}
$last
[]
=
$rate
[]
=
1
;
$last
[]
=
1
;
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
if
(
false
!=
$currency
)
{
if
(
1111
==
$this
->
currency_id
)
{
...
...
@@ -259,12 +259,11 @@ class CoinController extends BaseController
if
(
Yii
::
$app
->
redis
->
hkeys
(
'quotation_go_CNY_USD'
))
{
$last
[
0
]
=
1
/
Yii
::
$app
->
redis
->
hmget
(
'quotation_go_CNY_USD'
,
'last'
)[
0
];
}
else
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_
currency_'
.
'USD
_'
.
$currency
->
symbol
,
'last'
);
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_
boc_'
.
'CNY
_'
.
$currency
->
symbol
,
'last'
);
}
}
else
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_
currency_'
.
'USD
_'
.
$currency
->
symbol
,
'last'
);
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_
boc_'
.
'CNY
_'
.
$currency
->
symbol
,
'last'
);
}
$rate
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
}
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
...
...
@@ -276,8 +275,8 @@ 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"
,
$
rate
[
0
]
*
$value
[
'chain_rmb'
]);
$value
[
'country_rate'
]
=
(
false
==
$currency
)
?
$value
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$value
[
'
last
'
]);
$value
[
'chain_country_rate'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$
last
[
0
]
*
$value
[
'chain_rmb'
]);
$value
[
'country_rate'
]
=
(
false
==
$currency
)
?
$value
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$value
[
'
rmb
'
]);
}
return
$result
;
}
...
...
api/controllers/TickerController.php
View file @
c8997076
...
...
@@ -432,7 +432,7 @@ class TickerController extends BaseController
if
(
1111
==
$val
->
currency
->
pj_id
)
{
$rate
=
(
string
)
1
;
}
else
{
list
(
$rate
)
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_
currency
_'
.
'CNY_'
.
$val
->
currency
->
symbol
,
'last'
);
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
;
...
...
api/controllers/WalletCoinController.php
View file @
c8997076
...
...
@@ -79,11 +79,14 @@ class WalletCoinController extends BaseController
$chains_symbols
=
array_keys
(
array_flip
(
$chains
)
+
array_flip
(
$symbol
));
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$chains_symbols
);
$last
[]
=
$rate
[]
=
1
;
$last
[]
=
1
;
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
if
(
false
!=
$currency
)
{
$rate
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_'
.
'USD_'
.
$currency
->
symbol
,
'last'
);
if
(
1111
==
$this
->
currency_id
)
{
$last
[]
=
1
;
}
else
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_boc_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
}
}
$ticker
=
[
'low'
=>
0
,
'high'
=>
0
,
'last'
=>
0
,
'open'
=>
0
,
'vol'
=>
0
,
'rmb'
=>
0
,
'usd'
=>
0
];
...
...
@@ -97,8 +100,8 @@ class WalletCoinController extends BaseController
$val
[
'chain_rmb'
]
=
isset
(
$val
[
'chain_quotation'
][
'rmb'
])
?
$val
[
'chain_quotation'
][
'rmb'
]
:
0
;
$val
[
'chain_usd'
]
=
isset
(
$val
[
'chain_quotation'
][
'usd'
])
?
$val
[
'chain_quotation'
][
'usd'
]
:
0
;
$val
[
'chain_country_rate'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$
rate
[
0
]
*
$val
[
'chain_rmb'
]);
$val
[
'country_rate'
]
=
(
false
==
$currency
)
?
$val
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$val
[
'
last
'
]);
$val
[
'chain_country_rate'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$
last
[
0
]
*
$val
[
'chain_rmb'
]);
$val
[
'country_rate'
]
=
(
false
==
$currency
)
?
$val
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$val
[
'
rmb
'
]);
unset
(
$val
[
'chain_quotation'
]);
}
...
...
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