本文整理匯總了PHP中Wechat::getRevGeo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wechat::getRevGeo方法的具體用法?PHP Wechat::getRevGeo怎麽用?PHP Wechat::getRevGeo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Wechat
的用法示例。
在下文中一共展示了Wechat::getRevGeo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: endpoint
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: array
$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: foreach
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();
}