From b1fa8391b2394c7f5badaae867e619cfc45f03db Mon Sep 17 00:00:00 2001 From: lqmac Date: Sun, 2 Jun 2024 13:17:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/model/Order.php | 2 ++ app/api/service/cashier/Payment.php | 4 +++- app/common/model/Payment.php | 4 ++-- app/common/model/PaymentTemplate.php | 7 ++++--- app/store/model/Payment.php | 2 +- app/store/model/PaymentTemplate.php | 8 ++++---- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/api/model/Order.php b/app/api/model/Order.php index b284477b..27c384f3 100644 --- a/app/api/model/Order.php +++ b/app/api/model/Order.php @@ -469,6 +469,8 @@ class Order extends OrderModel 'pay_status' => $orderInfo['pay_status'], 'order_status' => $orderInfo['order_status'], 'create_time' => $orderInfo['create_time'], + 'store_id' => $orderInfo['store_id'], + 'merchant_id' => $orderInfo['merchant_id'], 'showExpiration' => $orderCloseTime > 0, 'expirationTime' => format_time($expirationTime), ]; diff --git a/app/api/service/cashier/Payment.php b/app/api/service/cashier/Payment.php index 1c251d26..17b51f9c 100644 --- a/app/api/service/cashier/Payment.php +++ b/app/api/service/cashier/Payment.php @@ -95,10 +95,12 @@ class Payment extends BaseService $userInfo = UserService::getCurrentLoginUser(true); // 根据指定客户端获取可用的支付方式 $PaymentModel = new PaymentModel; - $methods = $PaymentModel->getMethodsByClient($this->client); + // 获取结算订单信息 $OrderModel = new OrderModel; $orderInfo = $OrderModel->getUnpaidOrderDetail($this->orderId); + + $methods = $PaymentModel->getMethodsByClient($this->client, true, $orderInfo['store_id'], $orderInfo['merchant_id']); return [ 'order' => $orderInfo, 'personal' => $userInfo, diff --git a/app/common/model/Payment.php b/app/common/model/Payment.php index 04511159..55e71c8f 100644 --- a/app/common/model/Payment.php +++ b/app/common/model/Payment.php @@ -142,9 +142,9 @@ class Payment extends BaseModel { // 获取数据库中所有的支付方式 $where = []; - if (isset($merchantId) && $merchantId) { + //if (isset($merchantId) && $merchantId) { $where['merchant_id'] = $merchantId; - } + //} $list = $this->where($where)->where('store_id', '=', $storeId)->select(); if ($list->isEmpty()) { return []; diff --git a/app/common/model/PaymentTemplate.php b/app/common/model/PaymentTemplate.php index f1a28a05..bb5b0c1d 100644 --- a/app/common/model/PaymentTemplate.php +++ b/app/common/model/PaymentTemplate.php @@ -115,9 +115,10 @@ class PaymentTemplate extends BaseModel $where = [ ['is_delete', '=', 0], ]; - if (isset($merchantId) && $merchantId) { - $where[] = ['merchant_id', '=', $merchantId]; - } + // if (isset($merchantId) && $merchantId) { + // $where[] = ['merchant_id', '=', $merchantId]; + // } + $where[] = ['merchant_id', '=', $merchantId]; return $this->where($where) ->order(['sort' => 'asc', $this->getPk()]) ->select(); diff --git a/app/store/model/Payment.php b/app/store/model/Payment.php index 8ba5a393..ef27168a 100644 --- a/app/store/model/Payment.php +++ b/app/store/model/Payment.php @@ -32,7 +32,7 @@ class Payment extends PaymentModel // 生成写入的数据 $dataList = $this->buildData($form, $merchantId); // 删除所有的支付方式记录 - static::deleteAll([]); + static::deleteAll(['merchant_id' => $merchantId]); // 批量写入商品图片记录 $res = static::increased($dataList); // 删除系统设置缓存 diff --git a/app/store/model/PaymentTemplate.php b/app/store/model/PaymentTemplate.php index 47dee86d..81c527fe 100644 --- a/app/store/model/PaymentTemplate.php +++ b/app/store/model/PaymentTemplate.php @@ -37,10 +37,10 @@ class PaymentTemplate extends PaymentTemplateModel $where = [ ['is_delete', '=', 0], ]; - if (isset($merchantId) && $merchantId) { - $where[] = ['merchant_id', '=', $merchantId]; - } - + // if (isset($merchantId) && $merchantId) { + // $where[] = ['merchant_id', '=', $merchantId]; + // } + $where[] = ['merchant_id', '=', $merchantId]; return $this->where($where)->where('is_delete', '=', 0) ->order(['sort' => 'asc', $this->getPk()]) ->paginate(15);