|
|
|
|
@ -268,13 +268,19 @@ class AuthController extends Controller
|
|
|
|
|
// 'errormsg' => "openid为空"
|
|
|
|
|
// ], 401);
|
|
|
|
|
// }
|
|
|
|
|
$config = [
|
|
|
|
|
'app_id' => $this->appid,
|
|
|
|
|
'secret' => $this->appsecret
|
|
|
|
|
];
|
|
|
|
|
$app = Factory::miniProgram($config);
|
|
|
|
|
$result = $app->phone_number->getUserPhoneNumber($code);
|
|
|
|
|
$mobile = $result['phone_info']['purePhoneNumber'] ?? '';
|
|
|
|
|
// $config = [
|
|
|
|
|
// 'app_id' => $this->appid,
|
|
|
|
|
// 'secret' => $this->appsecret
|
|
|
|
|
// ];
|
|
|
|
|
$url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" . $this->getAccessToken();
|
|
|
|
|
$postData = json_encode(['code' => $code]);
|
|
|
|
|
$result = curl($url, $postData);
|
|
|
|
|
$mobile = '';
|
|
|
|
|
if (isset($result['phone_info']['pure_phone_number'])) {
|
|
|
|
|
$mobile = $result['phone_info']['pure_phone_number'];
|
|
|
|
|
} elseif (isset($result['phone_info']['purePhoneNumber'])) {
|
|
|
|
|
$mobile = $result['phone_info']['purePhoneNumber'];
|
|
|
|
|
}
|
|
|
|
|
if (empty($mobile)) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
'errorcode' => '4001',
|
|
|
|
|
|