diff --git a/app/data/controller/api/Data.php b/app/data/controller/api/Data.php index 22dbb24f9..97afa171d 100644 --- a/app/data/controller/api/Data.php +++ b/app/data/controller/api/Data.php @@ -22,19 +22,4 @@ class Data extends Controller $data = sysdata(input('keys', 'slider')); $this->success('获取轮播图片数据', $data); } - - /** - * 获取支付通道数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getPayment() - { - $map = ['status' => 1, 'deleted' => 0]; - $query = $this->app->db->name('DataPayment')->where($map); - $result = $query->order('sort desc,id desc')->field('id,name,type')->select(); - $this->success('获取支付通道数据', $result->toArray()); - } - } \ No newline at end of file diff --git a/app/data/controller/api/auth/Config.php b/app/data/controller/api/auth/Config.php new file mode 100644 index 000000000..d1855652e --- /dev/null +++ b/app/data/controller/api/auth/Config.php @@ -0,0 +1,32 @@ + $arr) { + if (in_array($this->type, $arr['auth'])) $types[] = $type; + } + $map = ['status' => 1, 'deleted' => 0]; + $query = $this->app->db->name('DataPayment')->where($map)->whereIn('type', $types); + $result = $query->order('sort desc,id desc')->field('id,name,type,create_at')->select(); + $this->success('获取支付通道数据', $result->toArray()); + } +} \ No newline at end of file diff --git a/app/data/service/PaymentService.php b/app/data/service/PaymentService.php index db33c77ae..b4a7f1bfe 100644 --- a/app/data/service/PaymentService.php +++ b/app/data/service/PaymentService.php @@ -23,9 +23,18 @@ abstract class PaymentService extends Service // 支付通道描述 const TYPES = [ - PaymentService::PAYMENT_WECHAT_JSAPI => '微信商户支付', - PaymentService::PAYMENT_JOINPAY_XCX => '汇聚小程序支付', - PaymentService::PAYMENT_JOINPAY_GZH => '汇聚服务号支付', + PaymentService::PAYMENT_JOINPAY_XCX => [ + 'name' => '汇聚小程序支付', + 'auth' => [UserService::APITYPE_WXAPP], + ], + PaymentService::PAYMENT_JOINPAY_GZH => [ + 'name' => '汇聚服务号支付', + 'auth' => 'UserService::APITYPE_WECHAT', + ], + PaymentService::PAYMENT_WECHAT_JSAPI => [ + 'name' => '微信商户支付', + 'auth' => [UserService::APITYPE_WXAPP, UserService::APITYPE_WECHAT], + ], ]; /** diff --git a/app/data/view/payment/form.html b/app/data/view/payment/form.html index 165fd427d..1eab637a6 100644 --- a/app/data/view/payment/form.html +++ b/app/data/view/payment/form.html @@ -17,9 +17,9 @@ {foreach $types as $k => $v} {/foreach} diff --git a/app/data/view/payment/index.html b/app/data/view/payment/index.html index 66303d7ab..ae1124ed5 100644 --- a/app/data/view/payment/index.html +++ b/app/data/view/payment/index.html @@ -40,7 +40,7 @@ {$vo.name|default=''} - {$types[$vo.type]??$vo.type} + {$types[$vo.type]['name']??$vo.type} {if $vo.status eq 0}已禁用{elseif $vo.status eq 1}已激活{/if} {$vo.create_at|format_datetime} diff --git a/app/data/view/payment/index_search.html b/app/data/view/payment/index_search.html index 49dd493da..c2a34b6c0 100644 --- a/app/data/view/payment/index_search.html +++ b/app/data/view/payment/index_search.html @@ -14,9 +14,9 @@ {foreach $types as $k=>$v} {if $k eq input('type')} - + {else} - + {/if}{/foreach}