添加:酒道馆关联商户

This commit is contained in:
wuhui_zzw 2024-02-04 14:35:24 +08:00
parent b7062fc425
commit 6b375eacec
3 changed files with 24 additions and 11 deletions

View File

@ -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: 获取本月销售数量

View File

@ -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;
}

View File

@ -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) {