Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminApi4Tpl
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminApi4Tpl
Commits
ef61a914
Commit
ef61a914
authored
Oct 25, 2016
by
庄欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CURL客户端加了超时选项
parent
d0b85510
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
app/Http/Controllers/ControllerBase.php
+2
-3
app/Lib/Client/CurlClient.php
+4
-1
No files found.
app/Http/Controllers/ControllerBase.php
View file @
ef61a914
...
...
@@ -20,6 +20,7 @@ class ControllerBase
{
public
function
getAuth
()
{
return
3
;
return
request
(
"uuid"
,
3
);
static
$id
;
if
(
!
$id
)
{
...
...
@@ -41,9 +42,7 @@ class ControllerBase
$uid
=
$this
->
getAuth
();
$query
.=
"&uid="
.
$uid
;
}
$client
->
setUrl
(
$this
->
prefix
.
"?"
.
$query
);
$client
->
setMethod
(
"get"
);
$res
=
$client
->
curl
();
$res
=
$client
->
get
(
$this
->
prefix
.
"?"
.
$query
);
$res
=
$this
->
after_hook
(
$res
);
return
Response
::
success
(
$res
);
}
catch
(
\Exception
$e
)
{
...
...
app/Lib/Client/CurlClient.php
View file @
ef61a914
...
...
@@ -84,6 +84,7 @@ class CurlClient
curl_setopt
(
$http
,
CURLOPT_URL
,
$this
->
base
.
$this
->
url
);
curl_setopt
(
$http
,
CURLOPT_HEADER
,
false
);
curl_setopt
(
$http
,
CURLOPT_CUSTOMREQUEST
,
$this
->
method
);
curl_setopt
(
$http
,
CURLOPT_TIMEOUT
,
3
);
if
(
$this
->
format
==
"JSON"
)
{
$this
->
header
=
array_merge
(
$this
->
header
,[
'Content-Type:application/json'
]);
...
...
@@ -93,7 +94,9 @@ class CurlClient
curl_setopt
(
$http
,
CURLOPT_POST
,
true
);
}
curl_setopt
(
$http
,
CURLOPT_HTTPHEADER
,
$this
->
header
);
curl_setopt
(
$http
,
CURLOPT_POSTFIELDS
,
$this
->
data
);
if
(
!
empty
(
$this
->
data
))
{
curl_setopt
(
$http
,
CURLOPT_POSTFIELDS
,
$this
->
data
);
}
/*if ($this->method === "GET") {
$NOW_TIME = time();
static $response_from_api;
...
...
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