mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]更新接口测试
This commit is contained in:
parent
ba3491b394
commit
8d025d5379
@ -34,10 +34,10 @@ class Test extends Controller
|
|||||||
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
*/
|
*/
|
||||||
public function jsapi_qrc()
|
public function jsapiQrc()
|
||||||
{
|
{
|
||||||
$this->url = sysuri('wechat/api.test/jsapi', [], false, true);
|
$this->url = sysuri('wechat/api.test/jsapi', [], false, true);
|
||||||
return $this->showQrc($this->url);
|
return $this->_buildQrcResponse($this->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,10 +47,10 @@ class Test extends Controller
|
|||||||
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
*/
|
*/
|
||||||
public function oauth_qrc()
|
public function oauthQrc()
|
||||||
{
|
{
|
||||||
$this->url = sysuri('wechat/api.test/oauth', [], false, true);
|
$this->url = sysuri('wechat/api.test/oauth', [], false, true);
|
||||||
return $this->showQrc($this->url);
|
return $this->_buildQrcResponse($this->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,10 +60,10 @@ class Test extends Controller
|
|||||||
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
*/
|
*/
|
||||||
public function jssdk_qrc()
|
public function jssdkQrc()
|
||||||
{
|
{
|
||||||
$this->url = sysuri('wechat/api.test/jssdk', [], false, true);
|
$this->url = sysuri('wechat/api.test/jssdk', [], false, true);
|
||||||
return $this->showQrc($this->url);
|
return $this->_buildQrcResponse($this->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,10 +73,10 @@ class Test extends Controller
|
|||||||
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
*/
|
*/
|
||||||
public function scan_one_qrc()
|
public function scanOneQrc()
|
||||||
{
|
{
|
||||||
$pay = WechatService::WePayOrder();
|
$pay = WechatService::WePayOrder();
|
||||||
return $this->showQrc($pay->qrcParams('8888888'));
|
return $this->_buildQrcResponse($pay->qrcParams('8888888'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +88,7 @@ class Test extends Controller
|
|||||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||||
* @throws \WeChat\Exceptions\LocalCacheException
|
* @throws \WeChat\Exceptions\LocalCacheException
|
||||||
*/
|
*/
|
||||||
public function scan_two_qrc()
|
public function scanTwoQrc()
|
||||||
{
|
{
|
||||||
$result = WechatService::WePayOrder()->create([
|
$result = WechatService::WePayOrder()->create([
|
||||||
'body' => '测试商品',
|
'body' => '测试商品',
|
||||||
@ -98,7 +98,7 @@ class Test extends Controller
|
|||||||
'out_trade_no' => CodeExtend::uniqidNumber(18),
|
'out_trade_no' => CodeExtend::uniqidNumber(18),
|
||||||
'spbill_create_ip' => $this->request->ip(),
|
'spbill_create_ip' => $this->request->ip(),
|
||||||
]);
|
]);
|
||||||
return $this->showQrc($result['code_url']);
|
return $this->_buildQrcResponse($result['code_url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,7 +141,7 @@ class Test extends Controller
|
|||||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||||
* @throws \WeChat\Exceptions\LocalCacheException
|
* @throws \WeChat\Exceptions\LocalCacheException
|
||||||
*/
|
*/
|
||||||
public function scan_one_notify()
|
public function scanOneNotify()
|
||||||
{
|
{
|
||||||
$pay = WechatService::WePayOrder();
|
$pay = WechatService::WePayOrder();
|
||||||
$notify = $pay->getNotify();
|
$notify = $pay->getNotify();
|
||||||
@ -183,7 +183,6 @@ class Test extends Controller
|
|||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
* @link wx-demo-jsapi
|
|
||||||
*/
|
*/
|
||||||
public function jsapi()
|
public function jsapi()
|
||||||
{
|
{
|
||||||
@ -252,7 +251,7 @@ class Test extends Controller
|
|||||||
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
* @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
|
||||||
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
* @throws \Endroid\QrCode\Exceptions\ImageTypeInvalidException
|
||||||
*/
|
*/
|
||||||
private function showQrc(string $url)
|
private function _buildQrcResponse(string $url)
|
||||||
{
|
{
|
||||||
$qrCode = new \Endroid\QrCode\QrCode();
|
$qrCode = new \Endroid\QrCode\QrCode();
|
||||||
$qrCode->setText($url)->setSize(300)->setPadding(20)->setImageType('png');
|
$qrCode->setText($url)->setSize(300)->setPadding(20)->setImageType('png');
|
||||||
|
@ -12,30 +12,36 @@
|
|||||||
<div class="margin-bottom-0">
|
<div class="margin-bottom-0">
|
||||||
<p class="font-w7 color-green">微信商户支付测试配置</p>
|
<p class="font-w7 color-green">微信商户支付测试配置</p>
|
||||||
<p>JSAPI 支付测试需要在微信商户平台配置支付目录:<a data-copy="{:url('wechat/api.test/',[],'',true)}">{:sysuri('wechat/api.test/index',[],'',true)}</a></p>
|
<p>JSAPI 支付测试需要在微信商户平台配置支付目录:<a data-copy="{:url('wechat/api.test/',[],'',true)}">{:sysuri('wechat/api.test/index',[],'',true)}</a></p>
|
||||||
<p>扫码支付①需要在微信商户平台配置支付通知地址:<a data-copy="{:url('wechat/api.test/scan_one_notify',[],'',true)}">{:url('wechat/api.test/scan_one_notify',[],'',true)}</a></p>
|
<p>扫码支付①需要在微信商户平台配置支付通知地址:<a data-copy="{:url('wechat/api.test/scanOneNotify',[],'',true)}">{:url('wechat/api.test/scanOneNotify',[],'',true)}</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center margin-top-20">
|
<div class="text-center margin-top-20 test-qrcode-box">
|
||||||
<div class="inline-block padding-right-15 notselect">
|
<div class="inline-block padding-right-15 notselect">
|
||||||
<img alt="" class="notselect" data-tips-image src="{:url('wechat/api.test/oauth_qrc')}" style="width:120px">
|
<img alt="" class="notselect" data-tips-image src="{:url('wechat/api.test/oauthQrc')}">
|
||||||
<p class="text-center">网页授权</p>
|
<p class="text-center">网页授权</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-block padding-right-15">
|
<div class="inline-block padding-right-15">
|
||||||
<img alt="img" class="notselect" data-tips-image src="{:url('wechat/api.test/jssdk_qrc')}" style="width:120px;">
|
<img alt="img" class="notselect" data-tips-image src="{:url('wechat/api.test/jssdkQrc')}">
|
||||||
<p class="text-center">JSSDK签名</p>
|
<p class="text-center">JSSDK签名</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-block padding-right-15">
|
<div class="inline-block padding-right-15">
|
||||||
<img alt="img" onerror="this.src='__ROOT__/static/theme/img/wechat/qrc_pay_error.jpg'" class="notselect" data-tips-image src="{:url('wechat/api.test/jsapi_qrc')}" style="width:120px;">
|
<img alt="img" onerror="this.src='__ROOT__/static/theme/img/wechat/qrc_pay_error.jpg'" class="notselect" data-tips-image src="{:url('wechat/api.test/jsapiQrc')}">
|
||||||
<p class="text-center">JSAPI支付</p>
|
<p class="text-center">JSAPI支付</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-block padding-right-15">
|
<div class="inline-block padding-right-15">
|
||||||
<img alt="img" onerror="this.src='__ROOT__/static/theme/img/wechat/qrc_pay_error.jpg'" class="notselect" data-tips-image src="{:url('wechat/api.test/scan_one_qrc')}" style="width:120px;">
|
<img alt="img" onerror="this.src='__ROOT__/static/theme/img/wechat/qrc_pay_error.jpg'" class="notselect" data-tips-image src="{:url('wechat/api.test/scanOneQrc')}">
|
||||||
<p class="text-center">扫码支付①</p>
|
<p class="text-center">扫码支付①</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-block">
|
<div class="inline-block">
|
||||||
<img alt="img" onerror="this.src='__ROOT__/static/theme/img/wechat/qrc_pay_error.jpg'" class="notselect" data-tips-image src="{:url('wechat/api.test/scan_two_qrc')}" style="width:120px;">
|
<img alt="img" onerror="this.src='__ROOT__/static/theme/img/wechat/qrc_pay_error.jpg'" class="notselect" data-tips-image src="{:url('wechat/api.test/scanTwoQrc')}">
|
||||||
<p class="text-center">扫码支付②</p>
|
<p class="text-center">扫码支付②</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<style>
|
||||||
|
.test-qrcode-box img {
|
||||||
|
width: 130px;
|
||||||
|
height: 130px
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user