mirror of
https://github.com/v2board/v2board.git
synced 2025-01-27 00:19:10 +08:00
update
This commit is contained in:
parent
2b7f31b6d1
commit
c6c83c86fd
@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Events;
|
|
||||||
|
|
||||||
use App\Models\ServerLog;
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
|
|
||||||
class ServerLogSaveEvent
|
|
||||||
{
|
|
||||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
||||||
|
|
||||||
public $serverLog;
|
|
||||||
/**
|
|
||||||
* Create a new event instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct(ServerLog $serverLog) {
|
|
||||||
$this->serverLog = $serverLog;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the channels the event should broadcast on.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Broadcasting\Channel|array
|
|
||||||
*/
|
|
||||||
public function broadcastOn()
|
|
||||||
{
|
|
||||||
return new PrivateChannel('channel-name');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Listeners;
|
|
||||||
|
|
||||||
use App\Events\ServerLogSaveEvent;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
|
|
||||||
class ServerLogSaveListener
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create the event listener.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the event.
|
|
||||||
*
|
|
||||||
* @param ServerLogSaveEvent $event
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function handle(ServerLogSaveEvent $event) {
|
|
||||||
$redisKey = 'last_submit_server_log_' . $event->serverLog->user_id;
|
|
||||||
Redis::set($redisKey, time());
|
|
||||||
info($redisKey);
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,6 +10,5 @@ class ServerLog extends Model
|
|||||||
protected $table = 'v2_server_log';
|
protected $table = 'v2_server_log';
|
||||||
protected $dateFormat = 'U';
|
protected $dateFormat = 'U';
|
||||||
protected $dispatchesEvents = [
|
protected $dispatchesEvents = [
|
||||||
'saving' => ServerLogSaveEvent::class,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,6 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $listen = [
|
protected $listen = [
|
||||||
'App\Events\ServerLogSaveEvent' => [
|
|
||||||
'App\Listeners\ServerLogSaveListener',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user