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
136a7412
Commit
136a7412
authored
Jul 06, 2017
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复接口调用错误
接口报错时显示详细的接口
parent
2008066c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
Client.php
src/base/Client.php
+6
-6
No files found.
src/base/Client.php
View file @
136a7412
...
@@ -109,10 +109,10 @@ class Client
...
@@ -109,10 +109,10 @@ class Client
list
(
$httpCode
,
$response
)
=
$instance
->
request
(
$url
,
$params
);
list
(
$httpCode
,
$response
)
=
$instance
->
request
(
$url
,
$params
);
if
(
$httpCode
==
200
&&
$response
)
{
if
(
$httpCode
==
200
&&
$response
!==
false
)
{
$data
=
@
json_decode
(
$response
,
true
);
$data
=
@
json_decode
(
$response
,
true
);
if
(
json_last_error
()
!==
JSON_ERROR_NONE
)
{
if
(
json_last_error
()
!==
JSON_ERROR_NONE
)
{
throw
new
ClientException
(
'接口返回数据异常: '
.
$response
);
throw
new
ClientException
(
"接口
$api
返回数据异常: "
.
$response
);
}
}
return
$data
;
return
$data
;
}
}
...
@@ -128,11 +128,11 @@ class Client
...
@@ -128,11 +128,11 @@ class Client
throw
new
ApiException
(
"
{
$e
[
'class'
]
}
:
{
$e
[
'message'
]
}
"
,
$e
[
'code'
]);
throw
new
ApiException
(
"
{
$e
[
'class'
]
}
:
{
$e
[
'message'
]
}
"
,
$e
[
'code'
]);
}
}
if
(
$httpCode
===
0
)
{
if
(
$httpCode
==
0
)
{
throw
new
ClientException
(
'接口请求异常: '
.
$response
,
$httpCode
);
throw
new
ClientException
(
"接口
$api
请求异常: "
.
$response
);
}
else
{
throw
new
ClientException
(
"接口
$api
响应异常: "
.
$response
,
$httpCode
);
}
}
throw
new
ClientException
(
'接口响应异常: '
.
$response
,
$httpCode
);
}
}
/**
/**
...
...
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