From 7b517164f61d33a268e027deac35d9df488f67b2 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 27 Oct 2025 16:22:19 +0800 Subject: [PATCH] up --- AlipayAccount_MVC实现文档.md | 1 + app/Forms/AlipayAccountForm.php | 1 + .../Admin/AlipayAccountController.php | 1 + .../Controllers/Customer/AuthController.php | 20 ++++++++++++------- app/Models/AlipayAccount.php | 1 + 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/AlipayAccount_MVC实现文档.md b/AlipayAccount_MVC实现文档.md index 4e23dbc..af7a704 100644 --- a/AlipayAccount_MVC实现文档.md +++ b/AlipayAccount_MVC实现文档.md @@ -308,3 +308,4 @@ $accounts = AlipayAccount::withTrashed()->get(); **基于模板**: WechatpayAccount MVC + diff --git a/app/Forms/AlipayAccountForm.php b/app/Forms/AlipayAccountForm.php index 80898ec..b255327 100644 --- a/app/Forms/AlipayAccountForm.php +++ b/app/Forms/AlipayAccountForm.php @@ -23,3 +23,4 @@ class AlipayAccountForm extends Form } + diff --git a/app/Http/Controllers/Admin/AlipayAccountController.php b/app/Http/Controllers/Admin/AlipayAccountController.php index 0b02f14..7f0600a 100644 --- a/app/Http/Controllers/Admin/AlipayAccountController.php +++ b/app/Http/Controllers/Admin/AlipayAccountController.php @@ -28,3 +28,4 @@ class AlipayAccountController extends CommonController } + diff --git a/app/Http/Controllers/Customer/AuthController.php b/app/Http/Controllers/Customer/AuthController.php index 26e0ca2..88710cf 100644 --- a/app/Http/Controllers/Customer/AuthController.php +++ b/app/Http/Controllers/Customer/AuthController.php @@ -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', diff --git a/app/Models/AlipayAccount.php b/app/Models/AlipayAccount.php index 7c9c5f5..fb53fa3 100644 --- a/app/Models/AlipayAccount.php +++ b/app/Models/AlipayAccount.php @@ -8,3 +8,4 @@ class AlipayAccount extends SoftDeletesModel } +