mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update Wechat.php
This commit is contained in:
parent
5cc35a0a48
commit
c4cf60d06a
@ -92,23 +92,39 @@ class Wechat extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 网页授权测试
|
* 网页授权测试
|
||||||
|
* 使用网页直接访问此链接
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function test(): string
|
public function test(): string
|
||||||
{
|
{
|
||||||
$base = sysuri('data/api.wechat/oauth', [], false, true);
|
|
||||||
return <<<EOL
|
return <<<EOL
|
||||||
<html lang="zh">
|
<html lang="zh">
|
||||||
<head>
|
<head>
|
||||||
<title>网页授权测试</title>
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<title>微信网页授权测试</title>
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
|
||||||
|
<style>pre{padding:20px;overflow:auto;margin-top:10px;background:#ccc;border-radius:6px;}</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content"></div>
|
<div>当前链接</div>
|
||||||
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
<pre>{$this->request->scheme()}://{$this->request->host()}/data/api.wechat/oauth?mode=1</pre>
|
||||||
<script src="{$base}?mode=1"></script>
|
|
||||||
<script>document.getElementById('content').innerText = JSON.stringify(window.WeChatFansInfo);</script>
|
<div style="margin-top:30px">粉丝数据</div>
|
||||||
|
<pre id="fansdata">待网页授权,加载粉丝数据...</pre>
|
||||||
|
|
||||||
|
<div style="margin-top:30px">用户数据</div>
|
||||||
|
<pre id="userdata">待网页授权,加载用户数据...</pre>
|
||||||
|
|
||||||
|
<script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||||
|
<script src="//{$this->request->host()}/data/api.wechat/oauth?mode=1"></script>
|
||||||
|
<script>
|
||||||
|
if(typeof window.WeChatFansInfo === 'object'){
|
||||||
|
document.getElementById('fansdata').innerText = JSON.stringify(window.WeChatFansInfo,null,2);
|
||||||
|
}
|
||||||
|
if(typeof window.WeChatUserInfo === 'object'){
|
||||||
|
document.getElementById('userdata').innerText = JSON.stringify(window.WeChatUserInfo,null,2);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
EOL;
|
EOL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user