<?php
/** 
 * UQ云商：	www.uqcms.com  
 * 联系QQ：	2200631718 
 * 可免费商用，需要留UQ云商链接作为交换，只首页底部留取即可，不影响使用。
 */

defined('IN_UQ') or exit('Access Denied'); class area_uqcms extends control { function __construct(){ $this->aid = $_SESSION['admin']['aid']; parent::__construct(); } public function index() { $uq0 = $_GET['pid']??'0'; $uq1 = isset($_GET['prov'])?$_GET['prov']:''; $uq2 = isset($_GET['city'])?$_GET['city']:''; $uq3 = $this->db->get_all("select * from ".table('area')." where pid = ".$uq0); $this->assign('data',@$uq3); $uq4 = $this->db->get_all("select * from ".table('area')." where pid = 0"); $this->assign('provinceData',@$uq4); if(!empty($uq1)){ $uq5 = $this->db->get_all("select * from ".table('area')." where level = 2 and pid = ".$uq1); $this->assign('cityData',$uq5); } $this->display(); } public function edit() { $uq6 = $_GET['id']??false; if($uq6){ $uq7 = $this->db->get_one("select * from ".table('area')." where id = ".$uq6); $this->assign('row',$uq7); } $this->display(); } public function save() { if($_POST){ $uq8['name'] = P('name', '名称不能为空'); $uq8['letter'] = P('letter'); ; $uq8['status'] = P('status', '', '1'); $uq6 = P('id', false); if($uq6){ $uq9 = $this->db->update(table('area'), $uq8, 'id = '.$uq6); }else{ $uq9 = $this->db->add(table('area'), $uq8); } if($uq9){ right_json(); }else{ error_json('保存失败'); } }else{ error_json('提交错误'); } } public function get_all() { $uq10 = $this->module('area')->get_list(); echo json_encode($uq10); } public function del() { $uq11 = P('id', '编号提交错误'); $uq9 = $this->db->delete(table('area'), 'cid = '.$uq11); if($uq9){ right_json(); }else{ error_json('删除失败'); } } } 