调试供应链订单退款
This commit is contained in:
parent
ca226a4d2a
commit
097964d352
@ -162,15 +162,17 @@ class CommissionDao
|
||||
if ($refunded > 0) {
|
||||
return;
|
||||
}
|
||||
// 退佣金和红包
|
||||
// 退佣金和红包、保证金
|
||||
$financeRecord = FinancialRecord::where('order_id', $refundOrder->order['order_id'])
|
||||
->whereIn('financial_type', ['commission_to_store', 'commission_to_courier', 'commission_to_promoter'])
|
||||
->whereIn('financial_type', ['commission_to_store', 'commission_to_courier', 'commission_to_promoter', 'auto_margin'])
|
||||
->field('user_id uid,user_info nickname,number,mer_id,financial_type')->select()->toArray();
|
||||
if (empty($financeRecord)) {
|
||||
return;
|
||||
}
|
||||
$userIds = [];
|
||||
$financeDao = new FinancialDao();
|
||||
foreach ($financeRecord as $item) {
|
||||
$userIds[] = $item['uid'];
|
||||
$financeDao->user = $item;
|
||||
$financeDao->order = $refundOrder->order;
|
||||
$financeDao->platformIn($item['number'], $item['financial_type'] . '_refund', $item['mer_id']);
|
||||
@ -180,9 +182,11 @@ class CommissionDao
|
||||
}
|
||||
$financeDao->save();
|
||||
|
||||
// TODO 服务团队退红包
|
||||
// $redPacks = UserBill::whereIn('');
|
||||
// (new StoreConsumptionUserDao())->refundByCommission($item['uid'], $refundOrder->order->order_id, $redPack);
|
||||
// 服务团队退红包
|
||||
$redPacks = UserBill::whereIn('uid', $userIds)->where('extra->order_id',$refundOrder->order['order_id'])->select()->toArray();
|
||||
foreach ($redPacks as $redPack) {
|
||||
(new StoreConsumptionUserDao())->refundByCommission($redPack['uid'], $refundOrder->order['order_id'], $redPack['number']);
|
||||
}
|
||||
|
||||
$promotionCode = User::where('uid', $refundOrder['uid'])->value('promotion_code');
|
||||
if ($promotionCode) {
|
||||
|
@ -256,18 +256,19 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
// 写入红包日志
|
||||
/** @var $userBillRepository UserBillRepository */
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$mark = ['order_amount' => $amount, 'coupon_user_id' => $model['coupon_user_id']];
|
||||
$extra = ['order_amount' => $amount, 'coupon_user_id' => $model['coupon_user_id']];
|
||||
if ($this->orderType == 2) {
|
||||
$mark['order_id'] = $groupOrderIds;
|
||||
$extra['order_id'] = $groupOrderIds;
|
||||
} else {
|
||||
$mark['group_order_id'] = $groupOrderIds;
|
||||
$extra['group_order_id'] = $groupOrderIds;
|
||||
}
|
||||
$userBillRepository->incBill($userId, 'red_pack', "red_pack_{$type}", [
|
||||
'link_id' => $model['coupon_user_id'],
|
||||
'status' => 1,
|
||||
'title' => '获得' . $title,
|
||||
'number' => $couponPrice,
|
||||
'mark' => json_encode($mark, JSON_UNESCAPED_UNICODE),
|
||||
'mark' => '获得' . $title . $couponPrice . ",订单金额:{$amount}",
|
||||
'extra' => json_encode($extra, JSON_UNESCAPED_UNICODE),
|
||||
'balance' => 0
|
||||
]);
|
||||
}
|
||||
|
@ -1210,16 +1210,6 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
->whereIn('product_id', $productIds)
|
||||
->whereIn('activity_id', 2)
|
||||
->update(['status' => 0]);
|
||||
|
||||
app()->make(FinancialRecordRepository::class)->dec([
|
||||
'order_id' => $refundOrder->refund_order_id,
|
||||
'order_sn' => $refundOrder->refund_order_sn,
|
||||
'user_info' => $refundOrder->user->nickname,
|
||||
'user_id' => $refundOrder->uid,
|
||||
'financial_type' => 'refund_order',
|
||||
'type' => 1,
|
||||
'number' => $refundOrder->refund_price,
|
||||
], $refundOrder->mer_id);
|
||||
}
|
||||
|
||||
public function getRefundMerPrice(StoreRefundOrder $refundOrder, $refundPrice = null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user