mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-05 03:38:15 +00:00
perf: 优化登录设备名称
This commit is contained in:
parent
03fc19f070
commit
1b1406a4d9
@ -97,6 +97,7 @@ class UserDevice extends AbstractModel
|
||||
'browser' => 'Unknown',
|
||||
'version' => '',
|
||||
|
||||
'app_name' => '', // 客户端名称
|
||||
'app_type' => '', // 客户端类型
|
||||
'app_version' => '', // 客户端版本
|
||||
];
|
||||
@ -129,34 +130,30 @@ class UserDevice extends AbstractModel
|
||||
|
||||
if (preg_match("/android_kuaifan_eeui/i", $ua)) {
|
||||
// Android 客户端
|
||||
$result['app_type'] = 'Android';
|
||||
if ($dd->getBrandName() && $dd->getModel()) {
|
||||
// 厂商+型号
|
||||
$result['app_type'] = $dd->getBrandName() . ' ' . $dd->getModel();
|
||||
$result['app_name'] = $dd->getBrandName() . ' ' . $dd->getModel();
|
||||
} elseif ($dd->getBrandName()) {
|
||||
// 仅厂商
|
||||
$result['app_type'] = $dd->getBrandName();
|
||||
$result['app_name'] = $dd->getBrandName();
|
||||
} elseif ($dd->isTablet()) {
|
||||
// 平板
|
||||
$result['app_type'] = 'Tablet';
|
||||
$result['app_name'] = 'Tablet';
|
||||
} elseif ($dd->isPhablet()) {
|
||||
// 平板
|
||||
$result['app_type'] = 'Phablet';
|
||||
} else {
|
||||
// 未确定的 Android 设备
|
||||
$result['app_type'] = 'Android';
|
||||
$result['app_name'] = 'Phablet';
|
||||
}
|
||||
$result['app_version'] = self::getAfterVersion($ua, 'kuaifan_eeui/');
|
||||
} elseif (preg_match("/ios_kuaifan_eeui/i", $ua)) {
|
||||
// iOS 客户端
|
||||
$result['app_type'] = 'iOS';
|
||||
if (preg_match("/(macintosh|ipad)/i", $ua)) {
|
||||
// iPad
|
||||
$result['app_type'] = 'iPad';
|
||||
$result['app_name'] = 'iPad';
|
||||
} elseif (preg_match("/iphone/i", $ua)) {
|
||||
// iPhone
|
||||
$result['app_type'] = 'iPhone';
|
||||
} else {
|
||||
// 未确定的 iOS 设备
|
||||
$result['app_type'] = 'iOS';
|
||||
$result['app_name'] = 'iPhone';
|
||||
}
|
||||
$result['app_version'] = self::getAfterVersion($ua, 'kuaifan_eeui/');
|
||||
} elseif (preg_match("/dootask/i", $ua)) {
|
||||
|
||||
@ -83,11 +83,11 @@ export default {
|
||||
return 'web';
|
||||
},
|
||||
|
||||
getName({app_type, browser}) {
|
||||
getName({app_type, app_name, browser}) {
|
||||
if (/web/i.test(app_type)) {
|
||||
return browser + " " + this.$L("浏览器")
|
||||
}
|
||||
return app_type + " " + this.$L("客户端")
|
||||
return (app_name || app_type) + " " + this.$L("客户端")
|
||||
},
|
||||
|
||||
onLogout(device) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user