From 8faf8827ffcccb2274406ade9bc973175e804bc7 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:45:03 +0800 Subject: [PATCH] Update Order.php --- app/data/controller/api/auth/Order.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/data/controller/api/auth/Order.php b/app/data/controller/api/auth/Order.php index b81096a0b..e2feb00d6 100644 --- a/app/data/controller/api/auth/Order.php +++ b/app/data/controller/api/auth/Order.php @@ -295,9 +295,6 @@ class Order extends Auth /** * 获取支付支付数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException */ public function channel() { @@ -305,11 +302,11 @@ class Order extends Auth $payments = $this->app->db->name('ShopOrder')->where($data)->value('payment_allow'); 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::getTypeApi($this->type)); - $this->success('获取支付参数数据', $query->withAttr('content', function ($content) { - return json_decode($content, true); - })->select()->toArray()); + $query = $this->app->db->name('BaseUserPayment')->where(['status' => 1, 'deleted' => 0]); + $query->whereIn('code', str2arr($payments))->whereIn('type', PaymentService::getTypeApi($this->type)); + $result = $query->order('sort desc,id desc')->column('type,code,name,cover,content', 'code'); + foreach ($result as &$vo) $vo['content'] = ['voucher_qrcode' => json_decode($vo['content'])->voucher_qrcode ?? '']; + $this->success('获取支付参数数据', array_values($result)); } /**