code 用户信息
This commit is contained in:
parent
271a0dc30a
commit
fbf5d34a19
@ -76,14 +76,14 @@ class WechatSubscriptController extends BaseController
|
||||
* @return array|mixed|void
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public static function getUserInfo($access_token)
|
||||
public static function getUserInfo($openid, $access_token)
|
||||
{
|
||||
try {
|
||||
$client = new Client(['base_uri' => self::BASE_URI]);
|
||||
$response = $client->request('get', 'sns/userinfo', [
|
||||
'query' => [
|
||||
'access_token' => $access_token,
|
||||
'openid' => getenv('APP_ID'),
|
||||
'openid' => $openid,
|
||||
'lang' => 'zh_CN',
|
||||
]
|
||||
]);
|
||||
|
@ -133,7 +133,7 @@ class StudentService
|
||||
throw new Exception('获取信息失败');
|
||||
}
|
||||
|
||||
$user_info = WechatSubscriptController::getUserInfo($access_token['access_token']);
|
||||
$user_info = WechatSubscriptController::getUserInfo($access_token['openid'], $access_token['access_token']);
|
||||
|
||||
if(!empty((array)$request->student)){
|
||||
$student = Student::where(['id' => $request->student->id])->findOrEmpty();
|
||||
|
Loading…
x
Reference in New Issue
Block a user