mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改微信前端支持DEMO
This commit is contained in:
parent
f8ec39b54e
commit
a0bf759e58
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Think.Admin
|
// | Think.Admin
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
@ -19,13 +20,25 @@ use service\PayService;
|
|||||||
|
|
||||||
class Wap extends BasicWechat {
|
class Wap extends BasicWechat {
|
||||||
|
|
||||||
protected $check_auth = false;
|
/**
|
||||||
|
* 禁用自动网页授权
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $checkAuth = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网页授权DEMO
|
||||||
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
dump($this->oAuth());
|
// dump($this->oAuth(false)); // 仅获取用户openid
|
||||||
dump($this->fansinfo);
|
dump($this->oAuth()); // 获取用户详情信息
|
||||||
|
dump($this->fansinfo); // 打
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信二维码支付DEMO
|
||||||
|
* @return \think\response\Json|\think\response\View
|
||||||
|
*/
|
||||||
public function payqrc() {
|
public function payqrc() {
|
||||||
switch ($this->request->get('action')) {
|
switch ($this->request->get('action')) {
|
||||||
case 'payqrc':
|
case 'payqrc':
|
||||||
@ -52,6 +65,10 @@ class Wap extends BasicWechat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信JSAPI支付DEMO
|
||||||
|
* @return \think\response\Json|\think\response\View
|
||||||
|
*/
|
||||||
public function payjs() {
|
public function payjs() {
|
||||||
$this->openid = $this->oAuth(false);
|
$this->openid = $this->oAuth(false);
|
||||||
switch ($this->request->get('action')) {
|
switch ($this->request->get('action')) {
|
||||||
@ -76,7 +93,7 @@ class Wap extends BasicWechat {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return view();
|
return view();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -69,7 +69,7 @@ class BasicWechat extends Controller {
|
|||||||
protected function oAuth($fullMode = true) {
|
protected function oAuth($fullMode = true) {
|
||||||
// 本地开发调试用户 openid
|
// 本地开发调试用户 openid
|
||||||
if (in_array($this->request->host(), ['127.0.0.1', 'localhost'])) {
|
if (in_array($this->request->host(), ['127.0.0.1', 'localhost'])) {
|
||||||
session('openid', 'o38gps3vNdCqaggFfrBRCRikwlWY');
|
session('openid', 'oBWB3wWVNujb-PJlmPmxC5CBTNF0');
|
||||||
}
|
}
|
||||||
// 检查缓存中 openid 信息是否完整
|
// 检查缓存中 openid 信息是否完整
|
||||||
if (($this->openid = session('openid'))) {
|
if (($this->openid = session('openid'))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user