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
6be90f32
Commit
6be90f32
authored
Jun 13, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小数点后变4位
parent
8b56be53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+6
-6
CoinService.php
common/service/coin/CoinService.php
+3
-3
No files found.
common/business/ExchangeBusiness.php
View file @
6be90f32
...
@@ -90,42 +90,42 @@ class ExchangeBusiness
...
@@ -90,42 +90,42 @@ class ExchangeBusiness
if
(
in_array
(
strtoupper
(
$tag
),[
'GM'
,
'BSTC'
])){
if
(
in_array
(
strtoupper
(
$tag
),[
'GM'
,
'BSTC'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Token7"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Token7"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'HA'
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'HA'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
4
f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
2
f"
,
$quotation
[
'last'
]);
return
$quotation
;
return
$quotation
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),[
'BECC'
])){
if
(
in_array
(
strtoupper
(
$tag
),[
'BECC'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"S"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"S"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'ST'
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'ST'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
4
f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
2
f"
,
$quotation
[
'last'
]);
return
$quotation
;
return
$quotation
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),[
'GHP'
])){
if
(
in_array
(
strtoupper
(
$tag
),[
'GHP'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Zg"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Zg"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNZ'
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNZ'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
4
f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
2
f"
,
$quotation
[
'last'
]);
return
$quotation
;
return
$quotation
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),[
'SFT'
])){
if
(
in_array
(
strtoupper
(
$tag
),[
'SFT'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Zhaobi"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Zhaobi"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNY'
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNY'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
4
f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
2
f"
,
$quotation
[
'last'
]);
return
$quotation
;
return
$quotation
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),[
'CTG'
])){
if
(
in_array
(
strtoupper
(
$tag
),[
'CTG'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Gdpro"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Gdpro"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNY'
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNY'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
4
f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
2
f"
,
$quotation
[
'last'
]);
return
$quotation
;
return
$quotation
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),[
'USDT'
])){
if
(
in_array
(
strtoupper
(
$tag
),[
'USDT'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$quotation
=
$exchange
->
getTicker
(
'CNY'
,
'USD'
);
$quotation
=
$exchange
->
getTicker
(
'CNY'
,
'USD'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
4
f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.
2
f"
,
$quotation
[
'last'
]);
return
$quotation
;
return
$quotation
;
}
}
...
...
common/service/coin/CoinService.php
View file @
6be90f32
...
@@ -66,7 +66,7 @@ class CoinService extends Coin implements CoinInterface
...
@@ -66,7 +66,7 @@ class CoinService extends Coin implements CoinInterface
*/
*/
public
function
setPrice
(
$price
)
public
function
setPrice
(
$price
)
{
{
$this
->
price
=
(
float
)
sprintf
(
"%0.
4
f"
,
$price
);
$this
->
price
=
(
float
)
sprintf
(
"%0.
2
f"
,
$price
);
}
}
/**
/**
...
@@ -155,7 +155,7 @@ class CoinService extends Coin implements CoinInterface
...
@@ -155,7 +155,7 @@ class CoinService extends Coin implements CoinInterface
*/
*/
public
function
setHigh
(
$high
)
public
function
setHigh
(
$high
)
{
{
$this
->
high
=
(
float
)
sprintf
(
"%0.
4
f"
,
$high
/
6.6
);
$this
->
high
=
(
float
)
sprintf
(
"%0.
2
f"
,
$high
/
6.6
);
}
}
/**
/**
...
@@ -184,7 +184,7 @@ class CoinService extends Coin implements CoinInterface
...
@@ -184,7 +184,7 @@ class CoinService extends Coin implements CoinInterface
*/
*/
public
function
setLow
(
$low
)
public
function
setLow
(
$low
)
{
{
$this
->
low
=
(
float
)
sprintf
(
"%0.
4
f"
,
$low
/
6.6
);
$this
->
low
=
(
float
)
sprintf
(
"%0.
2
f"
,
$low
/
6.6
);
}
}
/**
/**
...
...
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