feature/main20240421
郭嘉 6 months ago
parent ae7205f93e
commit a7340f04d0
  1. 18
      app/common/model/Merchant.php
  2. 6
      app/store/controller/Merchant.php

@ -69,11 +69,25 @@ class Merchant extends BaseModel
* @param int $storeId
* @return static|array|null
*/
public static function detail(int $merchantId, int $storeId = 0)
public static function detail(int $merchantId)
{
$where = [
'merchant_id' => $merchantId,
'store_id' => self::$storeId ? self::$storeId : $storeId
'store_id' => self::$storeId
];
return static::get($where, []);
}
/**
* 详情信息
* @param int $storeId
* @return static|array|null
*/
public static function detailbystore(int $merchantId, int $storeId = 0)
{
$where = [
'merchant_id' => $merchantId,
'store_id' => $storeId
];
return static::get($where, []);
}

@ -75,7 +75,7 @@ class Merchant extends Controller
public function info(): Json
{
// 商城详情
$model = MerchantModel::detail($this->storeId);
$model = MerchantModel::detailbystore($this->storeId);
return $this->renderSuccess(['storeInfo' => $model]);
}
@ -86,7 +86,7 @@ class Merchant extends Controller
public function edit(): Json
{
// 商城详情
$model = MerchantModel::detail($this->postForm()['merchant_id'], $this->storeId);
$model = MerchantModel::detailbystore($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, $this->storeId);
$model = MerchantModel::detailbystore($merchantId, $this->storeId);
if (!$model->setDelete()) {
return $this->renderError($model->getError() ?: '删除失败');
}

Loading…
Cancel
Save