diff --git a/app/wechat/controller/api/Test.php b/app/wechat/controller/api/Test.php index 58750d762..0341228f7 100644 --- a/app/wechat/controller/api/Test.php +++ b/app/wechat/controller/api/Test.php @@ -34,10 +34,10 @@ class Test extends Controller * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException * @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException */ - public function jsapi_qrc() + public function jsapiQrc() { $this->url = sysuri('wechat/api.test/jsapi', [], false, true); - return $this->showQrc($this->url); + return $this->_buildQrcResponse($this->url); } /** @@ -47,10 +47,10 @@ class Test extends Controller * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException * @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException */ - public function oauth_qrc() + public function oauthQrc() { $this->url = sysuri('wechat/api.test/oauth', [], false, true); - return $this->showQrc($this->url); + return $this->_buildQrcResponse($this->url); } /** @@ -60,10 +60,10 @@ class Test extends Controller * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException * @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException */ - public function jssdk_qrc() + public function jssdkQrc() { $this->url = sysuri('wechat/api.test/jssdk', [], false, true); - return $this->showQrc($this->url); + return $this->_buildQrcResponse($this->url); } /** @@ -73,10 +73,10 @@ class Test extends Controller * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException * @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException */ - public function scan_one_qrc() + public function scanOneQrc() { $pay = WechatService::WePayOrder(); - return $this->showQrc($pay->qrcParams('8888888')); + return $this->_buildQrcResponse($pay->qrcParams('8888888')); } /** @@ -88,7 +88,7 @@ class Test extends Controller * @throws \WeChat\Exceptions\InvalidResponseException * @throws \WeChat\Exceptions\LocalCacheException */ - public function scan_two_qrc() + public function scanTwoQrc() { $result = WechatService::WePayOrder()->create([ 'body' => '测试商品', @@ -98,7 +98,7 @@ class Test extends Controller 'out_trade_no' => CodeExtend::uniqidNumber(18), 'spbill_create_ip' => $this->request->ip(), ]); - return $this->showQrc($result['code_url']); + return $this->_buildQrcResponse($result['code_url']); } /** @@ -141,7 +141,7 @@ class Test extends Controller * @throws \WeChat\Exceptions\InvalidResponseException * @throws \WeChat\Exceptions\LocalCacheException */ - public function scan_one_notify() + public function scanOneNotify() { $pay = WechatService::WePayOrder(); $notify = $pay->getNotify(); @@ -183,7 +183,6 @@ class Test extends Controller * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException - * @link wx-demo-jsapi */ public function jsapi() { @@ -252,7 +251,7 @@ class Test extends Controller * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException * @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException */ - private function showQrc(string $url) + private function _buildQrcResponse(string $url) { $qrCode = new \Endroid\QrCode\QrCode(); $qrCode->setText($url)->setSize(300)->setPadding(20)->setImageType('png'); diff --git a/app/wechat/view/config/testapi.html b/app/wechat/view/config/testapi.html index a5bfb9e56..7503c11ee 100644 --- a/app/wechat/view/config/testapi.html +++ b/app/wechat/view/config/testapi.html @@ -12,30 +12,36 @@

微信商户支付测试配置

JSAPI 支付测试需要在微信商户平台配置支付目录:{:sysuri('wechat/api.test/index',[],'',true)}

-

扫码支付①需要在微信商户平台配置支付通知地址:{:url('wechat/api.test/scan_one_notify',[],'',true)}

+

扫码支付①需要在微信商户平台配置支付通知地址:{:url('wechat/api.test/scanOneNotify',[],'',true)}

-
+
- +

网页授权

- img + img

JSSDK签名

- img + img

JSAPI支付

- img + img

扫码支付①

- img + img

扫码支付②

- \ No newline at end of file + +