<?php
/**
 * Created by PhpStorm.
 * User: guanxl
 * Date: 2018/7/27
 * Time: 11:45
 * 记录用户操作日志，例如用户上下线，用户答题
 */

namespace App\Services;

use App\Traits\Singleton;

class LogEventService
{
    use Singleton;
    const REDIS_KEY="log_event:brainstorming";

    public function push($activityId,$userId,$channel,$event,$data=[]){
        $redisData = [
            "activity_id" => $activityId,
            "user_id" => $userId,
            "channel" => $channel,
            "event" => $event,
            "event_time" => time(),
            "data" => $data
        ];
        app("redisLog")->lPush(self::REDIS_KEY,json_encode($redisData));
    }
}