|
@@ -34,24 +34,24 @@ class PublicController
|
|
|
public function test()
|
|
public function test()
|
|
|
{
|
|
{
|
|
|
$province = SystemCity::where('level', 0)->select();
|
|
$province = SystemCity::where('level', 0)->select();
|
|
|
- $res = "window.province_city_area = [";
|
|
|
|
|
|
|
+ $res = "export default [";
|
|
|
foreach ($province as $k => $v) {
|
|
foreach ($province as $k => $v) {
|
|
|
$child = "";
|
|
$child = "";
|
|
|
$citys = SystemCity::where('level', 1)->where('parent_id', $v['city_id'])->select();
|
|
$citys = SystemCity::where('level', 1)->where('parent_id', $v['city_id'])->select();
|
|
|
if (count($citys)) {
|
|
if (count($citys)) {
|
|
|
- $child = ', "children": [';
|
|
|
|
|
|
|
+ $child = ', "city": [';
|
|
|
foreach ($citys as $kk => $vv) {
|
|
foreach ($citys as $kk => $vv) {
|
|
|
$childs = "";
|
|
$childs = "";
|
|
|
$dictres = SystemCity::where('level', 2)->where('parent_id', $vv['city_id'])->select();
|
|
$dictres = SystemCity::where('level', 2)->where('parent_id', $vv['city_id'])->select();
|
|
|
if (count($dictres)) {
|
|
if (count($dictres)) {
|
|
|
- $childs = ', "children": [';
|
|
|
|
|
|
|
+ $childs = ', "area": [';
|
|
|
foreach ($dictres as $kkk => $vvv) {
|
|
foreach ($dictres as $kkk => $vvv) {
|
|
|
- $ress = $kkk == 0 ? ('{"value": "' . $vvv['name'] . '", "label": "' . $vvv['name'] . '"}') : (',{"value": "' . $vvv['name'] . '", "label": "' . $vvv['name'] . '"}');
|
|
|
|
|
|
|
+ $ress = $kkk == 0 ? ('{"name": "' . $vvv['name'] . '"}') : (',{"name": "' . $vvv['name'] . '"}');
|
|
|
$childs .= $ress;
|
|
$childs .= $ress;
|
|
|
}
|
|
}
|
|
|
$childs .= "]";
|
|
$childs .= "]";
|
|
|
}
|
|
}
|
|
|
- $ress = $kk == 0 ? ('{"value": "' . $vv['name'] . '", "label": "' . $vv['name'] . '"') : (',{"value": "' . $vv['name'] . '", "label": "' . $vv['name'] . '"');
|
|
|
|
|
|
|
+ $ress = $kk == 0 ? ('{"name": "' . $vv['name'] . '"') : (',{"name": "' . $vv['name'] . '"');
|
|
|
if ($childs) $ress .= $childs;
|
|
if ($childs) $ress .= $childs;
|
|
|
$ress .= '}';
|
|
$ress .= '}';
|
|
|
$child .= $ress;
|
|
$child .= $ress;
|
|
@@ -63,7 +63,7 @@ class PublicController
|
|
|
$ress .= '}';
|
|
$ress .= '}';
|
|
|
$res .= $ress;
|
|
$res .= $ress;
|
|
|
}
|
|
}
|
|
|
- $res .= '];';
|
|
|
|
|
|
|
+ $res .= ']';
|
|
|
var_dump($res);
|
|
var_dump($res);
|
|
|
}
|
|
}
|
|
|
|
|
|