query("select FUNC_GET_UNIQUE_ID('1','1') id"); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $pdo=NULL; return $rowset[0]['id']; } function getUserId(){ if (isset($_COOKIE['xm_data'])){ $xm_data=$_COOKIE['xm_data']; $data=unserialize($xm_data); $id=$data['id']; $user=$data['user']; $checkToken=$data['token']; $list=$data['list']; $token=makeSign(array($id,$user,serialize($list))); if ($checkToken == $token){ return $id; }else{ return false; } }else{ return false; } } function httpRequest($url,$data=null){ $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); if (!empty($data)){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output=curl_exec($ch); curl_close($ch); return $output; } //function sendTelMessage($phones,$user_name,$content,$order_id){ // if (SEND_MESSAGE ==true){ // //$url='http://www.mxtong.net.cn/GateWay/Services.asmx/DirectSend?UserID=995596&Account=alert&Password=zzcx8888&Phones='.$phones.'&Content='.$content.'【蜘蛛行】&SendTime=&SendType=1&PostFixNumber='; // $url='http://hprpt2.eucp.b2m.cn:8080/sdkproxy/sendsms.action?cdkey=8SDK-EMY-6699-RISUM&password=175348&phone='.$phones.'&message=【蜘蛛行】'.$content; // $response=httpRequest($url); // writeLog('url'.$url."返回值".$response); // }else{ // return array("未开启短信通知"); // } // return $response; //} function sendTelMessage($phones,$user_name,$content,$order_id){ $send_data = array(); $send_data["cdkey"] = "8SDK-EMY-6699-RISUM"; $send_data["password"] = "175348"; $send_data["phone"] = $phones; $send_data["message"] = '【蜘蛛行】'.$content; if (SEND_MESSAGE ==true){ //$url='http://www.mxtong.net.cn/GateWay/Services.asmx/DirectSend?UserID=995596&Account=alert&Password=zzcx8888&Phones='.$phones.'&Content='.$content.'【蜘蛛行】&SendTime=&SendType=1&PostFixNumber='; $url='http://hprpt2.eucp.b2m.cn:8080/sdkproxy/sendsms.action'; //echo $url; $response=httpRequest($url,$send_data); // echo $response;die(); writeLog('url'.$url."返回值".$response); }else{ return array("未开启短信通知"); } return $response; } function getDispAreaNameForCtrip( $city_name ) { $suzhou_array = array("拙政园","观前街"); if( in_array($city_name, $suzhou_array) ) { return "苏州"; } if( mb_strlen($city_name) <= 2 ) { return $city_name;} $last_word = mb_substr($city_name,-1,1); $cut_word = array("市","区","镇"); if( in_array($last_word,$cut_word) ) { return mb_substr($city_name,0,mb_strlen($city_name)-1); } return $city_name; } function set_memcache( $key, $value ) { $mem = new Memcache; $mem->connect( MEMCACHE_HOST, MEMCACHE_PORT ); $mem->set( $key, $value, 0, 3600*24*7 ); } function get_memcache( $key ) { $mem = new Memcache; $mem->connect( MEMCACHE_HOST, MEMCACHE_PORT ); $value = $mem->get( $key ); return $value; } function clear_memcache() { $mem = new Memcache; $mem->connect( MEMCACHE_HOST, MEMCACHE_PORT ); $mem->flush(); } function get_position($imeis){ $unix_time = time(); $signature = md5(md5(API_GPS_PASSWORD).$unix_time); $url='http://api.gpsoo.net/1/auth/access_token?account='.API_GPS_ACCOUNT.'&time='.$unix_time.'&signature='.$signature; $html = file_get_contents($url); $return_array = json_decode($html,true); $access_token = $return_array["access_token"]; //获取经纬度等 $common_url = 'access_token='.$access_token.'&account='.API_GPS_ACCOUNT.'&time='.$unix_time; $url1 = 'http://api.gpsoo.net/1/devices/tracking?'.$common_url.'&map_type=BAIDU&target='.API_GPS_ACCOUNT.'&imeis='.$imeis; $html1 = file_get_contents($url1); $return_array1 = json_decode($html1,true); $j = $return_array1['data'][0]['lng']; $w = $return_array1['data'][0]['lat']; $speed =$return_array1['data'][0]['speed']; //convert_baidumap_to_tencentmap($w,$j); return array('j'=>$j,'w'=>$w,'speed'=>$speed); } //$test_time = date("Y-m-d H:i:s", 1924912800);echo $test_time."
"; //获取账户信息 function convert_baidumap_to_tencentmap( &$lat, &$lng ) { $x_pi = 3.14159265358979324 * 3000.0 / 180.0; $x = $lng - 0.0065; $y = $lat - 0.006; $z = sqrt(($x*$x+$y*$y)) - 0.00002 * sin($y * $x_pi); $theta = atan2($y,$x) - 0.000003 * cos($x * $x_pi); $lng = $z * cos($theta); $lat = $z * sin($theta); } function getposition($busno){ $base_url = "http://test.hstsp.cn:8077/data/"; $account_id = "hdgps"; $account_pwd = md5("123456"); $login_url = $base_url."login/tokenDuration.do?account={$account_id}&passwd={$account_pwd}"; $result = httpRequest( $login_url ); $result_array = json_decode($result,true); $token_str = $result_array["tokenStr"]; $check_car_no = urlencode($busno); $get_car_id_url = $base_url."LogisticalCar/queryCarId.do?tokenStr={$token_str}&plateCodes={$check_car_no}"; $result =httpRequest( $get_car_id_url ); $result_array = json_decode($result,true); $car_id =$result_array["Data"][0]["id"]; $get_car_info_url = $base_url."VehicleMonitor/queryMultiVehicleLocation.do?tokenStr={$token_str}&vehicleIds=". $car_id."&mapType=1"; $result = httpRequest( $get_car_info_url ); $result_array = json_decode($result,true); return $result_array; }