mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改支付通道配置
This commit is contained in:
parent
9576519c82
commit
23f670cf44
@ -3,6 +3,7 @@
|
||||
namespace app\data\controller;
|
||||
|
||||
use app\data\service\PaymentService;
|
||||
use app\data\service\UserService;
|
||||
use think\admin\Controller;
|
||||
|
||||
/**
|
||||
@ -73,6 +74,13 @@ class Payment extends Controller
|
||||
protected function _form_filter(array &$data)
|
||||
{
|
||||
if ($this->request->isGet()) {
|
||||
foreach ($this->types as &$vo) {
|
||||
$binds = [];
|
||||
foreach ($vo['bind'] as $api) if (isset(UserService::TYPES[$api])) {
|
||||
$binds[$api] = UserService::TYPES[$api]['name'];
|
||||
}
|
||||
$vo['allow'] = join('、', $binds);
|
||||
}
|
||||
$data['content'] = json_decode($data['content'] ?? '[]', true) ?: [];
|
||||
} else {
|
||||
$data['content'] = json_encode($this->request->post() ?: [], JSON_UNESCAPED_UNICODE);
|
||||
|
@ -25,16 +25,6 @@ abstract class PaymentService extends Service
|
||||
|
||||
// 支付通道配置
|
||||
const TYPES = [
|
||||
PaymentService::PAYMENT_JOINPAY_XCX => [
|
||||
'type' => 'WEIXIN_XCX',
|
||||
'name' => '汇聚小程序JSAPI支付',
|
||||
'bind' => [UserService::APITYPE_WXAPP],
|
||||
],
|
||||
PaymentService::PAYMENT_JOINPAY_GZH => [
|
||||
'type' => 'WEIXIN_GZH',
|
||||
'name' => '汇聚服务号JSAPI支付',
|
||||
'bind' => [UserService::APITYPE_WECHAT],
|
||||
],
|
||||
PaymentService::PAYMENT_WECHAT_MWEB => [
|
||||
'type' => 'MWEB',
|
||||
'name' => '微信商户H5支付',
|
||||
@ -50,6 +40,16 @@ abstract class PaymentService extends Service
|
||||
'name' => '微信商户JSAPI支付',
|
||||
'bind' => [UserService::APITYPE_WXAPP, UserService::APITYPE_WECHAT],
|
||||
],
|
||||
PaymentService::PAYMENT_JOINPAY_XCX => [
|
||||
'type' => 'WEIXIN_XCX',
|
||||
'name' => '汇聚小程序JSAPI支付',
|
||||
'bind' => [UserService::APITYPE_WXAPP],
|
||||
],
|
||||
PaymentService::PAYMENT_JOINPAY_GZH => [
|
||||
'type' => 'WEIXIN_GZH',
|
||||
'name' => '汇聚服务号JSAPI支付',
|
||||
'bind' => [UserService::APITYPE_WECHAT],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -18,19 +18,19 @@ class UserService extends Service
|
||||
|
||||
const TYPES = [
|
||||
UserService::APITYPE_WAP => [
|
||||
'name' => '手机浏览器访问',
|
||||
'name' => '手机浏览器终端',
|
||||
'auth' => '',
|
||||
],
|
||||
UserService::APITYPE_WEB => [
|
||||
'name' => '电脑浏览器访问',
|
||||
'name' => '电脑浏览器终端',
|
||||
'auth' => '',
|
||||
],
|
||||
UserService::APITYPE_WXAPP => [
|
||||
'name' => '微信小程序访问',
|
||||
'name' => '微信小程序终端',
|
||||
'auth' => 'openid1',
|
||||
],
|
||||
UserService::APITYPE_WECHAT => [
|
||||
'name' => '微信服务号访问',
|
||||
'name' => '微信服务号终端',
|
||||
'auth' => 'openid2',
|
||||
],
|
||||
];
|
||||
|
@ -19,13 +19,14 @@
|
||||
{foreach $types as $k => $v}
|
||||
<label class="think-radio notselect">
|
||||
{if $vo.type eq $k}
|
||||
<input data-payment-type checked type="radio" name="type" value="{$k}"> {$v.name}
|
||||
<input data-payment-type data-allow="{$v.allow}" checked type="radio" name="type" value="{$k}"> {$v.name}
|
||||
{else}
|
||||
<input data-payment-type type="radio" name="type" value="{$k}"> {$v.name}
|
||||
<input data-payment-type data-allow="{$v.allow}" type="radio" name="type" value="{$k}"> {$v.name}
|
||||
{/if}
|
||||
</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="help-block">此支付通道支持 <span class="color-blue" data-payment-info></span> 的终端用户通过 API 发起支付</div>
|
||||
</div>
|
||||
|
||||
<div data-payment-type="wechat">{include file='payment/form_wechat'}</div>
|
||||
@ -55,14 +56,15 @@
|
||||
{block name='script'}
|
||||
<script>
|
||||
$('input[data-payment-type]').on('change', function () {
|
||||
var type = $('input[data-payment-type]:checked').val() || '';
|
||||
if (type.indexOf('wechat') > -1) {
|
||||
var $radio = $('input[data-payment-type]:checked');
|
||||
if ($radio.val().indexOf('wechat') > -1) {
|
||||
$('[data-payment-type="wechat"]').removeClass('layui-hide')
|
||||
$('[data-payment-type="joinpay"]').addClass('layui-hide');
|
||||
} else {
|
||||
$('[data-payment-type="wechat"]').addClass('layui-hide')
|
||||
$('[data-payment-type="joinpay"]').removeClass('layui-hide');
|
||||
}
|
||||
$('[data-payment-info]').html($radio.data('allow'));
|
||||
}).trigger('change');
|
||||
</script>
|
||||
{/block}
|
Loading…
x
Reference in New Issue
Block a user