コード例 #1
0
 /**
  * 添加区域
  */
 public function regionAction()
 {
     if (ComTool::isAjax()) {
         $name = $this->post('name');
         $ename = $this->post('ename');
         $pid = $this->post('pid');
         $code = $this->post('code');
         $level = $this->post('level');
         $status = $this->post('status');
         $data = array();
         $data['name'] = $name;
         $data['ename'] = $ename;
         $data['pid'] = $pid;
         $data['code'] = $code;
         $data['level'] = $level;
         $data['status'] = $status;
         $res = RegionData::add($data);
         ComTool::result($res, '失败', '成功');
     }
     $citys = RegionData::getsByPid();
     $regions = RegionData::getsAll();
     $this->assign('citys', $citys);
     $this->assign('regions', $regions);
     $this->display();
 }
コード例 #2
0
ファイル: AccController.php プロジェクト: jianchengdu/dangjia
 /**
  * ajax获取地区信息
  */
 public function getlocationAction()
 {
     if (ComTool::isAjax()) {
         $ajax = $this->get('ajax');
         $id = intval($this->get('id', 0));
         $type = $this->get('t', 'c');
         //当前id的类型 city/area
         $locations = array();
         if ($type == 'c') {
             //获取某城市下区域
             $locations = RegionData::getsByPid($id);
         } elseif ($type == 'a') {
             //获取某区域的圈子
             $locations = GroupData::getsByRid($id);
         }
         $this->assign('list', $locations);
         $this->assign('type', $this->get('type'));
         $html = $this->fetch("Index/layer/select.html");
         ComTool::ajax(100000, 'ok', $html);
     }
 }