diff --git a/crmeb/listens/SendSubsidyCouponListen.php b/crmeb/listens/SendSubsidyCouponListen.php index a01870e3..e34538b8 100644 --- a/crmeb/listens/SendSubsidyCouponListen.php +++ b/crmeb/listens/SendSubsidyCouponListen.php @@ -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'],];