break; case qyWechat::MSGTYPE_VIDEO: //视频消息 /*$voice=$weObj->getRev()->getRevVoice(); $weObj->image($voice['mediaid'])->reply();*/ break; case qyWechat::MSGTYPE_LOCATION: //地理位置消息 /*$location=$weObj->getRev()->getRevGeo(); $weObj->text('X:'.$location['x'].'Y:'.$location['y'].'label:'.$location['label'])->reply();*/ break; case qyWechat::MSGTYPE_EVENT: $data = $weObj->getRev()->getRevData(); //{"ToUserName":"******","FromUserName":"******","CreateTime":"1413865073","MsgType":"event","AgentID":"0","Event":"unsubscribe","EventKey":{} ///runlog('wxlog',json_encode($data)); if ($data['Event'] == 'unsubscribe') { DB::update('user', array('wechat_status' => 4), "wechat_userid='{$data[FromUserName]}'"); } elseif ($data['Event'] == 'subscribe') { DB::update('user', array('wechat_status' => 1), "wechat_userid='{$data[FromUserName]}'"); //发送关注成功消息 $weObj->text($_G['setting']['sitename'] . '欢迎您!,平台的消息和通知会及时的发送到此处')->reply(); } elseif ($data['Event'] == 'view') { // $weObj->text($data['url'])->reply(); } elseif ($data['Event'] == 'click') { // $weObj->text($data['EventKey'])->reply(); } break; default: /* $weObj->text("help info")->reply();*/ } exit;
$weObj->image($imageinfo['mediaid'])->reply();*/ break; case qyWechat::MSGTYPE_VOICE: //语音消息 /*$imageinfo=$weObj->getRev()->getRevPic(); $weObj->image($imageinfo['mediaid'])->reply();*/ break; case qyWechat::MSGTYPE_VIDEO: //视频消息 /*$voice=$weObj->getRev()->getRevVoice(); $weObj->image($voice['mediaid'])->reply();*/ break; case qyWechat::MSGTYPE_LOCATION: //地理位置消息 $location = $weObj->getRev()->getRevGeo(); $weObj->text('X:' . $location['x'] . 'Y:' . $location['y'] . 'label:' . $location['label'])->reply(); break; case qyWechat::MSGTYPE_EVENT: $data = $weObj->getRev()->getRevData(); //{"ToUserName":"******","FromUserName":"******","CreateTime":"1413865073","MsgType":"event","AgentID":"0","Event":"unsubscribe","EventKey":{} if ($data['Event'] == 'unsubscribe') { DB::update('user', array('wechat_status' => 4), "wechat_userid='{$data[FromUserName]}'"); } elseif ($data['Event'] == 'subscribe') { DB::update('user', array('wechat_status' => 1), "wechat_userid='{$data[FromUserName]}'"); //发送关注成功消息 $weObj->text($_G['setting']['sitename'] . '欢迎您!,平台的消息和通知会及时的发送到此处')->reply(); } elseif ($data['Event'] == 'view') { } break; default: /* $weObj->text("help info")->reply();*/
break; case qyWechat::MSGTYPE_LOCATION: //地理位置消息 /*$location=$weObj->getRev()->getRevGeo(); $weObj->text('X:'.$location['x'].'Y:'.$location['y'].'label:'.$location['label'])->reply();*/ break; case qyWechat::MSGTYPE_EVENT: $data = $weObj->getRev()->getRevData(); //{"ToUserName":"******","FromUserName":"******","CreateTime":"1413865073","MsgType":"event","AgentID":"0","Event":"unsubscribe","EventKey":{} ///runlog('wxlog',json_encode($data)); if ($data['Event'] == 'unsubscribe') { DB::update('user', array('wechat_status' => 4), "wechat_userid='{$data[FromUserName]}'"); } elseif ($data['Event'] == 'subscribe') { DB::update('user', array('wechat_status' => 1), "wechat_userid='{$data[FromUserName]}'"); //发送关注成功消息 $weObj->text($_G['setting']['sitename'] . '欢迎您!,平台的消息和通知会及时的发送到此处')->reply(); } elseif ($data['Event'] == 'view') { $weObj->text($data['url'])->reply(); } elseif ($data['Event'] == 'click') { $key = $data['EventKey']; switch ($key) { case 'latest': //最新新闻 if ($newsdata = getLatestData($wx, ltrim($data['FromUserName'], 'dzz-'))) { $weObj->news($newsdata)->reply(); } else { $weObj->text('还没有相关内容')->reply(); } break; } }