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
867871f2
Commit
867871f2
authored
Sep 28, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
6b276b39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
Bty.php
common/service/exchange/Bty.php
+13
-10
DevController.php
console/controllers/DevController.php
+7
-0
No files found.
common/service/exchange/Bty.php
View file @
867871f2
...
@@ -12,7 +12,7 @@ class Bty extends Exchange implements ExchangeInterface
...
@@ -12,7 +12,7 @@ class Bty extends Exchange implements ExchangeInterface
{
{
protected
$supported_symbol
=
'supported_symbol_bty'
;
protected
$supported_symbol
=
'supported_symbol_bty'
;
protected
$quotation_prefix
=
'quotation_bty_'
;
protected
$quotation_prefix
=
'quotation_bty_'
;
protected
$base_url
=
'http://40.83.77.188/api/data/Ticker?
platform=HKJB&sort=cname
'
;
protected
$base_url
=
'http://40.83.77.188/api/data/Ticker?
sort=cname&platform=
'
;
/**
/**
* 转化交易对为请求变量
* 转化交易对为请求变量
...
@@ -43,15 +43,18 @@ class Bty extends Exchange implements ExchangeInterface
...
@@ -43,15 +43,18 @@ class Bty extends Exchange implements ExchangeInterface
*/
*/
public
function
setQuotation
()
public
function
setQuotation
()
{
{
$content
=
$this
->
ch
->
get
(
$this
->
base_url
,
false
);
$platforms
=
[
'HKJB'
,
'BB360'
];
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'code'
])
&&
$content
[
'code'
]
==
200
)
{
foreach
(
$platforms
as
$platform
)
{
$data
=
$content
[
'data'
][
'USDT'
];
$content
=
$this
->
ch
->
get
(
$this
->
base_url
.
$platform
,
false
);
foreach
(
$data
as
$item
)
{
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'code'
])
&&
$content
[
'code'
]
==
200
)
{
if
(
$item
[
'symbol'
]
==
'BTYUSDT'
||
$item
[
'symbol'
]
==
'ITVBUSDT'
)
{
$data
=
$content
[
'data'
][
'USDT'
];
$data
=
$item
;
foreach
(
$data
as
$item
)
{
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
];
if
(
in_array
(
$item
[
'symbol'
],
[
'BTYUSDT'
,
'ITVBUSDT'
,
'SCTCUSDT'
]))
{
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
],
'rmb'
,
$data
[
'lastrmb'
]);
$data
=
$item
;
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$item
[
'symbol'
]);
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
];
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
],
'rmb'
,
$data
[
'lastrmb'
]);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$item
[
'symbol'
]);
}
}
}
}
}
}
}
...
...
console/controllers/DevController.php
View file @
867871f2
...
@@ -18,6 +18,7 @@ use yii\console\Controller;
...
@@ -18,6 +18,7 @@ use yii\console\Controller;
use
common\models\psources\CoinPublishRule
;
use
common\models\psources\CoinPublishRule
;
use
common\models\psources\CoinReleaseMember
;
use
common\models\psources\CoinReleaseMember
;
use
backend\jobs\QueryTransJob
;
use
backend\jobs\QueryTransJob
;
use
common\service\exchange\Bty
;
/**
/**
* Class ExchangeController
* Class ExchangeController
...
@@ -53,4 +54,10 @@ class DevController extends Controller
...
@@ -53,4 +54,10 @@ class DevController extends Controller
$id
=
Yii
::
$app
->
queue
->
push
(
new
JugdeAwardJob
());
$id
=
Yii
::
$app
->
queue
->
push
(
new
JugdeAwardJob
());
var_dump
(
$id
);
var_dump
(
$id
);
}
}
public
function
actionQuotation
()
{
$bty
=
new
Bty
();
$bty
->
setQuotation
();
}
}
}
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