From 6baecf52d0285b4a1f5f5f16f539158a55f86fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sat, 8 May 2021 15:33:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/api/auth/Order.php | 4 ++-- app/data/service/PaymentService.php | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/data/controller/api/auth/Order.php b/app/data/controller/api/auth/Order.php index 7e94cadf2..b81096a0b 100644 --- a/app/data/controller/api/auth/Order.php +++ b/app/data/controller/api/auth/Order.php @@ -306,9 +306,9 @@ class Order extends Auth if (empty($payments)) $this->error('获取订单支付参数失败'); // 读取支付通道配置 $query = $this->app->db->name('BaseUserPayment')->field('type,code,name,cover,content')->order('sort desc,id desc'); - $query->where(['status' => 1, 'deleted' => 0])->whereIn('code', str2arr($payments))->whereIn('type', PaymentService::getTypeByApi($this->type)); + $query->where(['status' => 1, 'deleted' => 0])->whereIn('code', str2arr($payments))->whereIn('type', PaymentService::getTypeApi($this->type)); $this->success('获取支付参数数据', $query->withAttr('content', function ($content) { - return json_encode($content, true); + return json_decode($content, true); })->select()->toArray()); } diff --git a/app/data/service/PaymentService.php b/app/data/service/PaymentService.php index 9502dd1c6..3d2b05169 100644 --- a/app/data/service/PaymentService.php +++ b/app/data/service/PaymentService.php @@ -236,11 +236,9 @@ abstract class PaymentService */ public static function getTypeAll(): array { - $types = []; + [$types, $binds] = [[], array_keys(UserAdminService::TYPES)]; foreach (self::TYPES as $k => $v) if (isset($v['bind'])) { - if (array_intersect($v['bind'], array_keys(UserAdminService::TYPES))) { - $types[$k] = $v; - } + if (array_intersect($v['bind'], $binds)) $types[$k] = $v; } return $types; } @@ -250,7 +248,7 @@ abstract class PaymentService * @param string $api * @return array */ - public static function getTypeByApi(string $api = ''): array + public static function getTypeApi(string $api = ''): array { $types = []; foreach (self::TYPES as $type => $attr) {