From a0bf759e5874a41fabbb4594d3bcfb82a6091ffd Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 23 May 2017 17:50:05 +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=E5=89=8D=E7=AB=AF=E6=94=AF=E6=8C=81DEMO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Wap.php | 27 ++++++++++++++++++++++----- extend/controller/BasicWechat.php | 2 +- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/application/index/controller/Wap.php b/application/index/controller/Wap.php index 0a0bc77d4..188a76b78 100644 --- a/application/index/controller/Wap.php +++ b/application/index/controller/Wap.php @@ -1,4 +1,5 @@ oAuth()); - dump($this->fansinfo); +// dump($this->oAuth(false)); // 仅获取用户openid + dump($this->oAuth()); // 获取用户详情信息 + dump($this->fansinfo); // 打 } + /** + * 微信二维码支付DEMO + * @return \think\response\Json|\think\response\View + */ public function payqrc() { switch ($this->request->get('action')) { case 'payqrc': @@ -52,6 +65,10 @@ class Wap extends BasicWechat { } } + /** + * 微信JSAPI支付DEMO + * @return \think\response\Json|\think\response\View + */ public function payjs() { $this->openid = $this->oAuth(false); switch ($this->request->get('action')) { @@ -76,7 +93,7 @@ class Wap extends BasicWechat { break; default: return view(); - } } -} \ No newline at end of file + +} diff --git a/extend/controller/BasicWechat.php b/extend/controller/BasicWechat.php index 6cc7a6044..652498a53 100644 --- a/extend/controller/BasicWechat.php +++ b/extend/controller/BasicWechat.php @@ -69,7 +69,7 @@ class BasicWechat extends Controller { protected function oAuth($fullMode = true) { // 本地开发调试用户 openid if (in_array($this->request->host(), ['127.0.0.1', 'localhost'])) { - session('openid', 'o38gps3vNdCqaggFfrBRCRikwlWY'); + session('openid', 'oBWB3wWVNujb-PJlmPmxC5CBTNF0'); } // 检查缓存中 openid 信息是否完整 if (($this->openid = session('openid'))) {