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