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
f145b786
Commit
f145b786
authored
Jul 04, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
金色财经接口
parent
c6c9aa19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
CoinDogController.php
api/controllers/CoinDogController.php
+66
-0
No files found.
api/controllers/CoinDogController.php
0 → 100644
View file @
f145b786
<?php
namespace
api\controllers
;
use
linslin\yii2\curl\Curl
;
use
Yii
;
use
api\base\BaseController
;
class
CoinDogController
extends
BaseController
{
public
function
actionArticle
()
{
$coindog
=
Yii
::
$app
->
params
[
'coindog'
];
$accessKey
=
$coindog
[
'accessKey'
];
$secretKey
=
$coindog
[
'secretKey'
];
$httpParams
=
array
(
'access_key'
=>
$accessKey
,
'date'
=>
time
()
);
$signParams
=
array_merge
(
$httpParams
,
array
(
'secret_key'
=>
$secretKey
));
ksort
(
$signParams
);
$signString
=
http_build_query
(
$signParams
);
$httpParams
[
'sign'
]
=
strtolower
(
md5
(
$signString
));
$url
=
$coindog
[
'article'
]
.
'?'
.
http_build_query
(
$httpParams
);
$curl
=
new
Curl
();
$resp
=
$curl
->
get
(
$url
,
false
);
return
[
'code'
=>
200
,
'data'
=>
$resp
,
'msg'
=>
'ok'
];
}
public
function
actionLive
()
{
$limit
=
Yii
::
$app
->
request
->
get
(
'limit'
,
20
);
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
$flag
=
Yii
::
$app
->
request
->
get
(
'flag'
,
'down'
);
$coindog
=
Yii
::
$app
->
params
[
'coindog'
];
$accessKey
=
$coindog
[
'accessKey'
];
$secretKey
=
$coindog
[
'secretKey'
];
$httpParams
=
array
(
'access_key'
=>
$accessKey
,
'date'
=>
time
()
);
$signParams
=
array_merge
(
$httpParams
,
array
(
'secret_key'
=>
$secretKey
));
ksort
(
$signParams
);
$signString
=
http_build_query
(
$signParams
);
$httpParams
[
'sign'
]
=
strtolower
(
md5
(
$signString
));
$httpParams
[
'limit'
]
=
$limit
;
$httpParams
[
'id'
]
=
$id
;
$httpParams
[
'flag'
]
=
$flag
;
$url
=
$coindog
[
'live'
]
.
'?'
.
http_build_query
(
$httpParams
);
$curl
=
new
Curl
();
$resp
=
$curl
->
get
(
$url
,
false
);
echo
json_encode
(
$resp
);
exit
;
}
}
\ 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