diff --git a/app/common/dao/system/merchant/MerchantBrandDao.php b/app/common/dao/system/merchant/MerchantBrandDao.php index c75fb33..55ee245 100644 --- a/app/common/dao/system/merchant/MerchantBrandDao.php +++ b/app/common/dao/system/merchant/MerchantBrandDao.php @@ -24,7 +24,7 @@ class MerchantBrandDao extends BaseDao{ $query->where('id', (int)$params['id']); }) ->when(isset($params['title']) && $params['title'] !== '',function($query) use ($params){ - $query->where('title', 'like', "%${$params['title']}%"); + $query->where('title', 'like', "%{$params['title']}%"); }) ->when(isset($params['equivalent_to_title']) && $params['equivalent_to_title'] !== '',function($query) use ($params){ $query->where('title', $params['equivalent_to_title']); diff --git a/app/common/model/system/merchant/Merchant.php b/app/common/model/system/merchant/Merchant.php index 6a6b718..7983a8b 100644 --- a/app/common/model/system/merchant/Merchant.php +++ b/app/common/model/system/merchant/Merchant.php @@ -282,6 +282,10 @@ class Merchant extends BaseModel return $this->hasOne(self::class,'mer_id', 'shop_mer_id'); } + public function brand(){ + return $this->hasOne(MerchantBrand::class,'id', 'brand_id'); + } + /** * Common: 获取本月销售数量 * Author: wu-hui diff --git a/app/common/repositories/system/merchant/MerchantRepository.php b/app/common/repositories/system/merchant/MerchantRepository.php index 736618c..36ab72c 100644 --- a/app/common/repositories/system/merchant/MerchantRepository.php +++ b/app/common/repositories/system/merchant/MerchantRepository.php @@ -91,8 +91,11 @@ class MerchantRepository extends BaseRepository 'merShop' => function ($query) { $query->field('mer_id,mer_name,shop_mer_id'); }, + 'brand' => function ($query) { + $query->field('id,title'); + }, ]) - ->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(); + ->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,brand_id')->select(); return compact('count', 'list'); } diff --git a/app/controller/admin/system/merchant/Merchant.php b/app/controller/admin/system/merchant/Merchant.php index f2a4e6c..e252137 100644 --- a/app/controller/admin/system/merchant/Merchant.php +++ b/app/controller/admin/system/merchant/Merchant.php @@ -223,7 +223,8 @@ class Merchant extends BaseController ['avg_consumption',0], 'mer_label', ['merchant_type',0], - 'shop_mer_id' + 'shop_mer_id', + 'brand_id' ]); $data['mer_label'] = str_replace(',',',',$data['mer_label']); if (!$isUpdate) {