From 6b375eaceca63a78cc724263275d539130c5b597 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Sun, 4 Feb 2024 14:35:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E9=85=92=E9=81=93?= =?UTF-8?q?=E9=A6=86=E5=85=B3=E8=81=94=E5=95=86=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/system/merchant/Merchant.php | 9 +++++++- .../system/merchant/MerchantRepository.php | 22 +++++++++++-------- .../admin/system/merchant/Merchant.php | 4 +++- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/common/model/system/merchant/Merchant.php b/app/common/model/system/merchant/Merchant.php index 2688e43..6a6b718 100644 --- a/app/common/model/system/merchant/Merchant.php +++ b/app/common/model/system/merchant/Merchant.php @@ -273,7 +273,14 @@ class Merchant extends BaseModel return app()->make(MerchantRepository::class)->createQrCode(['mer_id'=>$this->mer_id],'online_payment'); } - + // 商户查询关联的酒道馆 + public function shopMer(){ + return $this->hasOne(self::class,'shop_mer_id', 'mer_id'); + } + // 酒道馆查询关联的商户 + public function merShop(){ + return $this->hasOne(self::class,'mer_id', 'shop_mer_id'); + } /** * Common: 获取本月销售数量 diff --git a/app/common/repositories/system/merchant/MerchantRepository.php b/app/common/repositories/system/merchant/MerchantRepository.php index 7038b80..736618c 100644 --- a/app/common/repositories/system/merchant/MerchantRepository.php +++ b/app/common/repositories/system/merchant/MerchantRepository.php @@ -84,9 +84,15 @@ class MerchantRepository extends BaseRepository $query->field('mer_id,account'); }, 'merchantCategory', - 'merchantType' + 'merchantType', + 'shopMer' => function ($query) { + $query->field('mer_id,mer_name,shop_mer_id'); + }, + 'merShop' => function ($query) { + $query->field('mer_id,mer_name,shop_mer_id'); + }, ]) - ->field('sort,mer_id,mer_name,real_name,mer_phone,mer_address,mark,status,create_time,is_best,is_trader,type_id,category_id,copy_product_num,export_dump_num,is_margin,margin,ot_margin,mer_avatar,margin_remind_time')->select(); + ->field('sort,mer_id,mer_name,real_name,mer_phone,mer_address,mark,status,create_time,is_best,is_trader,type_id,category_id,copy_product_num,export_dump_num,is_margin,margin,ot_margin,mer_avatar,margin_remind_time,shop_mer_id')->select(); return compact('count', 'list'); } @@ -829,17 +835,15 @@ class MerchantRepository extends BaseRepository */ public function adminDetail($id) { - $data = $this->dao->getWhere(['mer_id' => $id],'*',['merchantType','merchantCategory'])->toArray(); + $data = $this->dao->getWhere(['mer_id' => $id],'*',['merchantType','merchantCategory','merShop'=>function($query){ + $query->field('mer_id,mer_name,shop_mer_id'); + }])->toArray(); $make = app()->make(MerchantAdminRepository::class); $data['mer_account'] = $make->merIdByAccount($id); $data['mer_password'] = '***********'; + if($data['category_id'] == 0) $data['category_id'] = ''; + if($data['type_id'] == 0) $data['type_id'] = ''; - if($data['category_id'] == 0){ - $data['category_id'] = ''; - } - if($data['type_id'] == 0){ - $data['type_id'] = ''; - } $data['mer_certificate'] = merchantConfig($id, 'mer_certificate'); return $data; } diff --git a/app/controller/admin/system/merchant/Merchant.php b/app/controller/admin/system/merchant/Merchant.php index 69db61a..f2a4e6c 100644 --- a/app/controller/admin/system/merchant/Merchant.php +++ b/app/controller/admin/system/merchant/Merchant.php @@ -77,7 +77,8 @@ class Merchant extends BaseController 'type_id', ['order','create_time'], 'is_best', - 'merchant_type' + 'merchant_type', + 'is_shop_get' ]); return app('json')->success($this->repository->lst($where, $page, $limit)); } @@ -222,6 +223,7 @@ class Merchant extends BaseController ['avg_consumption',0], 'mer_label', ['merchant_type',0], + 'shop_mer_id' ]); $data['mer_label'] = str_replace(',',',',$data['mer_label']); if (!$isUpdate) {