Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wxh_internal_api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
杨培培
wxh_internal_api
Commits
4bd23451
Commit
4bd23451
authored
Jun 28, 2017
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新部分参数名
parent
24d4dd7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
Client.php
src/base/Client.php
+7
-6
Server.php
src/base/Server.php
+1
-1
No files found.
src/base/Client.php
View file @
4bd23451
...
@@ -81,7 +81,7 @@ abstract class Client
...
@@ -81,7 +81,7 @@ abstract class Client
$url
=
$instance
->
apiUrl
.
(
strpos
(
$instance
->
apiUrl
,
'?'
)
!==
false
?
'&'
:
'?'
)
.
'api='
.
urlencode
(
$api
);
$url
=
$instance
->
apiUrl
.
(
strpos
(
$instance
->
apiUrl
,
'?'
)
!==
false
?
'&'
:
'?'
)
.
'api='
.
urlencode
(
$api
);
list
(
$sign
,
$timestamp
,
$nonce
)
=
$instance
->
signature
(
$api
,
$params
);
list
(
$sign
,
$timestamp
,
$nonce
)
=
$instance
->
signature
(
$api
,
$params
);
$url
.=
"&id=
{
$instance
->
clientId
}
&sign=
{
$sign
}
×tamp=
{
$timestamp
}
&nonce=
{
$nonce
}
"
;
$url
.=
"&
client_
id=
{
$instance
->
clientId
}
&sign=
{
$sign
}
×tamp=
{
$timestamp
}
&nonce=
{
$nonce
}
"
;
list
(
$httpCode
,
$response
)
=
$instance
->
request
(
$url
,
$params
);
list
(
$httpCode
,
$response
)
=
$instance
->
request
(
$url
,
$params
);
...
@@ -119,7 +119,7 @@ abstract class Client
...
@@ -119,7 +119,7 @@ abstract class Client
return
[
$sign
,
$timestamp
,
$nonce
];
return
[
$sign
,
$timestamp
,
$nonce
];
}
}
protected
function
request
(
$url
,
$post
=
''
,
$headers
=
array
())
{
protected
function
request
(
$url
,
$post
=
''
,
$headers
=
array
())
{
$ci
=
curl_init
();
$ci
=
curl_init
();
/* Curl settings */
/* Curl settings */
curl_setopt
(
$ci
,
CURLOPT_USERAGENT
,
'PHP/'
.
PHP_VERSION
.
' Client/'
.
$this
->
clientId
);
curl_setopt
(
$ci
,
CURLOPT_USERAGENT
,
'PHP/'
.
PHP_VERSION
.
' Client/'
.
$this
->
clientId
);
...
@@ -130,10 +130,11 @@ abstract class Client
...
@@ -130,10 +130,11 @@ abstract class Client
//curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
//curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt
(
$ci
,
CURLOPT_HEADER
,
FALSE
);
curl_setopt
(
$ci
,
CURLOPT_HEADER
,
FALSE
);
curl_setopt
(
$ci
,
CURLOPT_POST
,
TRUE
);
if
(
$post
)
{
curl_setopt
(
$ci
,
CURLOPT_POST
,
TRUE
);
$post
=
is_array
(
$post
)
?
http_build_query
(
$post
)
:
$post
;
$post
=
is_array
(
$post
)
?
http_build_query
(
$post
)
:
$post
;
$post
&&
curl_setopt
(
$ci
,
CURLOPT_POSTFIELDS
,
$post
);
$post
&&
curl_setopt
(
$ci
,
CURLOPT_POSTFIELDS
,
$post
);
}
curl_setopt
(
$ci
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ci
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ci
,
CURLOPT_HTTPHEADER
,
$headers
);
curl_setopt
(
$ci
,
CURLOPT_HTTPHEADER
,
$headers
);
...
...
src/base/Server.php
View file @
4bd23451
...
@@ -109,7 +109,7 @@ class Server
...
@@ -109,7 +109,7 @@ class Server
protected
function
checkSign
()
protected
function
checkSign
()
{
{
$api
=
isset
(
$_GET
[
'api'
])
?
$_GET
[
'api'
]
:
''
;
$api
=
isset
(
$_GET
[
'api'
])
?
$_GET
[
'api'
]
:
''
;
$clientId
=
isset
(
$_GET
[
'
id'
])
?
$_GET
[
'
id'
]
:
null
;
$clientId
=
isset
(
$_GET
[
'
client_id'
])
?
$_GET
[
'client_
id'
]
:
null
;
$sign
=
isset
(
$_GET
[
'sign'
])
?
$_GET
[
'sign'
]
:
''
;
$sign
=
isset
(
$_GET
[
'sign'
])
?
$_GET
[
'sign'
]
:
''
;
$timestamp
=
isset
(
$_GET
[
'timestamp'
])
?
$_GET
[
'timestamp'
]
:
0
;
$timestamp
=
isset
(
$_GET
[
'timestamp'
])
?
$_GET
[
'timestamp'
]
:
0
;
$nonce
=
isset
(
$_GET
[
'nonce'
])
?
$_GET
[
'nonce'
]
:
''
;
$nonce
=
isset
(
$_GET
[
'nonce'
])
?
$_GET
[
'nonce'
]
:
''
;
...
...
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