From aa9e329a1adfd4f54eb231debfc99c120d49b29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 14 Apr 2017 17:27:54 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Wap.php | 22 ++++++++- application/index/view/wap.payjs.html | 66 ++++++++------------------ application/index/view/wap.payqrc.html | 7 ++- 3 files changed, 45 insertions(+), 50 deletions(-) diff --git a/application/index/controller/Wap.php b/application/index/controller/Wap.php index 843e5db5c..57b067330 100644 --- a/application/index/controller/Wap.php +++ b/application/index/controller/Wap.php @@ -53,7 +53,27 @@ class Wap extends BasicWechat { } public function payjs() { + $this->oAuth(); + $this->assign('jsSign', load_wechat('script')->getJsSign($this->url)); + switch ($this->request->get('options')) { + case 'options': + $pay = &load_wechat('pay'); + $order_no = session('pay-test-order-no'); + if (empty($order_no)) { + $order_no = DataService::createSequence(10, 'wechat-pay-test'); + session('pay-test-order-no', $order_no); + } + if (PayService::isPay($order_no)) { + return json(['code' => 2, 'order_no' => $order_no]); + } + $options = PayService::createWechatPayJsPicker($pay, $this->openid, $order_no, 1, 'JSAPI支付测试'); + return json($options); + case 'reset': + session('pay-test-order-no', null); + break; + default: + return view(); - return view(); + } } } \ No newline at end of file diff --git a/application/index/view/wap.payjs.html b/application/index/view/wap.payjs.html index 009deb2d2..9afa31a38 100644 --- a/application/index/view/wap.payjs.html +++ b/application/index/view/wap.payjs.html @@ -10,60 +10,32 @@
-

扫码支付DEMO

-
-
- -
- -
+

JSAPI支付DEMO

+
+

金额: 0.01元

+
+

订单号:13412341234

+
+
+
+
-
- -
- -
-
-
-
-
- -
-
-
-
-
- -
-
- +
+