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
112df354
Commit
112df354
authored
Aug 20, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
交易所公告
parent
414a32a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
4 deletions
+52
-4
NoticeController.php
api/controllers/NoticeController.php
+27
-4
ZhaobiBuilder.php
common/service/exchange/factory/ZhaobiBuilder.php
+25
-0
No files found.
api/controllers/NoticeController.php
View file @
112df354
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
namespace
api\controllers
;
namespace
api\controllers
;
use
common\service\exchange\ExchangeBuilderFactory
;
use
Yii
;
use
Yii
;
use
api\base\BaseController
;
use
api\base\BaseController
;
use
common\models\pwallet\Notice
;
use
common\models\pwallet\Notice
;
...
@@ -29,10 +30,10 @@ class NoticeController extends BaseController
...
@@ -29,10 +30,10 @@ class NoticeController extends BaseController
*/
*/
public
function
actionList
()
public
function
actionList
()
{
{
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
post
(
'page'
,
1
);
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
10
);
$limit
=
$request
->
post
(
'limit'
,
10
);
$post
=
$request
->
post
();
$post
=
$request
->
post
();
$condition
=
[];
$condition
=
[];
$post
=
array_filter
(
$post
,
function
(
$value
,
$key
)
{
$post
=
array_filter
(
$post
,
function
(
$value
,
$key
)
{
...
@@ -65,4 +66,25 @@ class NoticeController extends BaseController
...
@@ -65,4 +66,25 @@ class NoticeController extends BaseController
$data
=
Notice
::
getList
(
$page
,
$limit
,
$condition
);
$data
=
Notice
::
getList
(
$page
,
$limit
,
$condition
);
return
$data
;
return
$data
;
}
}
public
function
actionIndex
()
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
''
);
$exchange
=
Yii
::
$app
->
request
->
get
(
'exchange'
,
'zhaobi'
);
$exchange_arr
=
[
'huobi'
,
'binance'
,
'okex'
,
'zhaobi'
];
if
(
!
in_array
(
$exchange
,
$exchange_arr
))
{
$msg
=
'不存在的交易平台'
;
$code
=
-
1
;
$data
=
[];
goto
doEnd
;
}
$builder
=
ExchangeBuilderFactory
::
create
(
$exchange
);
$result
=
$builder
->
getNotice
(
$id
);
$code
=
$result
[
'code'
];
$data
=
$result
[
'notice'
];
$msg
=
isset
(
$result
[
'msg'
])
?
$result
[
'msg'
]
:
'success'
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
}
\ No newline at end of file
common/service/exchange/factory/ZhaobiBuilder.php
View file @
112df354
...
@@ -46,4 +46,28 @@ class ZhaobiBuilder extends FactoryService
...
@@ -46,4 +46,28 @@ class ZhaobiBuilder extends FactoryService
}
}
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
}
}
public
function
getNotice
(
$id
=
''
)
{
$curl
=
new
Curl
();
if
(
!
empty
(
$id
))
{
$api
=
$this
->
base_url
.
'/api/data/noticedetail?id='
.
$id
;
$res
=
$curl
->
get
(
$api
,
false
);
if
(
isset
(
$res
[
'message'
])
&&
'OK'
==
$res
[
'message'
])
{
$this
->
code
=
0
;
return
[
'code'
=>
$this
->
code
,
'notice'
=>
$res
[
'data'
]];
}
else
{
return
[
'code'
=>
$this
->
code
,
'notice'
=>
$res
[
'data'
],
'msg'
=>
$res
[
'message'
]];
}
}
$api
=
$this
->
base_url
.
'/api/data/noticelist'
;
$res
=
$curl
->
get
(
$api
,
false
);
$notice
=
[];
if
(
isset
(
$res
[
'message'
])
&&
'OK'
==
$res
[
'message'
])
{
$this
->
code
=
0
;
$notice
=
$res
[
'data'
][
'rows'
];
}
return
[
'code'
=>
$this
->
code
,
'notice'
=>
$notice
];
}
}
}
\ 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