30 lines
752 B
PHP
30 lines
752 B
PHP
<?php
|
|
|
|
namespace app\common\model;
|
|
|
|
class ShortLinkLog extends BaseModel
|
|
{
|
|
protected $name = 'short_link_log';
|
|
|
|
/**
|
|
* @notes 从UA解析平台
|
|
*/
|
|
public static function parsePlatform(string $ua): string
|
|
{
|
|
$ua = strtolower($ua);
|
|
if (str_contains($ua, 'micromessenger'))
|
|
return 'wechat';
|
|
if (str_contains($ua, 'alipay'))
|
|
return 'alipay';
|
|
if (str_contains($ua, 'iphone') || str_contains($ua, 'ipad'))
|
|
return 'ios';
|
|
if (str_contains($ua, 'android'))
|
|
return 'android';
|
|
if (str_contains($ua, 'windows'))
|
|
return 'windows';
|
|
if (str_contains($ua, 'macintosh'))
|
|
return 'mac';
|
|
return 'other';
|
|
}
|
|
}
|