mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
add user join event #4
This commit is contained in:
parent
0339ee9f23
commit
28f21d09c6
5 changed files with 388 additions and 94 deletions
|
|
@ -11,6 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
use App\Service\UserService;
|
||||
use App\Service\ArticleService;
|
||||
use App\Service\TorrentService;
|
||||
use App\Service\ActivityService;
|
||||
|
||||
class SearchController extends AbstractController
|
||||
{
|
||||
|
|
@ -26,13 +27,27 @@ class SearchController extends AbstractController
|
|||
Request $request,
|
||||
UserService $userService,
|
||||
ArticleService $articleService,
|
||||
TorrentService $torrentService
|
||||
TorrentService $torrentService,
|
||||
ActivityService $activityService
|
||||
): Response
|
||||
{
|
||||
// Init user
|
||||
$user = $userService->init(
|
||||
$request->getClientIp()
|
||||
);
|
||||
if (!$user = $userService->findUserByAddress($request->getClientIp()))
|
||||
{
|
||||
$user = $userService->addUser(
|
||||
$request->getClientIp(),
|
||||
time(),
|
||||
$this->getParameter('app.locale'),
|
||||
explode('|', $this->getParameter('app.locales')),
|
||||
$this->getParameter('app.theme')
|
||||
);
|
||||
|
||||
// Add user join event
|
||||
$activityService->addEventUserAdd(
|
||||
$user->getId(),
|
||||
time()
|
||||
);
|
||||
}
|
||||
|
||||
$article = $request->query->get('article') ? (int) $request->query->get('article') : 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue