更新
This commit is contained in:
parent
7f305fb6d2
commit
438e1f8983
@ -16,6 +16,7 @@ namespace app\api\logic;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\AppUpdate;
|
||||
use app\common\model\article\Article;
|
||||
use app\common\model\decorate\DecoratePage;
|
||||
use app\common\model\decorate\DecorateTabbar;
|
||||
@ -24,7 +25,6 @@ use app\common\model\user\UserRole;
|
||||
use app\common\service\ConfigService;
|
||||
use app\common\service\FileService;
|
||||
|
||||
|
||||
/**
|
||||
* index
|
||||
* Class IndexLogic
|
||||
@ -155,6 +155,15 @@ class IndexLogic extends BaseLogic
|
||||
'shop_logo' => FileService::getFileUrl(ConfigService::get('website', 'shop_logo')),
|
||||
];
|
||||
$versionInfo = [];
|
||||
$version='1.0.0';
|
||||
if(self::isAndroid()){
|
||||
$versionInfo=AppUpdate::where('type',2)->order('id','desc')->find();
|
||||
}elseif(self::isIOS()){
|
||||
$versionInfo=AppUpdate::where('type',1)->order('id','desc')->find();
|
||||
}
|
||||
if($versionInfo){
|
||||
$version=$versionInfo['version'];
|
||||
}
|
||||
return [
|
||||
'domain' => FileService::getFileUrl(),
|
||||
'style' => $style,
|
||||
@ -162,19 +171,20 @@ class IndexLogic extends BaseLogic
|
||||
'menu' => $menu,
|
||||
'login' => $loginConfig,
|
||||
'website' => $website,
|
||||
'version'=> config('project.version'),
|
||||
'version' => $version,
|
||||
'version_info' => $versionInfo,
|
||||
];
|
||||
}
|
||||
|
||||
function isAndroid() {
|
||||
public static function isAndroid()
|
||||
{
|
||||
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||
return strpos($userAgent, 'Android') !== false;
|
||||
}
|
||||
|
||||
function isIOS() {
|
||||
public static function isIOS()
|
||||
{
|
||||
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||
return strpos($userAgent, 'iPhone') !== false || strpos($userAgent, 'iPad') !== false;
|
||||
return strpos($userAgent, 'iPhone') !== false;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user