|
@@ -44,7 +44,7 @@ class Product extends Auth{
|
|
// 查询条件
|
|
// 查询条件
|
|
$map = [];
|
|
$map = [];
|
|
// 是否有城市
|
|
// 是否有城市
|
|
- $wherIn = empty($custom['city_id']) ? [] : $cityIds;
|
|
|
|
|
|
+ $whereIn = $cityIds ? $cityIds : [];
|
|
// 编码ID
|
|
// 编码ID
|
|
if( $id ) $map[] = ['product.id','=',$id];
|
|
if( $id ) $map[] = ['product.id','=',$id];
|
|
if( $name ) $map[] = ['product.name','like','%'.$name.'%'];
|
|
if( $name ) $map[] = ['product.name','like','%'.$name.'%'];
|
|
@@ -53,7 +53,7 @@ class Product extends Auth{
|
|
if( !is_null($status) ) $map[] = ['product.status','=',$status];
|
|
if( !is_null($status) ) $map[] = ['product.status','=',$status];
|
|
// 查询数据
|
|
// 查询数据
|
|
$list = $Model->query();
|
|
$list = $Model->query();
|
|
- if( $wherIn ) $list = $list->join('product_city','product_city.product_id','=','product.id')->whereIn('product_city.city_id',$wherIn);
|
|
|
|
|
|
+ if( $whereIn ) $list = $list->join('product_city','product_city.product_id','=','product.id')->whereIn('product_city.city_id',$whereIn);
|
|
$list = $list->groupBy('product.id')
|
|
$list = $list->groupBy('product.id')
|
|
->where($map)
|
|
->where($map)
|
|
->orderBy('product.sort')
|
|
->orderBy('product.sort')
|