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
bba41db2
Commit
bba41db2
authored
Sep 26, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into 'master'
找币行情 See merge request
!132
parents
fd6cfca8
84c07ea5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
Zhaobi.php
common/service/exchange/Zhaobi.php
+22
-5
No files found.
common/service/exchange/Zhaobi.php
View file @
bba41db2
...
...
@@ -14,7 +14,8 @@ class Zhaobi extends Exchange implements ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_zhaobi'
;
protected
$quotation_prefix
=
'quotation_zhaobi_'
;
protected
$base_url
=
'https://api.biqianbao.top/api/data/basecoinprice?base=CNY&coin=SFT&platform=zhaobi'
;
protected
$base_url
=
'https://api.biqianbao.top'
;
#protected $base_url = 'https://api.biqianbao.top/api/data/basecoinprice?base=CNY&coin=SFT&platform=zhaobi';
public
function
symbolExists
(
$tag
=
'SFT'
,
$aim
=
"CNY"
)
{
...
...
@@ -33,7 +34,7 @@ class Zhaobi extends Exchange implements ExchangeInterface
*/
public
function
formatSymbol
(
$tag
=
'SFT'
,
$aim
=
'CNY'
)
{
return
strto
upper
(
$tag
.
'_'
.
$aim
);
return
strto
lower
(
trim
(
$tag
)
.
trim
(
$aim
)
);
}
/**
...
...
@@ -54,12 +55,27 @@ class Zhaobi extends Exchange implements ExchangeInterface
public
function
setQuotation
()
{
$curl
=
new
Curl
();
$content
=
$curl
->
get
(
$this
->
base_url
,
false
);
$api
=
$this
->
base_url
.
'/api/data/Ticker?sort=cname'
;
$content
=
$curl
->
get
(
$api
,
false
);
if
(
isset
(
$content
[
'message'
])
&&
'OK'
==
$content
[
'message'
])
{
$ticker_temp
=
[];
foreach
(
$content
[
'data'
]
as
$val
)
{
$ticker_temp
=
array_merge
(
$ticker_temp
,
$val
);
}
foreach
(
$ticker_temp
as
$val
)
{
$key
=
$this
->
quotation_prefix
.
strtolower
(
$val
[
'symbol'
]);
$this
->
redis
->
hmset
(
$key
,
'low'
,
$val
[
'low'
],
'high'
,
$val
[
'high'
],
'last'
,
$val
[
'last'
],
'open'
,
$val
[
'open'
],
'vol'
,
$val
[
'vol'
]);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$val
[
'symbol'
]);
}
}
$api
=
$this
->
base_url
.
'/api/data/basecoinprice?base=CNY&coin=SFT&platform=zhaobi'
;
$content
=
$curl
->
get
(
$api
,
false
);
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'code'
])
&&
(
200
==
$content
[
'code'
]))
{
$data
=
$content
[
'data'
][
0
];
$key
=
$this
->
quotation_prefix
.
'
SFT_CNY
'
;
$key
=
$this
->
quotation_prefix
.
'
sftcny
'
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'value'
],
'high'
,
$data
[
'value'
],
'last'
,
$data
[
'value'
]);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'SFT
_
CNY'
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'SFTCNY'
);
}
}
}
\ No newline at end of file
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