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
9eaa53d0
Commit
9eaa53d0
authored
Nov 04, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
ab9be1a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
TickerController.php
api/controllers/TickerController.php
+9
-2
HuobiBuilder.php
common/service/exchange/factory/HuobiBuilder.php
+13
-4
No files found.
api/controllers/TickerController.php
View file @
9eaa53d0
...
...
@@ -23,7 +23,7 @@ class TickerController extends BaseController
$platform_id
=
Yii
::
$app
->
request
->
get
(
'device_code'
,
0
);
$exchange
=
Yii
::
$app
->
request
->
get
(
'exchange'
,
'zhaobi'
);
$data_value
=
Yii
::
$app
->
request
->
get
(
'data-value'
,
''
);
$sort
=
Yii
::
$app
->
request
->
get
(
'sort
'
,
''
);
$sort
_value
=
Yii
::
$app
->
request
->
get
(
'sort-value
'
,
''
);
$exchange_arr
=
[
'huobi'
,
'binance'
,
'okex'
,
'zhaobi'
];
...
...
@@ -33,8 +33,15 @@ class TickerController extends BaseController
$data
=
[];
goto
doEnd
;
}
$condition
=
[];
if
(
false
!=
$data_value
&&
false
!=
$sort_value
)
{
$condition
=
[
'data_value'
=>
$data_value
,
'sort_value'
=>
$sort_value
];
}
$builder
=
ExchangeBuilderFactory
::
create
(
$exchange
);
$result
=
$builder
->
getTickerFromCache
(
$page
);
$result
=
$builder
->
getTickerFromCache
(
$page
,
$condition
);
$code
=
$result
[
'code'
];
$data
=
$result
[
'data'
];
...
...
common/service/exchange/factory/HuobiBuilder.php
View file @
9eaa53d0
...
...
@@ -39,7 +39,7 @@ class HuobiBuilder extends FactoryService
}
}
public
function
getTickerFromCache
(
$page
=
1
)
public
function
getTickerFromCache
(
$page
=
1
,
$condition
=
[]
)
{
$size
=
0
;
for
(
$i
=
0
;
$i
<
$page
;
$i
++
)
{
...
...
@@ -59,7 +59,16 @@ class HuobiBuilder extends FactoryService
}
}
}
$keys
=
$this
->
redis
->
lrange
(
$this
->
supported_symbol_list
,
$this
->
start
,
$this
->
end
);
if
(
false
!=
$condition
)
{
if
(
'price'
==
$condition
[
'data_value'
])
{
$keys
=
$this
->
redis
->
lrange
(
$this
->
supported_symbol_close_sort_list
,
$this
->
start
,
$this
->
end
);
}
if
(
'sort'
==
$condition
[
'data_value'
])
{
$keys
=
$this
->
redis
->
lrange
(
$this
->
supported_symbol_change_sort_list
,
$this
->
start
,
$this
->
end
);
}
}
else
{
$keys
=
$this
->
redis
->
lrange
(
$this
->
supported_symbol_list
,
$this
->
start
,
$this
->
end
);
}
$ticker
=
[];
foreach
(
$keys
as
$val
)
{
foreach
(
$this
->
basic_coin
as
$k
=>
$coin
)
{
...
...
@@ -112,11 +121,11 @@ class HuobiBuilder extends FactoryService
}
$ticker_sort_close
=
$this
->
arraySort
(
$ticker
,
'close'
);
foreach
(
$ticker_sort_close
as
$val
)
{
$this
->
redis
->
lpush
(
$this
->
supported_symbol_close_sort_list
,
$val
[
'symbol'
]
);
$this
->
redis
->
lpush
(
$this
->
supported_symbol_close_sort_list
,
strtolower
(
$val
[
'symbol'
])
);
}
$ticker_change_close
=
$this
->
arraySort
(
$ticker
,
'change'
);
foreach
(
$ticker_change_close
as
$val
)
{
$this
->
redis
->
lpush
(
$this
->
supported_symbol_change_sort_list
,
$val
[
'symbol'
]
);
$this
->
redis
->
lpush
(
$this
->
supported_symbol_change_sort_list
,
strtolower
(
$val
[
'symbol'
])
);
}
}
...
...
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