|
- <?php
- header('Content-Type:text/html; charset=utf-8');
- date_default_timezone_set('PRC');
- include('SVN/ZZWX/ZZDZ/config/Mysql.php');
- //$time = "2016-09-17 10:17:31";
-
- //echo substr($time,0,10),substr($time,11,5);;
- $pdo =conn();
- $sql = "SELECT * FROM `wechat_user` where id >2000";
- $result = $pdo->query($sql);
- $rowset = $result->fetchAll(PDO::FETCH_ASSOC);
-
-
- foreach ($rowset as $key => $value) {
- $result = httpRequest2('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx71d3ff8346a67836&secret=5a3640aa526c80a98bc8fa2ceba63416');
- $token = (array)json_decode($result);
- $token =$token['access_token'];
- $result = httpRequest2('https://api.weixin.qq.com/cgi-bin/user/info?access_token='.$token.'&openid='.$value['OPENID'].'&lang=zh_CN');
- $res = (array)json_decode($result);
- if(isset($res['subscribe']) && $res['subscribe']==1){
- $sql = "update wechat_user set CITY ='".$res['city']."', is_register =1,NICKNAME ='".$res['nickname']."',SEX =".$res['sex'].",COUNTRY ='".$res['country']."',PROVINCE ='".$res['province']."' where id =".$value['ID'];
- $result = $pdo->query($sql);
- echo $sql;
-
- }
-
- // var_dump($res);
-
- }
-
- die;
- // die;
- // function gen() {
- // $ret = (yield 'yield1');
- // var_dump($ret);
- // $ret = (yield 'yield2');
- // var_dump($ret);
- // }
-
- // $gen = gen();
- // var_dump($gen->current()); // string(6) "yield1"
- // var_dump($gen->send('ret1')); // string(4) "ret1" (the first var_dump in gen)
- // // string(6) "yield2" (the var_dump of the ->send() return value)
- // var_dump($gen->send('ret2')); // string(4) "ret2" (again from within gen)
- // // NULL (the return value of ->send())
-
-
- // die;
-
- // $mycustomer ='{,但复苏的,1,18663582623,150,,,0,,}';
- // $end_area_id = 6;
- // $end_time ='12:06';
- // $myprod ='{m449867p1|r597375}';
- // $start_area_id = 2;
- // $start_time ='08:28';
-
-
-
- $result = post2('xmwxc.zhizhuchuxing.cn/ZZDZ2/application/custom_made/control.php', array(
- 'type' => 'order_refund22',
- 'order_id'=>477982
-
- ));
-
-
- var_dump($result);
- die;
-
- function baiduShortTime($origins, $destinations)
- {
- $data = array('origins' => $origins, 'destinations' => $destinations, 'output' => 'json', 'tactics' => 11, 'ak' => commonUtils::$AK);
- //var_dump($data);exit();
- $res = commonUtils::send_get(commonUtils::$URL, $data);
- $shortTimeList = json_decode($res, true);
- if (isset($shortTimeList['status']) && $shortTimeList['status'] == 0) {
- foreach ($shortTimeList['result'] as $res) {
- if (count($shortTimeList['result']) > 1) {
- $time[] = ceil(($res['duration']['value']) / 60);
- } else {
- $time = ceil(($res['duration']['value']) / 60);
- }
-
- }
- return $time;
- } else {
- return false;
- }
- }
-
-
- echo baiduShortTime('31.9779550000,118.8036120000','32.0557350000,118.9010530000');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- die;
- $result = post2('http://sfx.zhizhuchuxing.com/zz-fx/Model/distribut/OrderDetail.php',array('order_id'=>'179314'));
- var_dump($result);
- die;
- $base_url = "http://api.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("沪B61353");
- $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);
- $a = printf("%.0f",$result_array["Data"][0]["id"]);
-
- $car_id = implode(',', $result_array["Data"][0]);
- var_dump($result_array);
-
- die;
- $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);
- echo $get_car_info_url;
- var_dump($result);
-
- function httpRequest2($url, $data = array(1)){//file_get_content
-
-
-
- $postdata = http_build_query(
-
- $data
-
- );
-
-
-
- $opts = array('http' =>
-
- array(
-
- 'method' => 'get',
-
- 'header' => 'Content-type: application/x-www-form-urlencoded',
-
- 'content' => $postdata
-
- )
-
- );
-
-
-
- $context = stream_context_create($opts);
-
-
- $result = file_get_contents($url, false, $context);
-
- return $result;
-
-
- }
-
- die;
-
-
- $myprod='{m449862p1|r577810}';
- $mycustomer='{,z,1,15139094100,150,,,0,,}';
- $ticket_id = substr($myprod, strpos($myprod, 'm') + 1, strpos($myprod, 'p') - 2);
- if($ticket_id== 449862 ||$ticket_id == 449867 ){
- if($ticket_id== 449862){//463597 464032 464413
- $result = post2('http://xmwxc.zhizhuchuxing.cn/ZZDZ/application/custom_made/control.php',array(
- 'type' =>'order_submitforout',
- 'prod_list'=>$myprod,
- 'customer_info'=>$mycustomer,
- 'start_name'=>'南京五塘广场',
- 'end_name'=>'南通政务中心',
- 'startx_y'=>'32.116818,118.784015',
- 'endx_y'=>'31.991326,120.892807',
- 'line_id'=>'449860',
- 'start_time'=>'07:37',
- 'end_time'=>'10:30'
-
-
- ));
- echo $result;die;
- }
- if($ticket_id== 449867){//464259 464331
- $result = post2('http://xmwxc.zhizhuchuxing.cn/ZZDZ/application/custom_made/control.php',array(
- 'type' =>'order_submitforout',
- 'prod_list'=>$myprod,
- 'customer_info'=>$mycustomer,
- 'start_name'=>'南通政务中心',
- 'end_name'=>'南京五塘广场',
- 'endx_y'=>'32.116818,118.784015',
- 'startx_y'=>'31.991326,120.892807',
- 'line_id'=>'449865',
- 'start_time'=>'07:37',
- 'end_time'=>'10:30'
-
-
- ));
- echo $result;die;
- }
- }
- function post2($url, $post_data = '', $timeout = 5){//curl
-
- $ch = curl_init();
-
- curl_setopt ($ch, CURLOPT_URL, $url);
-
- curl_setopt ($ch, CURLOPT_POST, 1);
-
- if($post_data != ''){
-
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
-
- }
-
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
-
- curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
-
- curl_setopt($ch, CURLOPT_HEADER, false);
-
- $file_contents = curl_exec($ch);
-
- curl_close($ch);
- return $file_contents;
-
- }
|