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
166de7bb
Commit
166de7bb
authored
Mar 15, 2022
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into 'master'
fix See merge request
!500
parents
c8997076
eb30121e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
30 deletions
+14
-30
CoinController.php
api/controllers/CoinController.php
+1
-11
TickerController.php
api/controllers/TickerController.php
+1
-1
WalletCoinController.php
api/controllers/WalletCoinController.php
+1
-5
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+11
-13
No files found.
api/controllers/CoinController.php
View file @
166de7bb
...
@@ -253,17 +253,7 @@ class CoinController extends BaseController
...
@@ -253,17 +253,7 @@ class CoinController extends BaseController
$last
[]
=
1
;
$last
[]
=
1
;
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
if
(
false
!=
$currency
)
{
if
(
false
!=
$currency
)
{
if
(
1111
==
$this
->
currency_id
)
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
$last
[]
=
1
;
}
else
if
(
1316
==
$this
->
currency_id
)
{
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_boc_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
}
}
else
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_boc_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
}
}
}
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
...
...
api/controllers/TickerController.php
View file @
166de7bb
...
@@ -432,7 +432,7 @@ class TickerController extends BaseController
...
@@ -432,7 +432,7 @@ class TickerController extends BaseController
if
(
1111
==
$val
->
currency
->
pj_id
)
{
if
(
1111
==
$val
->
currency
->
pj_id
)
{
$rate
=
(
string
)
1
;
$rate
=
(
string
)
1
;
}
else
{
}
else
{
list
(
$rate
)
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_
boc
_'
.
'CNY_'
.
$val
->
currency
->
symbol
,
'last'
);
list
(
$rate
)
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_
currency
_'
.
'CNY_'
.
$val
->
currency
->
symbol
,
'last'
);
}
}
$val
->
pj_id
=
$val
->
currency
->
pj_id
;
$val
->
pj_id
=
$val
->
currency
->
pj_id
;
$val
->
pj_name
=
$val
->
currency
->
pj_name
;
$val
->
pj_name
=
$val
->
currency
->
pj_name
;
...
...
api/controllers/WalletCoinController.php
View file @
166de7bb
...
@@ -82,11 +82,7 @@ class WalletCoinController extends BaseController
...
@@ -82,11 +82,7 @@ class WalletCoinController extends BaseController
$last
[]
=
1
;
$last
[]
=
1
;
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
if
(
false
!=
$currency
)
{
if
(
false
!=
$currency
)
{
if
(
1111
==
$this
->
currency_id
)
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
$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
];
$ticker
=
[
'low'
=>
0
,
'high'
=>
0
,
'last'
=>
0
,
'open'
=>
0
,
'vol'
=>
0
,
'rmb'
=>
0
,
'usd'
=>
0
];
...
...
common/business/ExchangeBusiness.php
View file @
166de7bb
...
@@ -32,16 +32,14 @@ class ExchangeBusiness
...
@@ -32,16 +32,14 @@ class ExchangeBusiness
1
=>
'Hadax'
,
1
=>
'Hadax'
,
2
=>
'Bittrex'
,
2
=>
'Bittrex'
,
3
=>
'Zb'
,
3
=>
'Zb'
,
4
=>
'Rate'
,
4
=>
'Superx'
,
5
=>
'Superx'
,
5
=>
'Binance'
,
6
=>
'Binance'
,
6
=>
'Bilaxy'
,
7
=>
'Bilaxy'
,
7
=>
'Bitnasdaq'
,
8
=>
'Bitnasdaq'
,
8
=>
'Isummit'
,
9
=>
'Isummit'
,
9
=>
'Ztb'
,
10
=>
'Boc'
,
10
=>
'Wbf'
,
11
=>
'Ztb'
,
11
=>
'Gwa'
12
=>
'Wbf'
,
13
=>
'Gwa'
//1 => 'Hadax', //不需要
//1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要
//2 => 'Bitfinex', //不需要
...
@@ -452,9 +450,9 @@ class ExchangeBusiness
...
@@ -452,9 +450,9 @@ class ExchangeBusiness
}
}
doEnd
:
doEnd
:
$
exchange
=
ExchangeFactory
::
createExchange
(
"Rate"
);
$
cny_usd_rate
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_CNY_USD'
,
'last'
);
$
rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$
cny_usd_rate
=
floatval
(
$cny_usd_rate
[
0
]
);
$cny_usd_rate
=
1
/
$rate
[
'last'
];
$quotation
[
'rmb'
]
=
isset
(
$quotation
[
'rmb'
])
?
$quotation
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
$quotation
[
'rmb'
]
=
isset
(
$quotation
[
'rmb'
])
?
$quotation
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
if
(
in_array
(
strtoupper
(
$tag
),
[
'FOLI'
,
'CIC'
,
'MC'
,
'KPC8'
,
'BBD'
,
'BVA'
,
'DAG'
,
'BNC'
,
'BNB'
,
'GHP'
,
'DRA'
,
'ETC'
,
'PAX'
,
'STH'
,
'XJH'
,
'SFT'
,
'TSC'
,
'SUM'
,
'USDW'
,
'FUT'
,
'MBTC'
,
'METH'
,
'GLCW'
,
'HDC'
,
'GWA'
,
'KLG'
,
'LELE'
,
'ZUE'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'FOLI'
,
'CIC'
,
'MC'
,
'KPC8'
,
'BBD'
,
'BVA'
,
'DAG'
,
'BNC'
,
'BNB'
,
'GHP'
,
'DRA'
,
'ETC'
,
'PAX'
,
'STH'
,
'XJH'
,
'SFT'
,
'TSC'
,
'SUM'
,
'USDW'
,
'FUT'
,
'MBTC'
,
'METH'
,
'GLCW'
,
'HDC'
,
'GWA'
,
'KLG'
,
'LELE'
,
'ZUE'
]))
{
$quotation
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
$quotation
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
...
...
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