mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]增加微信测试模块
This commit is contained in:
parent
a0678f22d5
commit
0840899692
@ -15,6 +15,7 @@
|
|||||||
namespace app\wechat\controller\api;
|
namespace app\wechat\controller\api;
|
||||||
|
|
||||||
use controller\BasicAdmin;
|
use controller\BasicAdmin;
|
||||||
|
use Endroid\QrCode\QrCode;
|
||||||
use service\WechatService;
|
use service\WechatService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,6 +37,19 @@ class Tools extends BasicAdmin
|
|||||||
return $this->fetch('', ['fans' => $fans]);
|
return $this->fetch('', ['fans' => $fans]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示网页授权二维码
|
||||||
|
* @return \think\Response
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionFailedException
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
|
*/
|
||||||
|
public function oauth_qrc()
|
||||||
|
{
|
||||||
|
$url = url('@wechat/api.tools/oauth', '', true, true);
|
||||||
|
return $this->createQrc($url);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSSDK测试
|
* JSSDK测试
|
||||||
* @return string
|
* @return string
|
||||||
@ -47,4 +61,32 @@ class Tools extends BasicAdmin
|
|||||||
return $this->fetch('', ['options' => $options]);
|
return $this->fetch('', ['options' => $options]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示网页授权二维码
|
||||||
|
* @return \think\Response
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionFailedException
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
|
*/
|
||||||
|
public function jssdk_qrc()
|
||||||
|
{
|
||||||
|
$url = url('@wechat/api.tools/jssdk', '', true, true);
|
||||||
|
return $this->createQrc($url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建二维码响应对应
|
||||||
|
* @param string $url 二维码内容
|
||||||
|
* @return \think\Response
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionFailedException
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
|
*/
|
||||||
|
protected function createQrc($url)
|
||||||
|
{
|
||||||
|
$qrCode = new QrCode();
|
||||||
|
$qrCode->setText($url)->setSize(300)->setPadding(20)->setImageType(QrCode::IMAGE_TYPE_PNG);
|
||||||
|
return \think\facade\Response::header('Content-Type', 'image/png')->data($qrCode->get());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -19,6 +19,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
<div class="col-sm-10 padding-bottom-20">
|
||||||
|
<div class="pull-left padding-right-15 notselect" style="margin-left:-10px">
|
||||||
|
<img data-tips-image src="{:url('@wechat/api.tools/oauth_qrc')}" style="width:80px;">
|
||||||
|
<p class="text-center">网页授权</p>
|
||||||
|
</div>
|
||||||
|
<div class="pull-left padding-left-0">
|
||||||
|
<img data-tips-image src="{:url('@wechat/api.tools/oauth_qrc')}" style="width:80px;">
|
||||||
|
<p class="text-center">JSSDK签名</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="hr-line-dashed"></div>
|
<div class="hr-line-dashed"></div>
|
||||||
<!--{/if}-->
|
<!--{/if}-->
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user