Пример #1
0
 public function update()
 {
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     if (!$this->input['name']) {
         $this->errorOutput(NO_NAME);
     }
     if ($this->input['tel']) {
         $tel = implode(',', array_filter($this->input['tel']));
     }
     if ($this->input['logo_id']) {
         $img_id = implode(',', array_filter($this->input['logo_id']));
         //多图图片数组去空
     }
     $update_data = array('name' => trim($this->input['name']), 'index_pic' => intval($this->input['logo']), 'logo_id' => isset($img_id) ? $img_id : '', 'address' => trim($this->input['address']), 'opening_time' => trim($this->input['opening_time']), 'tel' => isset($tel) ? $tel : '', 'parking_num' => $this->input['parking_num'], 'baidu_longitude' => $this->input['baidu_longitude'], 'baidu_latitude' => $this->input['baidu_latitude'], 'brief' => trim($this->input['brief']), 'traffic' => trim($this->input['traffic']), 'free_bus' => $this->input['free_bus'], 'update_time' => TIMENOW, 'update_user_name' => $this->user['user_name'], 'update_user_id' => $this->user['user_id']);
     //如果百度坐标存在的话,就转换为gps坐标也存起来
     if ($update_data['baidu_latitude'] && $update_data['baidu_longitude']) {
         $gps = FromBaiduToGpsXY($update_data['baidu_longitude'], $update_data['baidu_latitude']);
         $update_data['gps_x'] = $gps['gps_x'];
         $update_data['gps_y'] = $gps['gps_y'];
     } else {
         $update_data['gps_x'] = 0;
         $update_data['gps_y'] = 0;
     }
     $ret = $this->mode->update($this->input['id'], $update_data);
     if ($ret) {
         $this->addLogs('更新门户信息', $ret, '', '更新门户信息' . $this->input['id']);
         $this->addItem('success');
         $this->output();
     }
 }
Пример #2
0
 function create()
 {
     $avatar = $this->attachlib->get_avatar($this->user['user_id']);
     $content = $this->input['thread'];
     $topic_id = $this->input['tid'];
     $pcd = intval($this->input['pcd']);
     $aid = urldecode($this->input['aid']);
     if ($aid) {
         $aid_array = array_filter(explode(',', $aid));
         $aid = $this->attachlib->tmp2att($aid_array);
     }
     if ($pcd) {
         $c = new content();
         $article = $c->get_published_content_byid($pcd);
         if ($article) {
             $extend_arc = array('title' => $article['title'], 'brief' => $article['brief'], 'href' => $article['content_url'], 'bundle_id' => $article['bundle_id'], 'module_id' => $article['module_id']);
             $article = is_array($article['indexpic']) ? array('host' => $article['indexpic']['host'], 'dir' => $article['indexpic']['dir'], 'filepath' => $article['indexpic']['filepath'], 'filename' => $article['indexpic']['filename']) : array();
             $aid .= ',' . $this->attachlib->attach($article, 'publish', 'attach', $extend_arc);
         }
     }
     if (!$topic_id) {
         $this->errorOutput("请选择一个话题");
     }
     $short_link = $this->attachlib->outlink(urldecode($this->input['outlink']));
     if ($short_link) {
         $aid .= ',' . $short_link;
     }
     $location = array('lat' => $this->input['lat'], 'lon' => $this->input['lon'], 'address' => urldecode($this->input['address']), 'gpsx' => $this->input['gpsx'], 'gpsy' => $this->input['gpsy']);
     if ($location['lat'] && $location['lon']) {
         $loc = FromBaiduToGpsXY($location['lon'], $location['lat']);
         $location['gpsx'] = $loc['x'];
         $location['gpsy'] = $loc['y'];
     } elseif ($location['gpsx'] && $location['gpsy']) {
         $loc = FromGpsToBaiduXY($location['gpsx'], $location['gpsy']);
         $location['lon'] = $loc['x'];
         $location['lat'] = $loc['y'];
     }
     if ($map = $this->attachlib->map($location)) {
         $aid .= ',' . $map;
     }
     if (!$content && !$aid) {
         $this->errorOutput("内容不能为空");
     }
     $aid = $aid ? trim($aid, ',') : '';
     $data = array('tid' => $topic_id, 'content' => $content, 'aid' => $aid, 'client' => $this->input['client'] ? $this->input['client'] : $this->user['user_name'], 'status' => 0, 'create_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'avatar' => $avatar ? addslashes(serialize($avatar)) : '', 'user_name' => $this->user['user_name'], 'pcd' => $pcd, 'ip' => hg_getip());
     $sql = 'INSERT INTO ' . DB_PREFIX . 'thread SET ';
     foreach ($data as $key => $val) {
         $sql .= "`{$key}` = \"{$val}\",";
     }
     $sql = trim($sql, ',');
     $this->db->query($sql);
     $data['id'] = $this->db->insert_id();
     $data['format_create_time'] = hg_tran_time($data['create_time']);
     $data['materail'] = $this->attachlib->get_attach_by_aid($aid);
     $this->attachlib->delete_attach(urldecode($this->input['aid']));
     $this->addItem($data);
     $this->output();
 }
Пример #3
0
 public function get_conditions()
 {
     $conditions = '';
     if ($this->input['fav']) {
         $sql = 'SELECT * FROM ' . DB_PREFIX . 'favorite where user_id=' . $this->user['user_id'];
         $fav_id = $this->db->query_first($sql);
         $this->input['id'] = $fav_id['tid'] ? $fav_id['tid'] : '-1';
     }
     if ($this->input['id']) {
         $ids = explode(',', $this->input['id']);
         foreach ($ids as $id) {
             if (!intval($id)) {
                 $this->errorOutput(PARAMETER_ERROR);
             }
         }
         $conditions .= ' AND id IN(' . $this->input['id'] . ')';
     }
     if ($this->input['user_id']) {
         $conditions .= ' AND user_id =  ' . $this->input['user_id'];
     }
     if ($this->input['sid']) {
         $conditions .= ' AND sid =  ' . $this->input['sid'];
     }
     $conditions .= ' AND status=1';
     $distance = intval($this->input['distance']);
     $lon = $this->input['lon'];
     $lat = $this->input['lat'];
     $gpsx = $this->input['gpsx'];
     $gpsy = $this->input['gpsy'];
     if ($lat && $lon) {
         $loc = FromBaiduToGpsXY($lon, $lat);
         $gpsx = $loc['x'];
         $gpsy = $loc['y'];
     } elseif ($gpsx && $gpsy) {
         $loc = FromGpsToBaiduXY($gpsx, $gpsy);
         $lon = $loc['x'];
         $lat = $loc['y'];
     }
     $this->location = array('lat' => $lat, 'lon' => $lon, 'gpsx' => $gpsx, 'gpsy' => $gpsy);
     if ($gpsx && $gpsy && $distance) {
         $range = 180 / pi() * $distance / 6372.797;
         //里面的 $distance 就代表搜索 $distance 之内,单位km
         $lngR = $range / cos($gpsx * pi() / 180);
         //echo $range;exit()
         $maxLat = $gpsx + $range;
         //最大纬度
         $minLat = $gpsx - $range;
         //最小纬度
         $maxLng = $gpsy + $lngR;
         //最大经度
         $minLng = $gpsy - $lngR;
         //最小经度
         $condition .= ' AND gpsy >=' . $minLng . ' AND gpsy <=' . $maxLng . ' AND gpsx >=' . $minLat . ' AND gpsx <= ' . $maxLat . ' AND gpsy != 0.00000000000000 AND gpsx != 0.00000000000000 ';
     }
     return $conditions;
 }
Пример #4
0
 public function get_conditions()
 {
     $conditions = '';
     if ($this->input['id']) {
         $ids = explode(',', $this->input['id']);
         foreach ($ids as $id) {
             if (!intval($id)) {
                 $this->errorOutput(PARAMETER_ERROR);
             }
         }
         $conditions .= ' AND id IN(' . $this->input['id'] . ')';
     }
     if ($this->input['user_id']) {
         $conditions .= ' AND user_id =  ' . $this->input['user_id'];
     }
     if ($this->input['sid']) {
         $conditions .= ' AND sid =  ' . $this->input['sid'];
     }
     $distance = intval($this->input['distance']);
     $lon = $this->input['lon'];
     $lat = $this->input['lat'];
     $gpsx = $this->input['gpsx'];
     $gpsx = $this->input['gpsy'];
     if ($lat && $lon) {
         $loc = FromBaiduToGpsXY($lat, $lon);
         $gpsx = $loc['x'];
         $gpsy = $loc['y'];
     }
     if ($gpsx && $gpsy && $distance) {
         $range = 180 / pi() * $distance / 6372.797;
         //里面的 $distance 就代表搜索 $distance 之内,单位km
         $lngR = $range / cos($gpsx * pi() / 180);
         //echo $range;exit()
         $maxLat = $gpsx + $range;
         //最大纬度
         $minLat = $gpsx - $range;
         //最小纬度
         $maxLng = $gpsy + $lngR;
         //最大经度
         $minLng = $gpsy - $lngR;
         //最小经度
         $condition .= ' AND gpsy >=' . $minLng . ' AND gpsy <=' . $maxLng . ' AND gpsx >=' . $minLat . ' AND gpsx <= ' . $maxLat . ' AND gpsy != 0.00000000000000 AND gpsx != 0.00000000000000 ';
     }
     return $conditions;
 }
Пример #5
0
 protected function initdata()
 {
     $avatar = $this->attachlib->get_avatar($this->user['user_id']);
     $this->value = array('id' => $this->input['id'], 'title' => $this->input['title'], 'brief' => urldecode($this->input['brief']), 'indexpic' => '', 'status' => intval($this->input['status']), 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'avatar' => $avatar ? addslashes(serialize($avatar)) : '', 'create_time' => TIMENOW, 'sid' => intval($this->input['sid']), 'update_time' => TIMENOW, 'lon' => $this->input['lon'], 'lat' => $this->input['lat'], 'gpsx' => $this->input['gpsx'], 'gpsy' => $this->input['gpsy'], 'aid' => $this->input['aid']);
     if ($this->value['lat'] && $this->value['lon']) {
         $loc = FromBaiduToGpsXY($this->value['lon'], $this->value['lat']);
         $this->value['gpsx'] = $loc['x'];
         $this->value['gpsy'] = $loc['y'];
     }
     if (!$this->value['title']) {
         $this->errorOutput("话题内容不能为空");
     }
     if ($this->value['aid']) {
         $this->value['aid'] = $this->attachlib->tmp2att(urldecode($this->value['aid']));
     }
     if ($this->value['id']) {
         $record = $this->db->query_first('SELECT aid FROM ' . DB_PREFIX . 'topic WHERE id IN(' . $this->value['id'] . ')');
         if ($record['aid']) {
             $this->value['aid'] .= ',' . $record['aid'];
         }
     }
     $location = array('lat' => $this->value['lat'], 'lon' => $this->value['lon'], 'gpsx' => $this->value['gpsx'], 'gpsy' => $this->value['gpsy'], 'address' => $this->input['address']);
     $map_aid = $this->attachlib->map($location);
     if ($map_aid) {
         $this->value['aid'] .= ',' . $map_aid;
     }
     $loc_aid = $this->attachlib->outlink(urldecode($this->input['outlink']));
     if ($loc_aid) {
         $this->value['aid'] .= ',' . $loc_aid;
     }
     $this->value['aid'] = trim($this->value['aid'], ',');
     if (!$_FILES['indexpic']) {
         unset($this->value['indexpic']);
     } else {
         //上传图片服务器
         $attach_info = $this->attach->upload($_FILES['indexpic'], 'img');
         $attach_info = !empty($attach_info[0]) ? $attach_info[0] : array();
         //file_put_contents(CACHE_DIR.'debug.txt', var_export($attach_info,1));
         if ($attach_info) {
             $this->value['indexpic'] = addslashes(serialize(array('host' => $attach_info['host'], 'dir' => $attach_info['dir'], 'filepath' => $attach_info['filepath'], 'filename' => $attach_info['filename'])));
         }
     }
 }
Пример #6
0
 function create()
 {
     $name = $this->input['name'];
     if (!$name) {
         $this->errorOutput("请填写站点名称");
     }
     $station_id = intval($this->input['station_id']);
     if (!$station_id) {
         $this->errorOutput('站点编号为数字');
     }
     $region_id = intval($this->input['region_id']);
     if (!$region_id) {
         //$this->errorOutput("请选择区域");
     }
     $company_id = intval($this->input['company_id']);
     if (!$company_id) {
         //$this->errorOutput('请选择运营单位');
     }
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     if ($this->user['group_type'] > MAX_ADMIN_TYPE && $this->input['region_id']) {
         $sql = 'SELECT id, parents FROM ' . DB_PREFIX . 'region WHERE id IN(' . $this->input['region_id'] . ')';
         $query = $this->db->query($sql);
         while ($row = $this->db->fetch_array($query)) {
             $nodes['nodes'][$row['id']] = $row['parents'];
         }
     }
     $nodes['_action'] = 'manage';
     $this->verify_content_prms($nodes);
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $totalnum = intval($this->input['totalnum']);
     $currentnum = intval($this->input['currentnum']);
     $info = array();
     $info = array('name' => $name, 'station_id' => $station_id, 'region_id' => $region_id, 'brief' => $this->input['brief'], 'company_id' => $company_id, 'address' => $this->input['address'], 'totalnum' => $totalnum, 'currentnum' => $currentnum, 'org_id' => $this->user['org_id'], 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'ip' => $this->user['ip'], 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'baidu_longitude' => $this->input['baidu_longitude'], 'baidu_latitude' => $this->input['baidu_latitude'], 'province' => intval($this->input['province']), 'city' => intval($this->input['city']), 'area' => intval($this->input['area']), 'type' => 1, 'state' => $this->get_status_setting('create'));
     //如果百度坐标存在的话,就转换为GPS坐标也存起来
     if ($info['baidu_latitude'] && $info['baidu_longitude']) {
         $gps = FromBaiduToGpsXY($info['baidu_longitude'], $info['baidu_latitude']);
         $info['stationx'] = $gps['GPS_x'];
         $info['stationy'] = $gps['GPS_y'];
     } else {
         $info['stationx'] = 0;
         $info['stationx'] = 0;
     }
     $id = $this->obj->create($info, 'station');
     //更新区域站点数目
     if ($id) {
         //更新区域站点数目
         $this->obj->update('station_num = station_num+1', 'region', "id={$region_id}");
         //更新运营单位站点数目
         $this->obj->update('station_count = station_count+1', 'company', "id={$company_id}");
         //更新排序id
         $this->obj->update("order_id = {$id}", 'station', "id={$id}");
         //更新素材表中素材内容id
         $img_id = $this->input['img_id'];
         if ($img_id) {
             if (!$this->input['indexpic_id']) {
                 $indexpic_id = $img_id[0];
             } else {
                 $indexpic_id = intval($this->input['indexpic_id']);
             }
             //更新索引图id
             $this->obj->update("material_id = {$indexpic_id}", 'station', "id={$id}");
             $img_id = implode(',', $img_id);
             $this->obj->update("cid = {$id}", 'material', "id IN ({$img_id})");
         }
     }
     //上传图片
     /*if($_FILES['Filedata'] && $id)
     		{	
     			$photos = array();
     			//检测图片服务器
     			if (!$this->settings['App_material'])
     			{
     				$this->errorOutput('图片服务器未安装!');
     			}
     			
     			//获取图片服务器上传配置
     			$PhotoConfig = $this->obj->getPhotoConfig();
     			if (!$PhotoConfig)
     			{
     				$this->errorOutput('获取允许上传的图片类型失败!');
     			}
     			
     			$count = count($_FILES['Filedata']['name']);
     			for($i = 0; $i <= $count; $i++)
     			{
     				if ($_FILES['Filedata']['name'][$i])
     				{
     					if ($_FILES['Filedata']['error'][$i]>0)
     					{
     						$this->errorOutput('图片上传异常');
     					}
     					if (!in_array($_FILES['Filedata']['type'][$i], $PhotoConfig['type']))
     					{
     						$this->errorOutput('只允许上传'.$PhotoConfig['hit'].'格式的图片');
     					}
     					if ($_FILES['Filedata']['size'][$i]>100000000)
     					{
     						$this->errorOutput('只允许上传100M以下的图片!');
     					}
     					foreach($_FILES['Filedata'] AS $k =>$v)
     					{
     						$photo['Filedata'][$k] = $_FILES['Filedata'][$k][$i];
     					}
     					$photos[] = $photo;
     				}			
     			}
     			if (!empty($photos))
     			{
     				//循环插入图片服务器
     				foreach ($photos as $val)
     				{
     					$PhotoInfor = $this->obj->uploadToPicServer($val, $id);
     					if (empty($PhotoInfor))
     					{
     						$this->errorOutput('图片服务器错误!');
     					}
     					$temp = array(
     						'cid'			=> $id,
     						'type'			=> $PhotoInfor['type'],						
     						'material_id'	=> $PhotoInfor['id'],
     						'host'			=> $PhotoInfor['host'],
     						'dir'			=> $PhotoInfor['dir'],
     						'filepath' 		=> $PhotoInfor['filepath'],
     						'filename'		=> $PhotoInfor['filename'],
     					);
     					//插入素材表
     					$PhotoId = $this->obj->insert_material($temp);
     					
     					//默认第一张图片为索引图
     					if(!$indexpic)
     					{
     						$indexpic = $this->obj->update_indexpic($PhotoId, $id);
     					}
     				}
     			}
     		}*/
     $info['id'] = $id;
     //添加日志
     $this->addLogs('创建自行车站点', '', $info, $info['name']);
     $this->addItem($info);
     $this->output();
 }
Пример #7
0
 public function show()
 {
     //判断有没有登陆
     if (!$this->user['user_id']) {
         $this->errorOutput(NO_LOGIN);
     }
     //判断到没到签到时间
     if (TIMENOW < strtotime(SIGN_STIME)) {
         $this->errorOutput(SIGN_NOT_START);
     }
     //判断是否过了签到时间
     if (TIMENOW > strtotime(SIGN_ETIME)) {
         $this->errorOutput(SIGN_HAVE_OVER);
     }
     //判断用户在不在会场附近
     if (defined('IS_VERIFY_GPS') && IS_VERIFY_GPS) {
         if (!$this->input['long_x'] || !$this->input['lat_y']) {
             $this->errorOutput(NO_X_Y);
         } else {
             $long_x = $this->input['long_x'];
             //经度
             $lat_y = $this->input['lat_y'];
             //纬度
             //如果是安卓设备传过来的话,传过来的是百度坐标,需要转换成GPS坐标
             if (defined('ISANDROID') && ISANDROID || $this->input['is_android']) {
                 $_GPS = FromBaiduToGpsXY($long_x, $lat_y);
                 if ($_GPS) {
                     $long_x = $_GPS['GPS_x'];
                     $lat_y = $_GPS['GPS_y'];
                 }
             }
             $_distance = GetDistance($lat_y, $long_x, $this->settings['meeting_pos']['y'], $this->settings['meeting_pos']['x']);
             if ($_distance > MEETING_DISTANCE) {
                 $this->errorOutput(YOU_NOT_NEARBY_MEETING);
             }
         }
     }
     //判断当前用户有没有激活
     $_memberInfo = $this->member_mode->detail('', " AND member_id = '" . $this->user['user_id'] . "' ");
     if (!$_memberInfo) {
         $this->errorOutput(YOU_HAVE_NOT_ACTIVATED);
     }
     $ret = array();
     //根据激活码id取出激活码类型
     $code = $this->activate->detail($_memberInfo['activate_code_id']);
     if ($code) {
         $ret['guest_type'] = $code['guest_type'];
     } else {
         $ret['guest_type'] = '1';
         //默认场外嘉宾
     }
     //判断当前用户是否已经签过到
     if ($_memberInfo['is_sign']) {
         //已经签到的场外嘉宾提示
         if ($ret['guest_type'] == '1') {
             $this->errorOutput(NOT_KNOW_IDENTY);
         } else {
             $this->errorOutput(YOU_HAVE_SIGNED);
         }
     }
     $this->addItem($ret);
     $this->output();
 }
Пример #8
0
 public function update()
 {
     if (!trim($this->input['name'])) {
         $this->errorOutput(NO_TITLE);
     }
     if (!intval($this->input['district_id'])) {
         $this->errorOutput('请选择区域划分!');
     }
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "carpark WHERE id = " . intval($this->input['id']);
     $cp = $this->db->query_first($sql);
     #####节点权限检测数据收集
     if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
         $_node_ids = '';
         if ($cp['district_id']) {
             $_node_ids = $cp['district_id'];
         }
         if ($this->input['district_id']) {
             $_node_ids = $_node_ids ? $_node_ids . ',' . $this->input['district_id'] : $this->input['district_id'];
         }
         if ($_node_ids) {
             $sql = 'SELECT id, parents FROM ' . DB_PREFIX . 'carpark_district WHERE id IN(' . $_node_ids . ')';
             $query = $this->db->query($sql);
             $nodes = array();
             while ($row = $this->db->fetch_array($query)) {
                 $nodes['nodes'][$row['id']] = $row['parents'];
             }
         }
     }
     #####节点权限
     $nodes['id'] = intval($this->input['id']);
     $nodes['user_id'] = $cp['user_id'];
     $nodes['org_id'] = $cp['org_id'];
     ###获取默认数据状态
     if (intval($cp['status']) == 2) {
         //停车场的审核状态为 123 默认的审核状态 012,所以需要转换一下
         $_status = $cp['status'] - 1;
         $status = $this->get_status_setting('update_audit', $_status);
         switch ($status) {
             case 0:
                 $status = 1;
                 break;
             case 1:
                 $status = 2;
                 break;
             case 2:
                 $status = 3;
                 break;
             default:
                 break;
         }
     }
     ######获取默认数据状态
     $this->verify_content_prms($nodes);
     ########权限#########
     $business_time = array();
     if ($this->input['date']) {
         $dateArr = $this->input['date'];
         $b_stime = $this->input['b_stime'];
         $b_etime = $this->input['b_etime'];
         foreach ($dateArr as $k => $v) {
             $business_time[] = array('date' => $v, 'stime' => $b_stime[$v], 'etime' => $b_etime[$v]);
         }
     }
     $parking_num = trim($this->input['parking_num']);
     $ret_num = $this->check_num_exist($parking_num, $this->input['id']);
     if ($ret_num) {
         $this->errorOutput('编号已存在!');
     }
     $main_data = array('name' => $this->input['name'], 'parking_num' => $parking_num, 'parking_space' => $this->input['parking_space'], 'empty_space' => $this->input['empty_space'], 'tel' => $this->input['tel'], 'status' => $status ? $status : $cp['status'], 'district_id' => $this->input['district_id'], 'type_id' => $this->input['type_id'], 'unit_id' => $this->input['unit_id'], 'icp_number' => $this->input['icp_number'], 'main_device' => $this->input['main_device'], 'description' => $this->input['description'], 'baidu_longitude' => $this->input['baidu_longitude'], 'baidu_latitude' => $this->input['baidu_latitude'], 'entrance_num' => $this->input['entrance_num'], 'exitus_num' => $this->input['exitus_num'], 'is_inout_same' => $this->input['is_inout_same'] ? 1 : 0, 'limited_height' => $this->input['limited_height'], 'building_storey' => $this->input['building_storey'], 'struct_type' => $this->input['struct_type'] && is_array($this->input['struct_type']) ? implode(',', $this->input['struct_type']) : '', 'other_struct_type' => $this->input['other_struct_type'], 'address' => $this->input['address'], 'province_id' => $this->input['province_id'], 'city_id' => $this->input['city_id'], 'area_id' => $this->input['area_id'], 'price_text' => $this->input['price_text'], 'price_brief' => $this->input['price_brief'], 'business_time' => $business_time ? serialize($business_time) : '', 'update_time' => TIMENOW, 'update_user_id' => $this->user['user_id'], 'update_user_name' => $this->user['user_name'], 'ip' => hg_getip());
     //同步公告type_id
     if ($main_data['type_id'] != $cp['type']) {
         $sql = "UPDATE " . DB_PREFIX . "announcement SET type_id = " . $main_data['type_id'] . " WHERE carpark_id = " . $this->input['id'];
         $this->db->query($sql);
     }
     //如果百度坐标存在的话,就转换为GPS坐标也存起来
     if ($main_data['baidu_latitude'] && $main_data['baidu_longitude']) {
         $gps = FromBaiduToGpsXY($main_data['baidu_longitude'], $main_data['baidu_latitude']);
         $main_data['GPS_x'] = $gps['GPS_x'];
         $main_data['GPS_y'] = $gps['GPS_y'];
     } else {
         $main_data['GPS_x'] = 0;
         $main_data['GPS_y'] = 0;
     }
     //此处处理服务时间
     $server_time = $this->input['server_time'];
     $server_time_data = array();
     if ($server_time && !empty($server_time)) {
         foreach ($server_time as $k => $v) {
             $server_time_data[] = array('server_type' => $v, 'start_time' => $this->input['start_time_' . $k], 'end_time' => $this->input['end_time_' . $k], 'start_date' => $this->input['start_date_' . $k] ? $this->input['start_date_' . $k] : '', 'end_date' => $this->input['end_date_' . $k] ? $this->input['end_date_' . $k] : '');
         }
     }
     //此处处理收费数据
     $fees = $this->input['fees'];
     $collect_fees = array();
     if ($fees && !empty($fees)) {
         foreach ($fees as $k => $v) {
             $collect_fees[] = array('fees_type' => $v, 'start_time' => $this->input['s_time'][$k] ? $this->input['s_time'][$k] : '', 'end_time' => $this->input['e_time'][$k] ? $this->input['e_time'][$k] : '', 'car_type' => $this->input['car_type_' . $k], 'price' => $this->input['price'][$k] ? $this->input['price'][$k] : '', 'charge_unit' => $this->input['charge_unit_' . $k] ? $this->input['charge_unit_' . $k] : '', 'instructions' => $this->input['instruction'][$k] ? $this->input['instruction'][$k] : '');
         }
     }
     //实景图片id
     $photo = $this->input['photo'];
     $ret = $this->mode->update($this->input['id'], $main_data, $server_time_data, $collect_fees, $photo);
     if ($ret) {
         $this->addLogs('更新停车场', $ret, $main_data, $main_data['name']);
         $this->addItem('success');
         $this->output();
     }
 }