微信登录优化

master
秀才 9 months ago
parent 94a6f0708f
commit 46bcb45d91
  1. 8
      extend/basic/WapBasic.php

@ -319,7 +319,7 @@ class WapBasic extends Controller
if (!isset($userInfoCong['openid'])) { if (!isset($userInfoCong['openid'])) {
throw new ValidateException('openid获取失败'); throw new ValidateException('openid获取失败');
} }
/*
try { try {
//解密获取用户信息 //解密获取用户信息
$userInfo = MiniProgramService::encryptor($session_key, $iv, $encryptedData); $userInfo = MiniProgramService::encryptor($session_key, $iv, $encryptedData);
@ -327,7 +327,7 @@ class WapBasic extends Controller
if ($e->getCode() == '-41003') { if ($e->getCode() == '-41003') {
throw new ValidateException('获取会话密匙失败'); throw new ValidateException('获取会话密匙失败');
} }
} }*/
$userInfo['unionId'] = isset($userInfoCong['unionid']) ? $userInfoCong['unionid'] : ''; $userInfo['unionId'] = isset($userInfoCong['unionid']) ? $userInfoCong['unionid'] : '';
$userInfo['openId'] = $openid = $userInfoCong['openid']; $userInfo['openId'] = $openid = $userInfoCong['openid'];
@ -546,13 +546,13 @@ class WapBasic extends Controller
*/ */
public function routineOauth($routine) public function routineOauth($routine)
{ {
$routineInfo['nickname'] = filter_emoji($routine['nickName']); //姓名 $routineInfo['nickname'] = filter_emoji($routine['nickName'] ?? ''); //姓名
$routineInfo['sex'] = isset($routine['gender']) ?? 0; //性别 $routineInfo['sex'] = isset($routine['gender']) ?? 0; //性别
$routineInfo['language'] = isset($routine['language']) ?? ''; //语言 $routineInfo['language'] = isset($routine['language']) ?? ''; //语言
$routineInfo['city'] = isset($routine['city']) ?? ''; //城市 $routineInfo['city'] = isset($routine['city']) ?? ''; //城市
$routineInfo['province'] = isset($routine['province']) ?? ''; //省份 $routineInfo['province'] = isset($routine['province']) ?? ''; //省份
$routineInfo['country'] = isset($routine['country']) ?? ''; //国家 $routineInfo['country'] = isset($routine['country']) ?? ''; //国家
$routineInfo['headimgurl'] = $routine['avatarUrl']; //头像 $routineInfo['headimgurl'] = $routine['avatarUrl'] ?? ''; //头像
$routineInfo['openid'] = $routine['openId']; $routineInfo['openid'] = $routine['openId'];
$routineInfo['session_key'] = isset($routine['session_key']) ?? ''; //会话密匙 $routineInfo['session_key'] = isset($routine['session_key']) ?? ''; //会话密匙
$routineInfo['unionid'] = $routine['unionId']; //用户在开放平台的唯一标识符 $routineInfo['unionid'] = $routine['unionId']; //用户在开放平台的唯一标识符

Loading…
Cancel
Save