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
511353b3
Commit
511353b3
authored
Sep 01, 2021
by
万继龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refund_wanjl_0818' into 'master'
Refund wanjl 0818 See merge request bp/pay!67
parents
d03c6b68
c7abd980
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
91 deletions
+133
-91
RefundException.php
application/exception/custom/RefundException.php
+3
-0
PayOrderClearingItem.php
application/models/order/mysql/PayOrderClearingItem.php
+4
-2
Order.php
application/modules/Pay/controllers/Order.php
+16
-5
Hook.php
application/plugins/Hook.php
+4
-1
PayService.php
application/services/pay/PayService.php
+20
-13
RefundService.php
application/services/refund/RefundService.php
+84
-70
application.ini
conf/application.ini
+2
-0
No files found.
application/exception/custom/RefundException.php
View file @
511353b3
...
@@ -26,5 +26,8 @@ class RefundException extends BaseException
...
@@ -26,5 +26,8 @@ class RefundException extends BaseException
11
=>
'pingxx退单缺少matadata!'
,
11
=>
'pingxx退单缺少matadata!'
,
12
=>
'pingxx未支付订单不允许退款。'
,
12
=>
'pingxx未支付订单不允许退款。'
,
13
=>
'pingxx订单可能存在多次成功支付,需人工确认处理。'
,
13
=>
'pingxx订单可能存在多次成功支付,需人工确认处理。'
,
14
=>
'不存在满足条件的退款订单。'
,
15
=>
'订单未支付或不存在,请核对。'
,
16
=>
'订单退款回调处理失败,请核对。'
,
];
];
}
}
application/models/order/mysql/PayOrderClearingItem.php
View file @
511353b3
...
@@ -21,11 +21,12 @@ class PayOrderClearingItem extends MysqlBase
...
@@ -21,11 +21,12 @@ class PayOrderClearingItem extends MysqlBase
return
$ret
;
return
$ret
;
}
}
/*
/*
*/
$sql
=
"select sum(poci.`pay_amount`) as 'pay_amount', notify_account_status from pay_order_clearing_item poci
$sql
=
"select sum(poci.`pay_amount`) as 'pay_amount', notify_account_status from pay_order_clearing_item poci
join pay_order_item poi on poi.`order_item_id` = poci.`order_item_id`
join pay_order_item poi on poi.`order_item_id` = poci.`order_item_id`
where poci.pay_sub_type = 105 and poci.account_id = ? and poi.refund_order_status = 0 group by notify_account_status "
;
where poci.pay_sub_type = 105 and poci.account_id = ? and poi.refund_order_status = 0 group by notify_account_status "
;
*/
/*
$sql = "select sum(poci.`pay_amount`) as 'pay_amount',
$sql = "select sum(poci.`pay_amount`) as 'pay_amount',
notify_account_status from pay_order_clearing_item poci
notify_account_status from pay_order_clearing_item poci
join pay_order_item poi on poi.`order_item_id` = poci.`order_item_id`
join pay_order_item poi on poi.`order_item_id` = poci.`order_item_id`
...
@@ -33,6 +34,7 @@ where
...
@@ -33,6 +34,7 @@ where
not exists (select 1 from refund_order ro where ro.`order_item_id` = poci.`order_item_id`) and
not exists (select 1 from refund_order ro where ro.`order_item_id` = poci.`order_item_id`) and
poci.pay_sub_type = 105 and poci.account_id = ?
poci.pay_sub_type = 105 and poci.account_id = ?
group by notify_account_status ";
group by notify_account_status ";
*/
/*
/*
type=1: 该团长历史累计分销佣金收入总和
type=1: 该团长历史累计分销佣金收入总和
...
...
application/modules/Pay/controllers/Order.php
View file @
511353b3
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
use
App\Base\Base
;
use
App\Base\Base
;
use
App\Exception\custom\PayException
;
use
App\Services\pay\PayService
;
use
App\Services\pay\PayService
;
use
App\Services\refund\RefundService
;
use
App\Services\refund\RefundService
;
use
Api\PhpUtils\Log\FileLog
;
use
Api\PhpUtils\Log\FileLog
;
...
@@ -39,15 +40,25 @@ class OrderController extends Base
...
@@ -39,15 +40,25 @@ class OrderController extends Base
public
function
refundAction
()
{
public
function
refundAction
()
{
$params
=
$this
->
params
;
$params
=
$this
->
getRequest
()
->
getPost
();
$user_id
=
$params
[
'user_id'
];
$order_item_id
=
$params
[
'order_item_id'
];
if
(
!
empty
(
$params
[
'order_item_id'
]))
{
if
(
!
is_array
(
$params
[
'order_item_id'
]))
{
$params
[
'order_item_id'
]
=
explode
(
','
,
$params
[
'order_item_id'
]);
}
}
else
{
$params
[
'order_item_id'
]
=
[];
}
if
(
empty
(
$params
[
'order_id'
]))
{
throw
new
PayException
([
'cus'
=>
1
]);
}
$refundSrv
=
new
RefundService
();
$refundSrv
=
new
RefundService
();
$ret
=
$refundSrv
->
do_refund
(
$
order_item_id
,
$user_id
);
$ret
=
$refundSrv
->
do_refund
(
$
params
[
'order_id'
],
$params
[
'order_item_id'
]
);
$this
->
success
([
'result'
=>
$ret
]);
$this
->
success
([
'result'
=>
$ret
]);
}
}
public
function
write_offAction
()
{
public
function
write_offAction
()
{
...
...
application/plugins/Hook.php
View file @
511353b3
...
@@ -46,7 +46,7 @@ class Hook extends \Yaf\Plugin_Abstract {
...
@@ -46,7 +46,7 @@ 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
)
{
// application/json形式,仅处理$_POST, 不整合$_GET
, $_REQUEST
// application/json形式,仅处理$_POST, 不整合$_GET
if
(
$request
->
isPost
()
if
(
$request
->
isPost
()
&&
$request
->
getServer
(
'CONTENT_TYPE'
)
==
'application/json'
)
{
&&
$request
->
getServer
(
'CONTENT_TYPE'
)
==
'application/json'
)
{
...
@@ -57,10 +57,13 @@ class Hook extends \Yaf\Plugin_Abstract {
...
@@ -57,10 +57,13 @@ class Hook extends \Yaf\Plugin_Abstract {
}
}
$_POST
=
json_decode
(
$jsonPost
,
true
);
$_POST
=
json_decode
(
$jsonPost
,
true
);
if
(
!
is_array
(
$_POST
))
{
if
(
!
is_array
(
$_POST
))
{
$_POST
=
[];
$_POST
=
[];
FileLog
::
error
(
'bp-gateway'
,
'json decode error raw:'
.
$jsonPost
);
FileLog
::
error
(
'bp-gateway'
,
'json decode error raw:'
.
$jsonPost
);
}
}
$_REQUEST
=
array_merge
(
$_REQUEST
,
$_POST
);
}
}
}
}
...
...
application/services/pay/PayService.php
View file @
511353b3
...
@@ -265,20 +265,24 @@ class PayService
...
@@ -265,20 +265,24 @@ class PayService
$title
=
''
;
$title
=
''
;
}
}
try
{
try
{
//通知消息
//通知消息
$app_id
=
'wx65e9ba99c333444f'
;
$app_id
=
'wx65e9ba99c333444f'
;
$template_id
=
'EzOH2ZpfW-eUdFf9gzjZTAv-Z9PFmKHNsQ0VOGvvN7c'
;
$template_id
=
'EzOH2ZpfW-eUdFf9gzjZTAv-Z9PFmKHNsQ0VOGvvN7c'
;
$page_url
=
'https://testwx.appgc.cn/%23/bpmp/ticket/my'
;
$page_url
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
'wxApp.jw.order'
)
;
$type
=
1
;
$type
=
1
;
$
param
=
[
$
query
=
[
$title
,
$title
,
$pay_order
[
'order_id'
],
$pay_order
[
'order_id'
],
round
(
$pay_order
[
'pay_amount'
]
/
100
,
2
),
round
(
$pay_order
[
'pay_amount'
]
/
100
,
2
),
date
(
'Y-m-d'
),
date
(
'Y-m-d'
),
];
];
Msg
::
send
(
$pay_order
[
'user_id'
],
$app_id
,
$template_id
,
$page_url
,
$type
,
$param
);
if
(
isset
(
$ret
[
'result'
][
'order_info'
][
'business_from'
])
&&
$ret
[
'result'
][
'order_info'
][
'business_from'
]
!=
2
)
{
//接龙业务不发送消息
Msg
::
send
(
$pay_order
[
'user_id'
],
$app_id
,
$template_id
,
$page_url
,
$type
,
$query
);
}
}
catch
(
\Throwable
$e
)
{
}
catch
(
\Throwable
$e
)
{
;
;
...
@@ -295,30 +299,32 @@ class PayService
...
@@ -295,30 +299,32 @@ class PayService
*/
*/
public
function
write_off
(
$order_item_id
,
$life_account_id
)
public
function
write_off
(
$order_item_id
,
$life_account_id
)
{
{
$cnt
=
0
;
//锁定状态
//锁定状态
try
{
try
{
PayOrderItem
::
beginTransaction
();
PayOrderItem
::
beginTransaction
();
$cnt
=
PayOrderItem
::
update
([
'notify_account_status'
=>
0
,
'can_notify_account'
=>
1
,
'can_notify_account_time'
=>
date
(
'Y-m-d H:i:s'
),
],
[
'order_item_id'
=>
$order_item_id
,
'can_notify_account'
=>
0
]);
$refund
=
RefundOrder
::
getMaster
(
'*'
,
[
'order_item_id'
=>
$order_item_id
]);
if
(
!
empty
(
$refund
))
{
throw
new
PayException
([
'cus'
=>
9
]);
}
$item
=
PayOrderItem
::
getMaster
(
'*'
,
[
'order_item_id'
=>
$order_item_id
]);
$item
=
PayOrderItem
::
getMaster
(
'*'
,
[
'order_item_id'
=>
$order_item_id
]);
if
(
empty
(
$item
))
{
if
(
empty
(
$item
))
{
throw
new
PayException
([
'cus'
=>
10
]);
throw
new
PayException
([
'cus'
=>
10
]);
}
}
if
(
$item
[
'refund_order_status'
]
!=
0
)
{
throw
new
PayException
([
'cus'
=>
9
]);
}
$pay_order
=
PayOrder
::
getMaster
(
'*'
,
[
'pay_order_id'
=>
$item
[
'pay_order_id'
]]);
$pay_order
=
PayOrder
::
getMaster
(
'*'
,
[
'pay_order_id'
=>
$item
[
'pay_order_id'
]]);
if
(
empty
(
$pay_order
)
||
$pay_order
[
'life_account_id'
]
!=
$life_account_id
)
{
if
(
empty
(
$pay_order
)
||
$pay_order
[
'life_account_id'
]
!=
$life_account_id
)
{
throw
new
PayException
([
'cus'
=>
11
]);
throw
new
PayException
([
'cus'
=>
11
]);
}
}
$cnt
=
PayOrderItem
::
update
([
'notify_account_status'
=>
0
,
'can_notify_account'
=>
1
,
'can_notify_account_time'
=>
date
(
'Y-m-d H:i:s'
),
],
[
'order_item_id'
=>
$order_item_id
,
'can_notify_account'
=>
0
,
'refund_order_status'
=>
0
]);
PayOrderItem
::
commit
();
PayOrderItem
::
commit
();
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
PayOrderItem
::
rollback
();
PayOrderItem
::
rollback
();
...
@@ -421,6 +427,7 @@ class PayService
...
@@ -421,6 +427,7 @@ class PayService
'pay_order_id'
=>
$this
->
pay_order
[
'pay_order_id'
],
'pay_order_id'
=>
$this
->
pay_order
[
'pay_order_id'
],
'order_id'
=>
$this
->
pay_order
[
'order_id'
],
'order_id'
=>
$this
->
pay_order
[
'order_id'
],
'order_item_id'
=>
$r
[
'order_item_id'
],
'order_item_id'
=>
$r
[
'order_item_id'
],
'payment'
=>
$r
[
'payment'
],
'user_id'
=>
$this
->
pay_order
[
'user_id'
],
'user_id'
=>
$this
->
pay_order
[
'user_id'
],
];
];
}
}
...
...
application/services/refund/RefundService.php
View file @
511353b3
This diff is collapsed.
Click to expand it.
conf/application.ini
View file @
511353b3
...
@@ -39,12 +39,14 @@ dingTalk.keys[]="SEC0298ad3f80e16df12cd4d6f6c39e961b500e2ff486f4c4377c0e2af8f453
...
@@ -39,12 +39,14 @@ dingTalk.keys[]="SEC0298ad3f80e16df12cd4d6f6c39e961b500e2ff486f4c4377c0e2af8f453
[prod : common : exception : dingTalk]
[prod : common : exception : dingTalk]
pingxx.appid
=
"app_9m1ubDG4e1mPXLCG"
pingxx.appid
=
"app_9m1ubDG4e1mPXLCG"
wxApp.jw.order
=
"https://wx.appgc.cn/%23/bpmp/ticket/my"
[pref : common : exception : dingTalk]
[pref : common : exception : dingTalk]
pingxx.appid
=
"app_9m1ubDG4e1mPXLCG"
pingxx.appid
=
"app_9m1ubDG4e1mPXLCG"
[test : common : exception : dingTalk]
[test : common : exception : dingTalk]
pingxx.appid
=
"app_W10Oe5XrvbzHfP4W"
pingxx.appid
=
"app_W10Oe5XrvbzHfP4W"
wxApp.jw.order
=
"https://testwx.appgc.cn/%23/bpmp/ticket/my"
[dev : common : exception]
[dev : common : exception]
pingxx.appid
=
"app_W10Oe5XrvbzHfP4W"
pingxx.appid
=
"app_W10Oe5XrvbzHfP4W"
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