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
61d36d52
Commit
61d36d52
authored
Sep 27, 2021
by
wanjilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: fix bug
parent
c6f6a040
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
33 deletions
+32
-33
PayException.php
application/exception/custom/PayException.php
+4
-1
Sdk.php
application/library/Helpers/Sdk.php
+4
-0
PayService.php
application/services/pay/PayService.php
+24
-32
No files found.
application/exception/custom/PayException.php
View file @
61d36d52
...
@@ -35,7 +35,10 @@ class PayException extends BaseException
...
@@ -35,7 +35,10 @@ class PayException extends BaseException
21
=>
'保存核销单失败,请重试'
,
21
=>
'保存核销单失败,请重试'
,
22
=>
'保存核销子单失败,请重试'
,
22
=>
'保存核销子单失败,请重试'
,
23
=>
'保存核销结算失败,请重试'
,
23
=>
'保存核销结算失败,请重试'
,
24
=>
'更新子单结算状态失败,请管理员关注'
,
24
=>
'更新结算状态失败,请管理员关注'
,
25
=>
'更新子单结算状态失败,请管理员关注'
,
26
=>
'同步商户资产失败'
,
27
=>
'同步商户资产失败'
,
100
=>
'支付渠道错误,暂不支持该渠道'
,
100
=>
'支付渠道错误,暂不支持该渠道'
,
101
=>
'该订单已经支付,请稍后刷新'
,
101
=>
'该订单已经支付,请稍后刷新'
,
...
...
application/library/Helpers/Sdk.php
View file @
61d36d52
...
@@ -46,6 +46,10 @@ class Sdk {
...
@@ -46,6 +46,10 @@ class Sdk {
FileLog
::
info
(
'sdk api:'
,
json_encode
([
'url'
=>
$url
,
'req'
=>
$params
,
'res'
=>
$data
]));
FileLog
::
info
(
'sdk api:'
,
json_encode
([
'url'
=>
$url
,
'req'
=>
$params
,
'res'
=>
$data
]));
if
(
!
isset
(
$data
[
'response'
][
'code'
]))
{
throw
new
BaseException
([
'msg'
=>
$data
[
'response'
][
'reason'
]
??
''
,
'code'
=>
3031
]);
}
if
(
!
empty
(
$data
[
'response'
][
'code'
]))
{
if
(
!
empty
(
$data
[
'response'
][
'code'
]))
{
throw
new
BaseException
([
'msg'
=>
$data
[
'response'
][
'reason'
]
??
''
,
'code'
=>
$data
[
'response'
][
'code'
]]);
throw
new
BaseException
([
'msg'
=>
$data
[
'response'
][
'reason'
]
??
''
,
'code'
=>
$data
[
'response'
][
'code'
]]);
}
}
...
...
application/services/pay/PayService.php
View file @
61d36d52
...
@@ -130,8 +130,8 @@ class PayService
...
@@ -130,8 +130,8 @@ class PayService
'pay_channel'
=>
$pay_method_id
,
'pay_channel'
=>
$pay_method_id
,
'third_order_id'
=>
''
,
'third_order_id'
=>
''
,
'expire_time'
=>
date
(
'Y-m-d H:i:s'
,
$pay_expiration_time
),
'expire_time'
=>
date
(
'Y-m-d H:i:s'
,
$pay_expiration_time
),
'source_name'
=>
1
0
,
'source_name'
=>
1
,
'service_name'
=>
1
,
'service_name'
=>
1
0
,
'business_from'
=>
$order
[
'business_from'
],
'business_from'
=>
$order
[
'business_from'
],
'extra'
=>
json_encode
([]),
'extra'
=>
json_encode
([]),
];
];
...
@@ -472,6 +472,8 @@ class PayService
...
@@ -472,6 +472,8 @@ class PayService
'writeoff_order_id'
=>
$writeOff_order_id
,
'writeoff_order_id'
=>
$writeOff_order_id
,
'user_id'
=>
$pay_order
[
'user_id'
],
'user_id'
=>
$pay_order
[
'user_id'
],
'order_id'
=>
$pay_order
[
'order_id'
],
'order_id'
=>
$pay_order
[
'order_id'
],
'source_name'
=>
$pay_order
[
'source_name'
],
'service_name'
=>
$pay_order
[
'service_name'
],
'writeoff_status'
=>
0
,
'writeoff_status'
=>
0
,
],
[
'rowCount'
=>
true
]);
],
[
'rowCount'
=>
true
]);
if
(
$cnt
==
false
)
{
if
(
$cnt
==
false
)
{
...
@@ -495,6 +497,12 @@ class PayService
...
@@ -495,6 +497,12 @@ class PayService
if
(
$cnt
==
false
)
{
if
(
$cnt
==
false
)
{
throw
new
PayException
([
'cus'
=>
23
]);
throw
new
PayException
([
'cus'
=>
23
]);
}
}
$cnt
=
$cnt
&&
WriteOffOrder
::
update
([
'writeoff_status'
=>
2
,
],[
'writeoff_order_id'
=>
$writeOff_order_id
]);
if
(
$cnt
==
false
)
{
throw
new
PayException
([
'cus'
=>
24
]);
}
PayOrderItem
::
update
([
PayOrderItem
::
update
([
'notify_account_status'
=>
0
,
'notify_account_status'
=>
0
,
...
@@ -504,7 +512,7 @@ class PayService
...
@@ -504,7 +512,7 @@ class PayService
$err
=
PayOrderItem
::
getMaster
(
'*'
,
[
'order_item_id'
=>
$item_ids
,
'can_notify_account'
=>
0
,
'refund_order_status'
=>
0
]);
$err
=
PayOrderItem
::
getMaster
(
'*'
,
[
'order_item_id'
=>
$item_ids
,
'can_notify_account'
=>
0
,
'refund_order_status'
=>
0
]);
if
(
$err
)
{
if
(
$err
)
{
throw
new
PayException
([
'cus'
=>
2
4
]);
throw
new
PayException
([
'cus'
=>
2
5
]);
}
}
PayOrderItem
::
commit
();
PayOrderItem
::
commit
();
...
@@ -534,16 +542,15 @@ class PayService
...
@@ -534,16 +542,15 @@ class PayService
public
function
sync_account_wallet
(
$writeOff_order_id
)
{
public
function
sync_account_wallet
(
$writeOff_order_id
)
{
$p_cnt
=
$u_cnt
=
$m_cnt
=
true
;
$p_cnt
=
$u_cnt
=
$m_cnt
=
true
;
/*
/*
*/
//修改状态为执行中
//修改状态为执行中
$cnt
=
WriteOffOrder
::
update
([
$cnt
=
WriteOffOrder
::
update
([
'notify_account_status'
=>
1
,
'notify_account_status'
=>
1
,
],
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'writeoff_status'
=>
2
,
'notify_account_status'
=>
0
]);
],
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'writeoff_status'
=>
2
,
'notify_account_status'
=>
0
]);
if
(
!
$cnt
)
{
//乐观锁,不满足条件不处理
if
(
!
$cnt
)
{
//乐观锁,不满足条件不处理
return
true
;
return
true
;
}
}
*/
//平台收入入账
//平台收入入账
$p
=
WriteOffPlatformRecord
::
getMaster
(
'*'
,
$p
=
WriteOffPlatformRecord
::
getMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
...
@@ -563,8 +570,8 @@ class PayService
...
@@ -563,8 +570,8 @@ class PayService
foreach
(
$us
as
$u
)
{
foreach
(
$us
as
$u
)
{
$w_list
[]
=
[
$w_list
[]
=
[
'user_id'
=>
$u
[
'account_id'
],
'user_id'
=>
$u
[
'account_id'
],
's
ervice_name'
=>
10
,
's
ource_name'
=>
$u
[
'source_name'
]
,
's
ource_name'
=>
1
,
's
ervice_name'
=>
$u
[
'service_name'
]
,
'amount'
=>
$u
[
'payment'
],
'amount'
=>
$u
[
'payment'
],
'third_order_id'
=>
$u
[
'writeoff_personal_id'
],
'third_order_id'
=>
$u
[
'writeoff_personal_id'
],
'third_order_id_type'
=>
105
,
'third_order_id_type'
=>
105
,
...
@@ -580,6 +587,7 @@ class PayService
...
@@ -580,6 +587,7 @@ class PayService
],
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
],
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
FileLog
::
error
(
'bp-pay'
,
json_encode
([
'writeoff_order_id'
=>
$writeOff_order_id
,
'error'
=>
'同步钱包失败'
]));
$u_cnt
=
false
;
$u_cnt
=
false
;
}
}
}
}
...
@@ -595,29 +603,33 @@ class PayService
...
@@ -595,29 +603,33 @@ class PayService
'source_name'
=>
$m
[
'source_name'
],
'source_name'
=>
$m
[
'source_name'
],
'service_name'
=>
$m
[
'service_name'
],
'service_name'
=>
$m
[
'service_name'
],
'writeoff_order_id'
=>
$m
[
'writeoff_order_id'
],
'writeoff_order_id'
=>
$m
[
'writeoff_order_id'
],
'order_id'
=>
$m
[
'order_id'
],
'third_order_title'
=>
$m
[
'title'
],
'third_order_title'
=>
$m
[
'title'
],
'third_order_desc'
=>
$m
[
'desc'
],
'third_order_desc'
=>
$m
[
'desc'
],
'third_order_type'
=>
$m
[
'business_from'
],
'third_order_type'
=>
$m
[
'business_from'
],
'amount'
=>
$m
[
'payment'
],
'amount'
=>
$m
[
'payment'
],
]);
]);
$m_cnt
=
$m_cnt
&&
WriteOff
Platform
Record
::
update
([
$m_cnt
=
$m_cnt
&&
WriteOff
Merchant
Record
::
update
([
'notify_account_status'
=>
2
,
'notify_account_status'
=>
2
,
'notify_account_success_time'
=>
date
(
'Y-m-d H:i:s'
),
'notify_account_success_time'
=>
date
(
'Y-m-d H:i:s'
),
],
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
],
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
FileLog
::
error
(
'bp-pay'
,
json_encode
([
'writeoff_order_id'
=>
$writeOff_order_id
,
'error'
=>
'同步商户钱包失败'
]));
$m_cnt
=
false
;
$m_cnt
=
false
;
}
}
}
}
var_dump
(
$m_cnt
,
$u_cnt
,
$p_cnt
);
if
(
$m_cnt
&&
$u_cnt
&&
$p_cnt
)
{
if
(
$m_cnt
&&
$u_cnt
&&
$p_cnt
)
{
WriteOffOrder
::
update
([
WriteOffOrder
::
update
([
'notify_account_status'
=>
2
,
'notify_account_status'
=>
2
,
'notify_account_success_time'
=>
date
(
'Y-m-d H:i:s'
),
'notify_account_success_time'
=>
date
(
'Y-m-d H:i:s'
),
],
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status'
=>
1
]);
],
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status'
=>
1
]);
}
else
{
}
else
{
$info
=
WriteOffOrder
::
getMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
$info
=
WriteOffOrder
::
getMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
$next
=
$this
->
getNextTime
(
$info
[
'notify_account_times'
]);
$next
=
$this
->
getNextTime
(
$info
[
'notify_account_times'
]);
...
@@ -649,6 +661,8 @@ class PayService
...
@@ -649,6 +661,8 @@ class PayService
'pay_order_id'
=>
$r
[
'pay_order_id'
],
'pay_order_id'
=>
$r
[
'pay_order_id'
],
'order_id'
=>
$r
[
'order_id'
],
'order_id'
=>
$r
[
'order_id'
],
'user_id'
=>
$r
[
'account_id'
],
'user_id'
=>
$r
[
'account_id'
],
'source_name'
=>
$pay_order
[
'source_name'
],
'service_name'
=>
$pay_order
[
'service_name'
],
'payment'
=>
0
,
'payment'
=>
0
,
];
];
}
}
...
@@ -1116,28 +1130,6 @@ class PayService
...
@@ -1116,28 +1130,6 @@ class PayService
return
$this
->
gen_ids
;
return
$this
->
gen_ids
;
}
}
private
function
get_merchant_account
(
$params
)
{
/*
///account/account/get_account
$url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
if (!$url) {
throw new CodeSpecialException("failed" . __METHOD__);
}
*/
$url
=
'http://account.dev.yidian-inc.com'
.
"/account/account/get_account"
;
$ret
=
Sdk
::
call
(
$url
,
[
'life_account_id'
=>
$params
[
'life_account_id'
],
'shop_id'
=>
$params
[
'shop_id'
],
'source_name'
=>
$params
[
'source_name'
],
'service_name'
=>
$params
[
'service_name'
],
]);
if
(
empty
(
$ret
[
'result'
]))
{
throw
new
PayException
([
'cus'
=>
9
]);
}
return
$ret
[
'result'
];
}
private
function
getNextTime
(
$times
=
0
)
{
private
function
getNextTime
(
$times
=
0
)
{
return
time
()
+
pow
(
3
,
$times
+
1
);
return
time
()
+
pow
(
3
,
$times
+
1
);
}
}
...
...
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