添加参数

This commit is contained in:
mkm 2023-10-31 18:30:48 +08:00
parent 153a100a1a
commit 7109aef2fc

View File

@ -9,8 +9,9 @@ use crmeb\basic\BaseController;
class StoreMicro extends BaseController
{
function seach_bar_code($mer_id,$code='',$name=''){
$category_id=Db::name('merchant')->where('mer_id',$mer_id)->value('category_id');
$mer_type_id = Db::name('MerchantType')->where('type_code', 'in',[Merchant::TypeCode['TypeSupplyChain'],Merchant::TypeCode['TypeTownSupplyChain']])->column('mer_type_id');
$mer_type_id = Db::name('MerchantType')->where('type_code', 'in',[Merchant::TypeCode['TypeSupplyChain'],Merchant::TypeCode['TypeTownSupplyChain'],Merchant::TypeCode['TypeStore']])->column('mer_type_id');
$platformMerId = app()->make(MerchantDao::class)->getValidMerchant(['category_id' => $category_id])->whereIn('type_id',$mer_type_id)->column('mer_id');
if($platformMerId==null){
return app('json')->fail('没有市级供应链或者镇级供应链');
@ -24,6 +25,9 @@ class StoreMicro extends BaseController
$product_id_arr=implode(',',$product_id_arr);
$find=Db::name('store_product')->where('product_id',$product_id_arr)->where($productWhere)->select();
}else{
if($name==''){
return app('json')->fail('参数不能为空');
}
$find=Db::name('store_product')->whereIn('mer_id',$platformMerId)->where('store_name','like','%'.$name.'%')->where($productWhere)->select();
}
if (count($find)==0){