Commit 3e53d3b7 authored by wanjilong's avatar wanjilong

add: 多单退款对核销的兼容

parent 027fb54b
...@@ -295,30 +295,32 @@ class PayService ...@@ -295,30 +295,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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment