<?php
 namespace Module\ShortLink\Util; use Jenssegers\Agent\Agent; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\Request; use ModStart\Core\Util\AgentUtil; use Module\ShortLink\Job\LinkVisitJob; use Module\ShortLink\Type\LinkVisitStatus; class LinkVisitUtil { public static function tick($link) { $agent = new Agent(); $agent->setUserAgent(AgentUtil::getUserAgent()); $agent->setHttpHeaders(Request::headers()); $visit = []; $visit['ip'] = Request::ip(); $visit['os'] = $agent->platform(); $visit['browser'] = $agent->browser(); $visit['ua'] = $agent->getUserAgent(); $visit['linkId'] = $link['id']; $visit['status'] = LinkVisitStatus::WAIT_PROCESS; $visit = ModelUtil::insert('link_visit', $visit); LinkVisitJob::create($visit['id']); } }