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
5e2cb024
Commit
5e2cb024
authored
Mar 14, 2022
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
9fb3eb2d
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 @
5e2cb024
...
@@ -250,7 +250,7 @@ class CoinController extends BaseController
...
@@ -250,7 +250,7 @@ class CoinController extends BaseController
foreach
(
$chains
as
$key
=>
$value
)
{
foreach
(
$chains
as
$key
=>
$value
)
{
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
}
}
$last
[]
=
$rate
[]
=
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
)
{
if
(
1111
==
$this
->
currency_id
)
{
...
@@ -259,12 +259,11 @@ class CoinController extends BaseController
...
@@ -259,12 +259,11 @@ class CoinController extends BaseController
if
(
Yii
::
$app
->
redis
->
hkeys
(
'quotation_go_CNY_USD'
))
{
if
(
Yii
::
$app
->
redis
->
hkeys
(
'quotation_go_CNY_USD'
))
{
$last
[
0
]
=
1
/
Yii
::
$app
->
redis
->
hmget
(
'quotation_go_CNY_USD'
,
'last'
)[
0
];
$last
[
0
]
=
1
/
Yii
::
$app
->
redis
->
hmget
(
'quotation_go_CNY_USD'
,
'last'
)[
0
];
}
else
{
}
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
{
}
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
)
{
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
...
@@ -276,8 +275,8 @@ class CoinController extends BaseController
...
@@ -276,8 +275,8 @@ class CoinController extends BaseController
$value
[
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
$value
[
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
$value
[
'chain_rmb'
]
=
isset
(
$value
[
'chain_quotation'
][
'rmb'
])
?
$value
[
'chain_quotation'
][
'rmb'
]
:
0
;
$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_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
[
'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
[
'
last
'
]);
$value
[
'country_rate'
]
=
(
false
==
$currency
)
?
$value
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$value
[
'
rmb
'
]);
}
}
return
$result
;
return
$result
;
}
}
...
...
api/controllers/TickerController.php
View file @
5e2cb024
...
@@ -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_
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_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 @
5e2cb024
...
@@ -79,11 +79,14 @@ class WalletCoinController extends BaseController
...
@@ -79,11 +79,14 @@ class WalletCoinController extends BaseController
$chains_symbols
=
array_keys
(
array_flip
(
$chains
)
+
array_flip
(
$symbol
));
$chains_symbols
=
array_keys
(
array_flip
(
$chains
)
+
array_flip
(
$symbol
));
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$chains_symbols
);
$coin_quotations
=
ExchangeBusiness
::
getQuatationByNames
(
$chains_symbols
);
$last
[]
=
$rate
[]
=
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
)
{
$rate
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
if
(
1111
==
$this
->
currency_id
)
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_currency_'
.
'USD_'
.
$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
];
...
@@ -97,8 +100,8 @@ class WalletCoinController extends BaseController
...
@@ -97,8 +100,8 @@ class WalletCoinController extends BaseController
$val
[
'chain_rmb'
]
=
isset
(
$val
[
'chain_quotation'
][
'rmb'
])
?
$val
[
'chain_quotation'
][
'rmb'
]
:
0
;
$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_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
[
'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
[
'
last
'
]);
$val
[
'country_rate'
]
=
(
false
==
$currency
)
?
$val
[
'rmb'
]
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$val
[
'
rmb
'
]);
unset
(
$val
[
'chain_quotation'
]);
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