添加补贴记录

This commit is contained in:
luofei 2024-02-29 18:48:27 +08:00
parent d595e04b2f
commit 39d46328df
2 changed files with 9 additions and 0 deletions

View File

@ -51,6 +51,7 @@ class StoreConsumptionUserDao extends BaseDao
public $startTime;
public $endTime;
public $billExtra;
protected function getModel(): string
{
@ -272,6 +273,9 @@ class StoreConsumptionUserDao extends BaseDao
} else {
$extra['group_order_id'] = $groupOrderIds;
}
if (!empty($this->billExtra)) {
$extra = array_merge($extra, $this->billExtra);
}
$userBillRepository->incBill($userId, 'red_pack', "red_pack_{$type}", [
'link_id' => $model['coupon_user_id'],
'status' => $status == -1 ?: 1,

View File

@ -39,6 +39,11 @@ class SendSubsidyCouponListen extends TimerService implements ListenerInterface
//补贴金额为当前补贴减去已获得的补贴
$amount = bcsub($item['subsidy'], $gotSubsidy, 2);
$consumptionRepo = new StoreConsumptionUserDao();
$consumptionRepo->billExtra = [
'coupon_id' => $consumption['coupon_id'],
'sale_amount' => $item['amount'],
'purchase_amount' => $purchaseAmount,
];
$consumptionRepo->send($consumption, 1, $merchant->uid, 0, $amount, StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
$count++;
}