修改增收补贴发放的错误

This commit is contained in:
luofei 2024-03-22 15:04:28 +08:00
parent 6874dab755
commit d1896638d5

View File

@ -34,9 +34,9 @@ class SendSubsidyCouponListen extends TimerService implements ListenerInterface
->select();
foreach ($merchants as $merchant) {
//商户已获得的补贴金额
$gotSubsidy = StoreCouponUser::where('coupon_id', $coupon['coupon_id'])
$gotSubsidy = StoreCouponDetail::where('coupon_id', $coupon['coupon_id'])
->where('uid', $merchant->uid)
->value('origin_price');
->sum('amount');
if ($gotSubsidy >= $item['subsidy']) {
continue;
}
@ -45,7 +45,7 @@ class SendSubsidyCouponListen extends TimerService implements ListenerInterface
/** @var StoreCouponUserRepository $userCouponRepo */
$userCouponRepo = app()->make(StoreCouponUserRepository::class);
$coupon->coupon_price = $amount;
$userCouponRepo->status = StoreCouponUser::STATUS_REPEAL;
$userCouponRepo->status = StoreCouponDetail::STATUS_INVALID;
$userCouponRepo->uid = $merchant['uid'];
$userCouponRepo->coupon = $coupon;
$userCouponRepo->order = ['uid' => $merchant['uid'],];