mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-15 11:18:12 +00:00
优化数据
This commit is contained in:
parent
c6d874ad59
commit
0e0604570e
@ -299,7 +299,7 @@ class UsersController extends AbstractController
|
|||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
$user = User::auth();
|
$user = User::auth();
|
||||||
User::generateToken($user);
|
User::generateToken($user, in_array(Base::platform(), ['ios', 'android']));
|
||||||
//
|
//
|
||||||
$data = $user->toArray();
|
$data = $user->toArray();
|
||||||
$data['nickname_original'] = $user->getRawOriginal('nickname');
|
$data['nickname_original'] = $user->getRawOriginal('nickname');
|
||||||
@ -1025,12 +1025,7 @@ class UsersController extends AbstractController
|
|||||||
'alias.between:2,20' => '别名的长度在2-20个字符',
|
'alias.between:2,20' => '别名的长度在2-20个字符',
|
||||||
]);
|
]);
|
||||||
//
|
//
|
||||||
$agent = strtolower(Request::server('HTTP_USER_AGENT'));
|
if (!in_array(Base::platform(), ['ios', 'android'])) {
|
||||||
if (str_contains($agent, 'android')) {
|
|
||||||
$platform = 'android';
|
|
||||||
} elseif (str_contains($agent, 'iphone') || str_contains($agent, 'ipad')) {
|
|
||||||
$platform = 'ios';
|
|
||||||
} else {
|
|
||||||
return Base::retError('设备类型错误');
|
return Base::retError('设备类型错误');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -1038,7 +1033,7 @@ class UsersController extends AbstractController
|
|||||||
$inArray = [
|
$inArray = [
|
||||||
'userid' => $user->userid,
|
'userid' => $user->userid,
|
||||||
'alias' => $data['alias'],
|
'alias' => $data['alias'],
|
||||||
'platform' => $platform,
|
'platform' => Base::platform(),
|
||||||
];
|
];
|
||||||
$row = UmengAlias::where($inArray);
|
$row = UmengAlias::where($inArray);
|
||||||
if ($row->exists()) {
|
if ($row->exists()) {
|
||||||
|
|||||||
@ -2044,6 +2044,27 @@ class Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取平台类型
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function platform()
|
||||||
|
{
|
||||||
|
$platform = strtolower(trim(Request::header('platform')));
|
||||||
|
if (in_array($platform, ['android', 'ios', 'win', 'mac', 'web'])) {
|
||||||
|
return $platform;
|
||||||
|
}
|
||||||
|
$agent = strtolower(Request::server('HTTP_USER_AGENT'));
|
||||||
|
if (str_contains($agent, 'android')) {
|
||||||
|
$platform = 'android';
|
||||||
|
} elseif (str_contains($agent, 'iphone') || str_contains($agent, 'ipad')) {
|
||||||
|
$platform = 'ios';
|
||||||
|
} else {
|
||||||
|
$platform = 'unknown';
|
||||||
|
}
|
||||||
|
return $platform;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回根据距离sql排序语句
|
* 返回根据距离sql排序语句
|
||||||
* @param $lat
|
* @param $lat
|
||||||
|
|||||||
2
resources/assets/js/app.js
vendored
2
resources/assets/js/app.js
vendored
@ -149,6 +149,8 @@ if (isElectron) {
|
|||||||
$A.Platform = /macintosh|mac os x/i.test(navigator.userAgent) ? "mac" : "win";
|
$A.Platform = /macintosh|mac os x/i.test(navigator.userAgent) ? "mac" : "win";
|
||||||
$A.isMainElectron = /\s+MainTaskWindow\//.test(window.navigator.userAgent);
|
$A.isMainElectron = /\s+MainTaskWindow\//.test(window.navigator.userAgent);
|
||||||
$A.isSubElectron = /\s+SubTaskWindow\//.test(window.navigator.userAgent);
|
$A.isSubElectron = /\s+SubTaskWindow\//.test(window.navigator.userAgent);
|
||||||
|
} else if (isEEUiApp) {
|
||||||
|
$A.Platform = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent) ? "ios" : "android";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 子窗口给主窗口发送指令相关
|
// 子窗口给主窗口发送指令相关
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user