getRevGeo() публичный Метод

获取接收地理位置
public getRevGeo ( )
Пример #1
0
 public function endpoint()
 {
     import('ORG.Util.wechat');
     $weObj = new Wechat();
     $type = $weObj->getRev()->getRevType();
     switch ($type) {
         case Wechat::MSGTYPE_TEXT:
             $weObj->text($this->search_orgs($weObj->getRevContent()))->reply();
             exit;
             break;
         case Wechat::MSGTYPE_EVENT:
             break;
         case Wechat::MSGTYPE_IMAGE:
             break;
         case Wechat::MSGTYPE_LOCATION:
             $weObj->text($this->search_events($weObj->getRevGeo()))->reply();
             exit;
             break;
         default:
             $weObj->text("help info")->reply();
     }
 }
Пример #2
0
     $revEvent = array();
     $revEvent = $wechatObj->getRevEvent();
     switch ($revEvent['event']) {
         case "subscribe":
             $wechatObj->text("欢迎您关注福大人,我们会用心为您服务。\n目前您可以使用的功能有:\n我的图书馆:发送: ”我的图书馆“指令查看\n\n如果您闲来无聊,可以试试和福大人小机器人聊天哦。\n    福大人工作室" . "")->reply();
             break;
         case "unsubscribe":
             break;
     }
     break;
 case Wechat::MSGTYPE_IMAGE:
     $newsData = array(0 => array('Title' => '欢迎您关注福大人', 'Description' => "欢迎您关注福大人,我们会用心为您服务。\n\n    福大人工作室", 'PicUrl' => 'http://com/weixin//static/images/fzu.gif', 'Url' => 'http://r.com/weixin//info.html'));
     $wechatObj->news($newsData)->reply();
     break;
 case Wechat::MSGTYPE_LOCATION:
     $revGeo = $wechatObj->getRevGeo();
     if ($revGeo) {
         $wechatObj->text("您的位置信息是:X=" . $revGeo['x'] . ",Y=" . $revGeo['y'] . "\n" . $revGeo['label'])->reply();
     }
     break;
 case Wechat::MSGTYPE_VOICE:
     //多媒体消息关联获取id,并下载文件到服务器本地示例
     $oneMessage = $wechatObj->getOneMessage($wechatObj->getRevCtime(), $wechatObj->getRevType(), $wechatObj->getRevFrom());
     $mediaFile = array();
     if ($oneMessage) {
         $mediaFile = $wechatObj->getDownloadFile($oneMessage["id"]);
     }
     // 		$wechatObj->text(serialize($mediaFile))->reply();
     $wechatObj->text($oneMessage ? "消息id:{$oneMessage['id']}\n类型:{$oneMessage['type']}\nLO时间戳:" . $wechatObj->getRevCtime() . "\nMP时间戳:{$oneMessage['dateTime']}\n文件路径:{$mediaFile['filename']}\n文件大小:{$mediaFile['filesize']}\n文件类型:{$mediaFile['filetype']}" : "获取失败\nLO时间戳:" . $wechatObj->getRevCtime() . print_r($oneMessage, TRUE))->reply();
     break;
 default:
Пример #3
0
                     break;
             }
             break;
         default:
             break;
     }
     break;
 case Wechat::MSGTYPE_IMAGE:
     break;
 case Wechat::MSGTYPE_LOCATION:
     //根据用户地理位置x,y坐标返回用户最近的站点的车辆状态信息
     $getStationListUrl = $apiUrl . "/getStationList." . $apiSuffix;
     $stationList = json_decode(http_get($getStationListUrl));
     $stationListInfo = $stationList->info;
     if ($stationList->status == "0") {
         $userGeo = $w->getRevGeo();
         $y1 = $userGeo['y'];
         $x1 = $userGeo['x'];
         foreach ($stationListInfo as $k => $v) {
             $distance[$k] = distance_calculate($y1, $x1, $v->y, $v->x);
         }
         foreach ($distance as $key => $val) {
             if ($val == min($distance)) {
                 $val = number_format($val, 2, '.', '');
                 $tips = "您好,距离您最近的自行车站点是:" . $stationListInfo[$key]->name . ",距离您" . $val . "公里,目前还有" . $stationListInfo[$key]->number . "辆空闲车辆。";
                 $w->text($tips)->reply();
             }
         }
     } else {
         $w->text($systemError)->reply();
     }