getRevCtime() public méthode

获取消息发送时间
public getRevCtime ( )
Exemple #1
0
        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:
        $wechatObj->text("help info")->reply();
}
Exemple #2
0
$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") {
                            $lendtips = "尊敬的用户" . $userinfo->info->wechatName . ",您已借车,请在3分钟内点击下方的还车按钮进行还车" . $userlend->status;
                            $w->text($lendtips)->reply();
                        } else {
                            if ($userLend->status == "102") {