Commit cb129299 authored by hujun's avatar hujun

商圈全部

parent a1ebeded
...@@ -95,6 +95,10 @@ class Regions extends Model ...@@ -95,6 +95,10 @@ class Regions extends Model
$data = []; $data = [];
$city_data = $this->field('code,fullName')->where('parentCode in ( '.$code.')')->select(); $city_data = $this->field('code,fullName')->where('parentCode in ( '.$code.')')->select();
$business = new GBusinessDistrict(); $business = new GBusinessDistrict();
$all_arr[0]['id'] = 0;
$all_arr[0]['name'] = '全部';
foreach ($city_data as $k=>$v) { foreach ($city_data as $k=>$v) {
$data[$k]['name'] = $v['fullName']; $data[$k]['name'] = $v['fullName'];
$data[$k]['city'] = $this->where('parentCode',$v['code'])->column('fullName'); $data[$k]['city'] = $this->where('parentCode',$v['code'])->column('fullName');
...@@ -103,9 +107,7 @@ class Regions extends Model ...@@ -103,9 +107,7 @@ class Regions extends Model
foreach ($data[$k]['city'] as $k2=>$v2) { foreach ($data[$k]['city'] as $k2=>$v2) {
$data[$k]['business_district'][$k2]['district'] = $v2; $data[$k]['business_district'][$k2]['district'] = $v2;
$business_arr = $business->field('id,name')->where('city',$v['fullName'])->where('disc', $v2)->select(); $business_arr = $business->field('id,name')->where('city',$v['fullName'])->where('disc', $v2)->select();
$data[$k]['business_district'][$k2]['business'][$k2]['id'] = ''; $data[$k]['business_district'][$k2]['business'] = array_merge($all_arr, $business_arr);
$data[$k]['business_district'][$k2]['business'][$k2]['name'] = '全部';
$data[$k]['business_district'][$k2]['business'][$k2+1] = $business_arr;
} }
} }
return $data; return $data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment