本文整理匯總了PHP中Wechat::getRevSceneId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wechat::getRevSceneId方法的具體用法?PHP Wechat::getRevSceneId怎麽用?PHP Wechat::getRevSceneId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Wechat
的用法示例。
在下文中一共展示了Wechat::getRevSceneId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
$options = array('token' => 'scubike', 'appid' => 'YOUR_APPID', 'appsecret' => 'YOUR_APPSECRET');
$systemError = "係統錯誤,請稍後再試";
$apiUrl = "http://1.scubiketest.sinaapp.com";
$apiSuffix = "php";
$w = new Wechat($options);
$w->valid();
$type = $w->getRev()->getRevType();
switch ($type) {
case Wechat::MSGTYPE_TEXT:
$w->text("感謝您的留言,稍後回複您!")->reply();
break;
case Wechat::MSGTYPE_EVENT:
$result = $w->getRevEvent();
switch ($result['event']) {
case 'subscribe':
if ($w->getRevSceneId()) {
//0.將該掃描事件寫入數據庫,掃描時間,用戶id,
$postScanurl = $apiUrl . "/postScan." . $apiSuffix;
//寫入掃描時間的api @post
$param = array('wechatId' => $w->getRevFrom(), 'createAt' => $w->getRevCtime(), 'stationId' => $w->getRevSceneId(), 'status' => 0);
http_post($postScanurl, $param);
//1.檢查數據庫是否有該用戶
$getUserinfoUrl = $apiUrl . "/getUserinfo." . $apiSuffix . "?wechatId=" . $w->getRevFrom();
$userinfo = json_decode(http_get($getUserinfoUrl));
//2.如果有,查詢該用戶是否有借車行為
if ($userinfo->status == "0") {
//@get
$userLendUrl = $apiUrl . "/userLend." . $apiSuffix . "?userId=" . $userinfo->info->userId . "&lendStatus=0";
$userLend = json_decode(http_get($userLendUrl));
//3.如果2的結果是有,提示:XX請在3分鍾內點擊下方還車按鈕進行還車
if ($userLend->status == "0") {
示例2: switch
if ($userInfo['pic']) {
$weObj->text("成功修改證件照片!")->reply();
} else {
$weObj->text("成功錄入證件照片!\n再次提交即可修改")->reply();
}
}
$db->disconnect();
break;
case Wechat::MSGTYPE_TEXT:
$weObj->text("你好,歡迎來到imall 公益電商平台 和" . WX_TITLE . " 校園公共自行車服務!\n\n<a href='http://www.imall365.org'>點此開始imall公益電商之旅!</a>\n<a href='" . $authURI . "'>點此開始你的" . WX_TITLE . "!</a>")->reply();
break;
case Wechat::MSGTYPE_EVENT:
$e = $weObj->getRevEvent();
switch ($e['event']) {
case Wechat::EVENT_SUBSCRIBE:
$scan = $weObj->getRevSceneId();
if (ereg("^[0-9]+\$", $scan)) {
$weObj->text("歡迎新用戶來到imall 公益電商平台 和" . WX_TITLE . " 校園公共自行車服務!\n\n在借車前請先提交認證信息,等我們確認您的身份後即可享受校園公共自行車服務了~\n\n<a href='http://www.imall365.org'>點此開始imall公益電商之旅!</a>\n<a href='" . $authURI . "'>點此開始你的" . WX_TITLE . "!</a>")->reply();
} else {
if (substr($scan, 0, 5) == 'prizea') {
$redirectURI3 = urlencode("http://" . WX_URL . "/main.php?a=prize");
$authURI3 = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" . WX_APPID . "&redirect_uri=" . $redirectURI3 . "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
$weObj->text("歡迎新用戶來到imall 公益電商平台 和" . WX_TITLE . " 校園公共自行車服務!\n\n在借車前請先提交認證信息,等我們確認您的身份後即可享受校園公共自行車服務了~\n\n<a href='http://www.imall365.org'>點此開始imall公益電商之旅!</a>\n<a href='" . $authURI . "'>點此開始你的" . WX_TITLE . "!</a>\n\n" . "<a href='{$authURI3}'>點此抽獎~</a>")->reply();
} else {
$weObj->text("歡迎新用戶來到imall 公益電商平台 和" . WX_TITLE . " 校園公共自行車服務!\n\n在借車前請先提交認證信息,等我們確認您的身份後即可享受校園公共自行車服務了~\n\n<a href='http://www.imall365.org'>點此開始imall公益電商之旅!</a>\n<a href='" . $authURI . "'>點此開始你的" . WX_TITLE . "!</a>")->reply();
//$weObj->text ( "你好,歡迎來到imall 公益電商平台 和" . WX_TITLE . " 校園公共自行車服務!\n\n<a href='http://www.imall365.org'>點此開始imall公益電商之旅!</a>\n<a href='" . $authURI . "'>點此開始你的" . WX_TITLE . "!</a>" )->reply ();
}
}
break;
case Wechat::EVENT_SCAN:
$scan = $weObj->getRevSceneId();
示例3: foreach
//取消上網權限
$sql = "select * from " . WEIXIN_TABLE . "\n WHERE `fromUserName` = '{$fromUserName}'";
$res = $mysql::query($sql, 'all');
if (is_array($res) && count($res) > 0) {
//刪除數據
$sql = "DELETE FROM " . WEIXIN_TABLE . "\n WHERE `fromUserName` = '{$fromUserName}'";
$mysql::query($sql);
foreach ($res as $key => $value) {
UniFi::sendUnauthorization($value['Mac_ID']);
sleep(2);
}
}
} else {
if ($event == 'scan') {
$ticket = $weObj->getRevTicket();
$scene_id = $weObj->getRevSceneId();
$sql = "select * from " . WEIXIN_TABLE . " WHERE `scene_id` = '{$scene_id}'";
$res = $mysql::query($sql, 'all');
$Mac_ID = $res[0]['Mac_ID'];
$site = $res[0]['site'];
UniFi::set_site($site);
UniFi::sendAuthorization($Mac_ID, WIFI_EXPIRED_TIME);
$sql = "update " . WEIXIN_TABLE . "\n set `fromUserName` = '{$fromUserName}',\n `ticket` = 'authorized'\n where `scene_id` = '{$scene_id}'";
$mysql::query($sql);
sleep(2);
$weObj->text('Welcome to the Free WiFi')->reply();
}
}
}
break;
case Wechat::MSGTYPE_IMAGE: