sifangpay/app/Listeners/CouponCardEventListener.php

50 lines
1.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Listeners;
use App\Events\CouponCardEvent;
use App\Models\Activity;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;
class CouponCardEventListener implements ShouldQueue
{
/**
* Create the event listener.
*
* @return void
*/
public $connection = 'redis';
/**
* 任务将被推送到的连接名称.
*
* @var string|null
*/
// public $queue = 'listeners';
public $queue = 'shop_coupon_card_del';
public function __construct()
{
}
/**
* Handle the event.
*
* @param CouponCardEvent $event
* @return void
*/
public function handle(CouponCardEvent $event)
{
//
Log::channel('coupon_card')->notice('shop_user_id:'.admin_shop('id').',删除活动优惠码活动id::'.$event->active_id);
//删除优惠券使用数量
$r=$active=Activity::where('id',$event->active_id)->decrement('card_number',$event->number);
Log::channel('coupon_card')->notice('删除活动id'.$r);
// sleep(0);
}
}