Commit d51e59fc authored by zhz's avatar zhz

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into master_dev

parents 42d312a4 f9b68450
...@@ -12,8 +12,9 @@ class CityController extends \Our\Controller_AbstractIndex { ...@@ -12,8 +12,9 @@ class CityController extends \Our\Controller_AbstractIndex {
} }
public function getCityListAction(){ public function getCityListAction(){
$fromWx = $this->req[\Our\NameConst::data]['fromWx'];
$addressService = \Business\User\AddressServiceModel::getInstance(); $addressService = \Business\User\AddressServiceModel::getInstance();
$cityList = $addressService->getCityList(); $cityList = $addressService->getCityList($fromWx);
$this->success($cityList); $this->success($cityList);
} }
} }
\ No newline at end of file
...@@ -827,7 +827,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -827,7 +827,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
} }
$goodsIds[] = $goods['goods_id']; $goodsIds[] = $goods['goods_id'];
$goodsCommonIds[] = $goods['goods_commonid']; $goodsCommonIds[] = $goods['goods_commonid'];
$storeTotalPrice += $goods['goods_price']*$tempObj['goodsNum']; $storeTotalPrice += $tempObj['goodsPrice']*$tempObj['goodsNum'];
$storeCouponPrice = $storeTotalPrice; $storeCouponPrice = $storeTotalPrice;
$oneGoodsCommon = $goodsCommonStorages[$goods['goods_commonid']]; $oneGoodsCommon = $goodsCommonStorages[$goods['goods_commonid']];
$goodsStorage = isset($oneGoodsCommon[$goods['goods_id']])?$oneGoodsCommon[$goods['goods_id']]:array(); $goodsStorage = isset($oneGoodsCommon[$goods['goods_id']])?$oneGoodsCommon[$goods['goods_id']]:array();
......
...@@ -395,9 +395,13 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -395,9 +395,13 @@ class AddressServiceModel extends \Business\AbstractModel {
* 获取城市列表 * 获取城市列表
* @return bool * @return bool
*/ */
public function getCityList(){ public function getCityList($fromWx=false){
$areaDao =\DAO\AreaModel::getInstance(); $areaDao =\DAO\AreaModel::getInstance();
$citList = $areaDao->getCityList(); if($fromWx){
$citList = $areaDao->getCityListWithoutCounty();
}else{
$citList = $areaDao->getCityList();
}
if($citList){ if($citList){
return $citList; return $citList;
} }
......
...@@ -50,6 +50,32 @@ class AreaModel extends \DAO\AbstractModel { ...@@ -50,6 +50,32 @@ class AreaModel extends \DAO\AbstractModel {
return $result; return $result;
} }
public function getCityListWithoutCounty(){
$addressRedis = AddressRedisModel::getInstance();
$cityList = $addressRedis->find('cityListWithoutCounty');
if($cityList){
return $cityList;
}
$areaList = $this->getAllCityList(true);
$addressRedis->update('allCityListWithoutCounty',$areaList);
$cityListInitial = array();
$cityInitialList = array();
foreach($areaList as $area){
if(isset($area['initial'])&&$area['initial']&&!($cityInitialList&&in_array($area['initial'],$cityInitialList))){
$cityInitialList[] = $area['initial'];
}
$cityListInitial[$area['initial']][] = $area['area_name'];
}
$list = array();
foreach($cityInitialList as $inital){
$initalCity['initial'] = $inital;
$initalCity['list'] = $cityListInitial[$inital];
$list[] = $initalCity;
}
$addressRedis->update('cityListWithoutCounty',$list);
return $list;
}
public function getCityList(){ public function getCityList(){
$addressRedis = AddressRedisModel::getInstance(); $addressRedis = AddressRedisModel::getInstance();
...@@ -78,14 +104,18 @@ class AreaModel extends \DAO\AbstractModel { ...@@ -78,14 +104,18 @@ class AreaModel extends \DAO\AbstractModel {
return $list; return $list;
} }
public function getAllCityList(){ public function getAllCityList($withoutCounty=false){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$sql = " SELECT t1.area_name, t2.f_py as initial FROM han_area t1 "; $sql = " SELECT t1.area_name, t2.f_py as initial FROM han_area t1 ";
$sql .= " left join han_coslers t2 "; $sql .= " left join han_coslers t2 ";
$sql .= " on CONV(HEX(LEFT(CONVERT(t1.area_name USING gbk ), 1)), 16, 10) BETWEEN t2.cbegin AND t2.cend $sql .= " on CONV(HEX(LEFT(CONVERT(t1.area_name USING gbk ), 1)), 16, 10) BETWEEN t2.cbegin AND t2.cend
where t1.is_city=1 "; where t1.is_city=1 ";
if($withoutCounty){
$sql .= " and t1.area_name not like '%县'";
}
$sql .= " ORDER BY t1.area_deep,convert(t1.area_name using gbk) ASC "; $sql .= " ORDER BY t1.area_deep,convert(t1.area_name using gbk) ASC ";
$area_list = $this->db->query($sql)->rows; $area_list = $this->db->query($sql)->rows;
echo $this->db->getLastSql();
return $area_list; return $area_list;
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function goToDetail(problemId){ function goToDetail(problemId){
window.location.href = '/qa/detail?id='+problemId; location.href = '/qa/detail?id='+problemId;
} }
</script> </script>
</body> </body>
......
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