Update Wechat.php

This commit is contained in:
邹景立 2021-03-20 17:02:42 +08:00
parent 7f74a4ff05
commit 7e022bf589

View File

@ -12,7 +12,6 @@ use think\Response;
* Class Wechat * Class Wechat
* @package app\data\controller\api * @package app\data\controller\api
* @example 域名请修改为自己的地址,放到网页代码合适位置 * @example 域名请修改为自己的地址,放到网页代码合适位置
* <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
* <script src="https://your.domain.com/data/api.wechat/oauth?mode=1"></script> * <script src="https://your.domain.com/data/api.wechat/oauth?mode=1"></script>
* *
* 授权模式支持两种模块,参数 mode=0 时为静默授权mode=1 时为完整授权 * 授权模式支持两种模块,参数 mode=0 时为静默授权mode=1 时为完整授权
@ -95,7 +94,7 @@ class Wechat extends Controller
* 使用网页直接访问此链接 * 使用网页直接访问此链接
* @return string * @return string
*/ */
public function test(): string public function otest(): string
{ {
return <<<EOL return <<<EOL
<html lang="zh"> <html lang="zh">
@ -115,8 +114,7 @@ class Wechat extends Controller
<div style="margin-top:30px">用户数据</div> <div style="margin-top:30px">用户数据</div>
<pre id="userdata">待网页授权,加载用户数据...</pre> <pre id="userdata">待网页授权,加载用户数据...</pre>
<script src="{$this->request->scheme()}://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 src="{$this->request->scheme()}://{$this->request->host()}/data/api.wechat/oauth?mode=1"></script>
<script> <script>
if(typeof window.WeChatFansInfo === 'object'){ if(typeof window.WeChatFansInfo === 'object'){
document.getElementById('fansdata').innerText = JSON.stringify(window.WeChatFansInfo, null, 2); document.getElementById('fansdata').innerText = JSON.stringify(window.WeChatFansInfo, null, 2);