本文整理汇总了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();
}