修改退款的错误
This commit is contained in:
parent
54d5f6eb0f
commit
26b26768c6
@ -133,8 +133,8 @@ class StoreOrderController extends BaseAdminController
|
||||
return $this->fail('无该订单请检查');
|
||||
}
|
||||
$params['id'] = $detail['id'];
|
||||
if (empty($params['product_arr'])) {
|
||||
$params['old_cart_id'] = StoreOrderCartInfo::where('oid', $detail['id'])->where('status', '<>', 2)->column('id');
|
||||
if (!isset($params['product_arr'])) {
|
||||
$params['product_arr'] = StoreOrderCartInfo::where('oid', $detail['id'])->where('status', '<>', 2)->field('product_id,cart_num')->select()->toArray();
|
||||
}
|
||||
$refundOrderService->refund($detail['uid'], $params);
|
||||
return $this->success('退款成功',[],1,1);
|
||||
|
@ -37,14 +37,15 @@ class RefundOrderService
|
||||
}
|
||||
$orderCartInfoWhere = ['oid' => $order['id']];
|
||||
$refundNum = 0;
|
||||
if (!empty($params['old_cart_id'])) {
|
||||
$orderCartInfoWhere['id'] = $params['old_cart_id'];
|
||||
$refundNum = count($params['old_cart_id']);
|
||||
}
|
||||
if (!empty($params['product_arr'])) {
|
||||
$orderCartInfoWhere['product_id'] = array_column($params['product_arr'], 'product_id');
|
||||
$refundNum = count($params['product_arr']);
|
||||
}
|
||||
if (!empty($params['old_cart_id'])) {
|
||||
$orderCartInfoWhere['id'] = $params['old_cart_id'];
|
||||
$refundNum = count($params['old_cart_id']);
|
||||
$params['product_arr'] = StoreOrderCartInfo::field('product_id,cart_num')->where($orderCartInfoWhere)->select()->toArray();
|
||||
}
|
||||
$orderCartProducts = StoreOrderCartInfo::where($orderCartInfoWhere)->select();
|
||||
if (isset($params['refund_price'])) {
|
||||
$refundAmount = $params['refund_price'];
|
||||
@ -223,7 +224,7 @@ class RefundOrderService
|
||||
}
|
||||
}
|
||||
$productIds = array_unique(array_column($storeOrderProducts->toArray(), 'product_id'));
|
||||
StoreFinanceFlowProduct::where('oid', $order['id'])->whereIn('product_id', $productIds)->update(['number' => 0, 'update_time' => strtotime(time())]);
|
||||
StoreFinanceFlowProduct::where('oid', $order['id'])->whereIn('product_id', $productIds)->update(['number' => 0, 'update_time' => time()]);
|
||||
$village_uid = StoreFinanceFlow::where('order_id', $order['id'])->where('financial_type', 14)->value('other_uid');
|
||||
$brigade_uid = StoreFinanceFlow::where('order_id', $order['id'])->where('financial_type', 15)->value('other_uid');
|
||||
$transaction_id = StoreFinanceFlow::where('order_id', $order['id'])->value('transaction_id');
|
||||
|
Loading…
x
Reference in New Issue
Block a user