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
cb229e7c
Commit
cb229e7c
authored
Jul 07, 2021
by
wanjilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 增加服务报错日志
parent
78b6760a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
8 deletions
+40
-8
Code.php
application/exception/custom/Code.php
+2
-2
SdkException.php
application/exception/custom/SdkException.php
+17
-0
Sdk.php
application/library/Helpers/Sdk.php
+18
-3
PayService.php
application/services/pay/PayService.php
+2
-2
WalletService.php
application/services/wallet/WalletService.php
+1
-1
No files found.
application/exception/custom/Code.php
View file @
cb229e7c
...
@@ -13,6 +13,6 @@ class Code
...
@@ -13,6 +13,6 @@ class Code
{
{
const
PAY
=
101000
;
const
PAY
=
101000
;
const
REFUND
=
102000
;
const
REFUND
=
102000
;
const
ORDER
=
103000
;
const
ORDER
=
103000
;
const
WALLET
=
104000
;
const
SDK
=
104000
;
}
}
\ No newline at end of file
application/exception/custom/SdkException.php
0 → 100644
View file @
cb229e7c
<?php
namespace
App\Exception\custom
;
use
App\Exception\BaseException
;
class
SdkException
extends
BaseException
{
protected
$base_code
=
Code
::
SDK
;
protected
$cus
=
[
0
=>
'api URL不存在,请核对配置'
,
1
=>
'sdk返回错误'
,
];
}
application/library/Helpers/Sdk.php
View file @
cb229e7c
...
@@ -26,10 +26,25 @@ class Sdk {
...
@@ -26,10 +26,25 @@ class Sdk {
$headers = array_merge($headers, $header);
$headers = array_merge($headers, $header);
*/
*/
$data
=
(
new
Request
())
->
post
(
$url
,
$params
,
3000
,
'json'
);
$data
=
(
new
Request
())
->
post
(
$url
,
$params
,
2000
,
'json'
);
//$data['response'];
//var_export($data);
FileLog
::
info
(
'sdk_call:'
.
'services return'
,
json_encode
([
'url'
=>
$url
,
$headers
,
'req'
=>
$params
,
'res'
=>
$data
]));
FileLog
::
info
(
'sdk_call:'
.
'services return'
,
json_encode
([
'url'
=>
$url
,
$headers
,
'req'
=>
$params
,
'res'
=>
$data
]));
/*
[
"http_code"=> 200,
"code"=> 0,
"response"=> [
"code"=> 102002,
"status"=> "failed",
"reason"=> "暂未开通钱包"
]
]
*/
if
(
!
empty
(
$data
[
'response'
][
'code'
]))
{
throw
new
\Exception
(
$data
[
'response'
][
'reason'
],
$data
[
'response'
][
'code'
]);
}
return
$data
[
'response'
];
return
$data
[
'response'
];
}
}
}
}
\ No newline at end of file
application/services/pay/PayService.php
View file @
cb229e7c
...
@@ -264,7 +264,7 @@ class PayService
...
@@ -264,7 +264,7 @@ class PayService
try
{
try
{
if
(
$wallet_list
)
{
//同步成功,返回结果
if
(
$wallet_list
)
{
//同步成功,返回结果
WalletService
::
send
(
$wallet_list
);
WalletService
::
send
(
[
'list'
=>
$wallet_list
]
);
}
}
PayOrderItem
::
update
([
PayOrderItem
::
update
([
'notify_account_status'
=>
2
,
'notify_account_status'
=>
2
,
...
@@ -272,7 +272,7 @@ class PayService
...
@@ -272,7 +272,7 @@ class PayService
],
[
'order_item_id'
=>
$order_item_id
,
'can_notify_account'
=>
1
]);
],
[
'order_item_id'
=>
$order_item_id
,
'can_notify_account'
=>
1
]);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
FileLog
::
error
(
'wallet: 钱包同步失败'
.
$e
->
getMessage
(),
json_encode
(
$wallet_list
)
);
FileLog
::
error
(
'wallet: 钱包同步失败'
,
json_encode
(
$wallet_list
),
$e
);
//补偿处理
//补偿处理
PayOrderItem
::
update
([
PayOrderItem
::
update
([
'notify_account_status'
=>
0
,
'notify_account_status'
=>
0
,
...
...
application/services/wallet/WalletService.php
View file @
cb229e7c
...
@@ -18,7 +18,7 @@ class WalletService
...
@@ -18,7 +18,7 @@ class WalletService
*/
*/
public
static
function
send
(
$params
)
{
public
static
function
send
(
$params
)
{
$url
=
config
(
'interface'
,
'wallet.
wallet.recharge
'
);
$url
=
config
(
'interface'
,
'wallet.
account.transfer
'
);
if
(
!
$url
)
{
if
(
!
$url
)
{
throw
new
CodeSpecialException
(
"failed"
);
throw
new
CodeSpecialException
(
"failed"
);
}
}
...
...
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