liyinglin 3 years ago
parent 6a0e837ef6
commit fc9ace9cee

@ -41,6 +41,7 @@ class UserController extends CommonController
$appSecret = \config('app.wechat_appsecret'); $appSecret = \config('app.wechat_appsecret');
$url = "https://api.weixin.qq.com/sns/jscode2session?appid=" . $appid . "&secret=" . $appSecret . "&js_code={$all['code']}&grant_type=authorization_code"; $url = "https://api.weixin.qq.com/sns/jscode2session?appid=" . $appid . "&secret=" . $appSecret . "&js_code={$all['code']}&grant_type=authorization_code";
$userInfo = json_decode(file_get_contents($url), true); $userInfo = json_decode(file_get_contents($url), true);
dd($userInfo);
if (!isset($userInfo['openid'])) { if (!isset($userInfo['openid'])) {
return $this->fail([ResponseCode::ERROR_BUSINESS, 'code异常']); return $this->fail([ResponseCode::ERROR_BUSINESS, 'code异常']);
} }

Loading…
Cancel
Save