Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pay
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
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
bp
pay
Commits
619e9335
Commit
619e9335
authored
Aug 07, 2021
by
wanjilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 优化pingxx报错,简化 raw json处理
parent
390161ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
Hook.php
application/plugins/Hook.php
+14
-16
PingxxService.php
application/services/pingxx/PingxxService.php
+2
-2
No files found.
application/plugins/Hook.php
View file @
619e9335
...
@@ -4,6 +4,7 @@ namespace App\Plugins;
...
@@ -4,6 +4,7 @@ namespace App\Plugins;
use
App\Exception\ExceptionErrorCatch
;
use
App\Exception\ExceptionErrorCatch
;
use
Helpers\DebugLog
;
use
Helpers\DebugLog
;
use
Api\PhpUtils\Log\FileLog
;
class
Hook
extends
\Yaf\Plugin_Abstract
{
class
Hook
extends
\Yaf\Plugin_Abstract
{
...
@@ -45,23 +46,20 @@ class Hook extends \Yaf\Plugin_Abstract {
...
@@ -45,23 +46,20 @@ class Hook extends \Yaf\Plugin_Abstract {
}
}
public
function
preDispatch
(
\Yaf\Request_Abstract
$request
,
\Yaf\Response_Abstract
$response
)
{
public
function
preDispatch
(
\Yaf\Request_Abstract
$request
,
\Yaf\Response_Abstract
$response
)
{
//
处理$_POST, $_REQUEST请求,兼容application/json形式
//
application/json形式,仅处理$_POST, 不整合$_GET, $_REQUEST
if
(
!
$_POST
&&
$request
->
isPost
()
if
(
$request
->
isPost
()
&&
$request
->
getServer
(
'CONTENT_TYPE'
)
==
'application/json'
)
{
&&
$request
->
getServer
(
'CONTENT_TYPE'
)
==
'application/json'
)
{
$jsonPost
=
file_get_contents
(
"php://input"
);
$jsonPost
=
file_get_contents
(
"php://input"
);
if
(
false
&&
$jsonPost
)
{
if
(
empty
(
$jsonPost
))
{
$_POST
=
json_decode
(
$jsonPost
,
true
);
$_POST
=
[];
$ini
=
ini_get
(
'request_order'
);
return
true
;
if
(
$ini
)
{
$arrIni
=
str_split
(
$ini
,
1
);
foreach
(
$arrIni
as
$type
)
{
if
(
strtoupper
(
$type
)
===
'G'
)
{
$_REQUEST
=
array_merge
(
$_REQUEST
,
$_GET
);
}
elseif
(
strtoupper
(
$type
)
===
'P'
)
{
$_REQUEST
=
array_merge
(
$_REQUEST
,
$_POST
);
}
}
}
}
$_POST
=
json_decode
(
$jsonPost
,
true
);
if
(
!
is_array
(
$_POST
))
{
$_POST
=
[];
FileLog
::
error
(
'bp-gateway'
,
'json decode error raw:'
.
$jsonPost
);
}
}
}
}
}
}
...
...
application/services/pingxx/PingxxService.php
View file @
619e9335
...
@@ -167,7 +167,7 @@ class PingxxService
...
@@ -167,7 +167,7 @@ class PingxxService
'type'
=>
'http error'
,
'type'
=>
'http error'
,
];
];
}
}
FileLog
::
error
(
'pingxx-createOrder:'
.
'创建订单返回'
,
json_encode
([
'req'
=>
[
$order
,
$metadata
],
'res'
=>
$re
t
],
JSON_UNESCAPED_UNICODE
),
$e
);
FileLog
::
error
(
'pingxx-createOrder:'
.
'创建订单返回'
,
json_encode
([
'req'
=>
[
$order
,
$metadata
],
'res'
=>
$re
spose
],
JSON_UNESCAPED_UNICODE
),
$e
);
/**
/**
{
{
"error": {
"error": {
...
@@ -246,7 +246,7 @@ class PingxxService
...
@@ -246,7 +246,7 @@ class PingxxService
'type'
=>
'http error'
,
'type'
=>
'http error'
,
];
];
}
}
FileLog
::
error
(
'pingxx-pay:'
.
'查询订单返回'
,
json_encode
([
'req'
=>
[
$orderId
],
'res'
=>
$re
t
],
JSON_UNESCAPED_UNICODE
),
$e
);
FileLog
::
error
(
'pingxx-pay:'
.
'查询订单返回'
,
json_encode
([
'req'
=>
[
$orderId
],
'res'
=>
$re
spose
],
JSON_UNESCAPED_UNICODE
),
$e
);
}
}
return
$respose
;
return
$respose
;
...
...
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