require dirname(__FILE__) . '/wechat.class.php'; $weixinconfig = $db->getRow("SELECT * FROM " . $GLOBALS['ecs']->table('weixin_config') . " WHERE `id` = 1"); //多微信帐号支持 $id = intval($_GET['id']); if ($id > 0) { $otherconfig = $db->getRow("SELECT * FROM " . $GLOBALS['ecs']->table('weixin_config') . " WHERE `id` = {$id}"); if ($otherconfig) { $weixinconfig['token'] = $otherconfig['token']; $weixinconfig['appid'] = $otherconfig['appid']; $weixinconfig['appsecret'] = $otherconfig['appsecret']; } } $baseurl = $weburl = $_SERVER['SERVER_NAME'] ? "http://" . $_SERVER['SERVER_NAME'] . "/" : "http://" . $_SERVER['HTTP_HOST'] . "/"; //$weburl .= $weixinconfig['wap_url'] ? $weixinconfig['wap_url'] : ""; $weixin = new core_lib_wechat($weixinconfig); $weixin->valid(); $api = new weixinapi(); $weburl .= $api->dir; $type = $weixin->getRev()->getRevType(); $wxid = $weixin->getRev()->getRevFrom(); //上报地理信息 $loc = $weixin->getRev()->getUserLocation(); if ($loc) { $api->updatelocation($wxid, $loc); } $reMsg = ""; switch ($type) { case 'text': $content = $weixin->getRev()->getRevContent(); break; case 'event':