|
@@ -45,7 +45,20 @@ class Product extends Auth{
|
|
|
$status = request('status');
|
|
|
$startTime = request('start_time','');
|
|
|
$businessId = request('business_id','');
|
|
|
+ $provinceId = request('province_id','');
|
|
|
$cityIds = request('city_ids',[]);
|
|
|
+ $cityList = $City->getCityList();
|
|
|
+ // 如果存在省份ID
|
|
|
+ if( $provinceId ) {
|
|
|
+ // 循环城市列表
|
|
|
+ foreach ($cityList as $group) {
|
|
|
+ // 如果省份ID对的上
|
|
|
+ if( $group['id'] == $provinceId){
|
|
|
+ // 获取下面的城市ID
|
|
|
+ $cityIds = array_merge($cityIds,array_column($group['city'],'id'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// 编码转ID
|
|
|
$id = $code ? $Model->codeToId($code) : 0;
|
|
|
// 查询条件
|
|
@@ -64,8 +77,8 @@ class Product extends Auth{
|
|
|
// 数据类型
|
|
|
$shopIds = ($session['menu_type'] == 1 && $session['data_type'] == 2) ? Business::query()->where('leader_uid',$session['admin_uid'])->pluck('id')->toArray() : [];
|
|
|
// 查询数据
|
|
|
- $list = $Model->query()->join('product_city','product_city.product_id','=','product.id');
|
|
|
- if( $cityIds ) $list = $list->whereIn('product_city.city_id',$cityIds);
|
|
|
+ $list = $Model->query();
|
|
|
+ if( $cityIds ) $list = $list->join('product_city','product_city.product_id','=','product.id')->whereIn('product_city.city_id',$cityIds);
|
|
|
if( $shopIds ) $list = $list->whereIn('product.business_id',$shopIds);
|
|
|
$list = $list->groupBy('product.id')
|
|
|
->where($map)
|
|
@@ -102,7 +115,6 @@ class Product extends Auth{
|
|
|
$list[$key] = $value;
|
|
|
}
|
|
|
// 获取列表
|
|
|
- $cityList = $City->getCityList();
|
|
|
$businessList = $Business->getListByAdmin();
|
|
|
// 分配数据
|
|
|
$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
|