Merge pull request 'dev' (#24) from dev into master

Reviewed-on: http://git.excellentkk.cn/mkm/shop-php/pulls/24
This commit is contained in:
mkm 2023-09-01 16:15:00 +08:00
commit 1625ea742f

View File

@ -1252,11 +1252,20 @@ class Auth extends BaseController
public function globalConfig()
{
$getUrl = env('TASK_WORKER_HOST_URL') . '/api/index/config';
$header = array('User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1');
$os = 'pc';
$userAgent = request()->header('user-agent');
$isAndroid = stripos($userAgent, 'android') !== false;
if ($isAndroid) {
$os = 'android';
}
$isIOS = stripos($userAgent, 'iphone') !== false;
if ($isIOS) {
$os = 'ios';
}
$getUrl .= '?os=' . $os;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $getUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);