修改微信app授权
This commit is contained in:
parent
04474ac0e4
commit
d540906498
@ -559,8 +559,10 @@ class Auth extends BaseController
|
|||||||
return $user;
|
return $user;
|
||||||
} else if ($auth['type'] === 'app_wechat') {
|
} else if ($auth['type'] === 'app_wechat') {
|
||||||
$oauth = WechatService::create()->getApplication()->oauth;
|
$oauth = WechatService::create()->getApplication()->oauth;
|
||||||
|
$accessToken = $oauth->getAccessToken($data['code']);
|
||||||
try {
|
try {
|
||||||
$wechatInfo = $oauth->user(new AccessToken(['access_token' => $data['code'], 'openid' => $data['openid']]))->getOriginal();
|
// $wechatInfo = $oauth->user(new AccessToken(['access_token' => $data['code'], 'openid' => $data['openid']]))->getOriginal();
|
||||||
|
$wechatInfo = $oauth->user($accessToken)->getOriginal();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new ValidateException('授权失败[001]' . $e->getMessage());
|
throw new ValidateException('授权失败[001]' . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -568,7 +570,8 @@ class Auth extends BaseController
|
|||||||
if (!$user)
|
if (!$user)
|
||||||
throw new ValidateException('授权失败');
|
throw new ValidateException('授权失败');
|
||||||
return $user;
|
return $user;
|
||||||
} else if ($auth['type'] === 'apple') {
|
}
|
||||||
|
else if ($auth['type'] === 'apple') {
|
||||||
$identityToken = $data['userInfo']['identityToken'];
|
$identityToken = $data['userInfo']['identityToken'];
|
||||||
$tks = explode('.', $identityToken);
|
$tks = explode('.', $identityToken);
|
||||||
if (count($tks) != 3) {
|
if (count($tks) != 3) {
|
||||||
@ -597,7 +600,7 @@ class Auth extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function authLogin()
|
public function authLogin()
|
||||||
{
|
{
|
||||||
$auth = $this->request->param('auth');
|
$auth = $this->request->param('auth'); dump($auth);
|
||||||
$createUser = true;
|
$createUser = true;
|
||||||
if ($auth['type'] == 'app_wechat' || systemConfig('is_phone_login') == '1') {
|
if ($auth['type'] == 'app_wechat' || systemConfig('is_phone_login') == '1') {
|
||||||
$createUser = false;
|
$createUser = false;
|
||||||
@ -996,10 +999,17 @@ class Auth extends BaseController
|
|||||||
$agent = strtolower($this->request->server('HTTP_USER_AGENT'));
|
$agent = strtolower($this->request->server('HTTP_USER_AGENT'));
|
||||||
// 检查是否为iOS设备,包括iPhone和iPad
|
// 检查是否为iOS设备,包括iPhone和iPad
|
||||||
if (strpos($agent, 'iphone') !== false || strpos($agent, 'ipad') !== false) {
|
if (strpos($agent, 'iphone') !== false || strpos($agent, 'ipad') !== false) {
|
||||||
$appInfo=[];
|
$appInfo = Db::name('AppUpdate')->where('type', $type)->order('id','desc')->find();
|
||||||
} elseif (strpos($agent, 'android') !== false) {
|
} elseif (strpos($agent, 'android') !== false) {
|
||||||
// 检查是否为Android设备
|
// 检查是否为Android设备
|
||||||
$appInfo = Db::name('AppUpdate')->where('type', $type)->order('id','desc')->find();
|
$appInfo = Db::name('AppUpdate')->where('type', $type)->order('id','desc')->find();
|
||||||
|
if($agent == 'ios'){
|
||||||
|
$pattern = '/\.wgt$/i';
|
||||||
|
if (preg_match($pattern, basename($appInfo['dow_url']))) {
|
||||||
|
$appInfo =[];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$appInfo=[];
|
$appInfo=[];
|
||||||
// 如果都不是,则输出其他
|
// 如果都不是,则输出其他
|
||||||
|
Loading…
x
Reference in New Issue
Block a user