|
@@ -121,7 +121,7 @@ class Api
|
|
*
|
|
*
|
|
* @return mixed
|
|
* @return mixed
|
|
*/
|
|
*/
|
|
- public function string($area, $im = ',', $unset = true, $name = '不限')
|
|
|
|
|
|
+ public function string($area, $im = ',', $unset = true, $name = '不限', $check = false)
|
|
{
|
|
{
|
|
if ($area) {
|
|
if ($area) {
|
|
if (is_string($area)) {
|
|
if (is_string($area)) {
|
|
@@ -138,9 +138,11 @@ class Api
|
|
unset($result[1]);
|
|
unset($result[1]);
|
|
}
|
|
}
|
|
} elseif ($k == 2) {
|
|
} elseif ($k == 2) {
|
|
- $result[$k] = $this->getName('county', $v, false, 'id', $name);
|
|
|
|
|
|
+ $parent = $area[0] . ',' . $area[1];
|
|
|
|
+ $result[$k] = $this->getName('county', $v, false, 'id', $name, $check, $parent);
|
|
} elseif ($k == 3) {
|
|
} elseif ($k == 3) {
|
|
- $result[$k] = $this->getName('town', $v, false, 'id', $name);
|
|
|
|
|
|
+ $parent = $area[0] . ',' . $area[1] . ',' . $area[2];
|
|
|
|
+ $result[$k] = $this->getName('town', $v, false, 'id', $name, $check, $parent);
|
|
} elseif ($k == 4) {
|
|
} elseif ($k == 4) {
|
|
$result[$k] = $this->getName('village', $v, false, 'id', $name);
|
|
$result[$k] = $this->getName('village', $v, false, 'id', $name);
|
|
} else {
|
|
} else {
|
|
@@ -156,7 +158,7 @@ class Api
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private function getName($table, $value, $state = false, $col = 'id', $name = '不限')
|
|
|
|
|
|
+ private function getName($table, $value, $state = false, $col = 'id', $name = '不限', $check = false, $area = array())
|
|
{
|
|
{
|
|
if (($col == 'id' && $value > 0) || ($col != 'id' && $value)) {
|
|
if (($col == 'id' && $value > 0) || ($col != 'id' && $value)) {
|
|
$where[$col] = $value;
|
|
$where[$col] = $value;
|
|
@@ -166,6 +168,9 @@ class Api
|
|
}
|
|
}
|
|
if ($data) {
|
|
if ($data) {
|
|
$name = $data['name'];
|
|
$name = $data['name'];
|
|
|
|
+ if ($check && $data['area'] != $area) {
|
|
|
|
+ $name = '<font style="color:red">'.$name.'</font>';
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return $name;
|
|
return $name;
|