<?php
/**
 * [UQcms System] Copyright uqcms.com
 * QQ: 2200631718
 * Author: gj.name
 * This is NOT a freeware
*/
defined('IN_UQ') or exit('Access Denied'); class district_mod extends module { function get_city(){ for($i=65;$i<91;$i++){ $frist_letter = chr($i); $row['name'] = $frist_letter; $pquery = $this->db->query("select * from ".table('district')." where status = 1 and level = 2 and letter = '".$frist_letter."'"); while($prow = $this->db->fetch_array($pquery)){ $row['parent'][] = $prow; } if(count($row['parent']) != '0'){ $data[] = $row; } unset($row['parent']); } return $data; } public function edit_district($prov = NULL,$city = NULL){ if(empty($prov) && empty($city)){ $all = $this->db->get_all("select * from ".table('district')." where pid  = 0"); foreach($all as $k=>$v){ $sp_dist[$v['pid']][] = $v; } $data['prov'] = $sp_dist[0]; }else{ $all = $this->db->get_all("select * from ".table('district')." where pid in (0,".$prov.",".$city.")"); foreach($all as $k=>$v){ $sp_dist[$v['pid']][] = $v; } $data['prov'] = $sp_dist[0]; $data['city'] = $sp_dist[$prov]; $data['dist'] = $sp_dist[$city]; } return $data; } public function letter(){ for($i=65;$i<91;$i++){ $data[] = chr($i); } return $data; } public function get_prov(){ return $this->db->get_all("select * from ".table('district')." where status = 1 and pid = 0"); } public function get_address($array){ if(!empty($array)){ $str = implode(',', $array); return $this->db->get_all("select * from ".table('district')." where id in (".$str.")"); } } } 