area model update for get city first char

This commit is contained in:
xxb
2021-08-19 10:41:09 +08:00
committed by lccsw
parent ed8b8cbb96
commit 4cb5349db3
+4 -2
View File
@@ -39,16 +39,18 @@ class Area_model extends HD_Model
public function city($province_id = '',$type = 0)
{
$result = array();
$list = $this->select(array('province_id' => $province_id), null, null, null, 'distinct(city_id), city_name');
$list = $this->select(array('province_id' => $province_id), null, null, null, 'distinct(city_id), city_name, firstchar');
$type == 0 && $result[] = array('name'=>'城市','id'=>'');
if($list)
{
foreach ($list as $v)
{
$result[$v['city_id']] = array(
$item = array(
'id' => $v['city_id'],
'name' => $v['city_name'],
);
2 == $type && $item['firstchar'] = $v['firstchar'];
$result[$v['city_id']] = $item;
}
}