From ae7205f93e6b6e8f654f3381902d7d25ab6712e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E5=98=89?= <445241500@qq.com> Date: Sat, 1 Jun 2024 10:07:38 +0800 Subject: [PATCH] 1 --- app/common/model/Merchant.php | 5 +++-- app/store/controller/Merchant.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/common/model/Merchant.php b/app/common/model/Merchant.php index 8e382063..dc6928b9 100644 --- a/app/common/model/Merchant.php +++ b/app/common/model/Merchant.php @@ -69,15 +69,16 @@ class Merchant extends BaseModel * @param int $storeId * @return static|array|null */ - public static function detail(int $merchantId) + public static function detail(int $merchantId, int $storeId = 0) { $where = [ 'merchant_id' => $merchantId, - 'store_id' => self::$storeId + 'store_id' => self::$storeId ? self::$storeId : $storeId ]; return static::get($where, []); } + /** * 获取列表数据 * @param bool $isRecycle 是否在回收站 diff --git a/app/store/controller/Merchant.php b/app/store/controller/Merchant.php index f187ec89..5a95d6ee 100644 --- a/app/store/controller/Merchant.php +++ b/app/store/controller/Merchant.php @@ -86,7 +86,7 @@ class Merchant extends Controller public function edit(): Json { // 商城详情 - $model = MerchantModel::detail($this->postForm()['merchant_id']); + $model = MerchantModel::detail($this->postForm()['merchant_id'], $this->storeId); // 更新记录 if (!$model->edit($this->postForm())) { return $this->renderError($model->getError() ?: '更新失败'); @@ -118,7 +118,7 @@ class Merchant extends Controller public function delete(int $merchantId): Json { // 门店详情 - $model = MerchantModel::detail($merchantId); + $model = MerchantModel::detail($merchantId, $this->storeId); if (!$model->setDelete()) { return $this->renderError($model->getError() ?: '删除失败'); }