feature/main20240421
郭嘉 8 months ago
parent ea3d3133b5
commit ae7205f93e
  1. 5
      app/common/model/Merchant.php
  2. 4
      app/store/controller/Merchant.php

@ -69,15 +69,16 @@ class Merchant extends BaseModel
* @param int $storeId * @param int $storeId
* @return static|array|null * @return static|array|null
*/ */
public static function detail(int $merchantId) public static function detail(int $merchantId, int $storeId = 0)
{ {
$where = [ $where = [
'merchant_id' => $merchantId, 'merchant_id' => $merchantId,
'store_id' => self::$storeId 'store_id' => self::$storeId ? self::$storeId : $storeId
]; ];
return static::get($where, []); return static::get($where, []);
} }
/** /**
* 获取列表数据 * 获取列表数据
* @param bool $isRecycle 是否在回收站 * @param bool $isRecycle 是否在回收站

@ -86,7 +86,7 @@ class Merchant extends Controller
public function edit(): Json 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())) { if (!$model->edit($this->postForm())) {
return $this->renderError($model->getError() ?: '更新失败'); return $this->renderError($model->getError() ?: '更新失败');
@ -118,7 +118,7 @@ class Merchant extends Controller
public function delete(int $merchantId): Json public function delete(int $merchantId): Json
{ {
// 门店详情 // 门店详情
$model = MerchantModel::detail($merchantId); $model = MerchantModel::detail($merchantId, $this->storeId);
if (!$model->setDelete()) { if (!$model->setDelete()) {
return $this->renderError($model->getError() ?: '删除失败'); return $this->renderError($model->getError() ?: '删除失败');
} }

Loading…
Cancel
Save