From f0bbba92e44900757513103383aad8cbf001004e Mon Sep 17 00:00:00 2001 From: xxb Date: Thu, 19 Aug 2021 10:41:09 +0800 Subject: [PATCH] area model update for get city first char --- common/models/Area_model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/models/Area_model.php b/common/models/Area_model.php index aa4f80f3..988f0f71 100755 --- a/common/models/Area_model.php +++ b/common/models/Area_model.php @@ -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; } }