<?php //$mypath = $_SERVER['DOCUMENT_ROOT'] . '/wechat'; //include_once $mypath . '/includes/magicquotes.inc.php'; //include_once $mypath . '/includes/db.inc.php'; //include_once $mypath . '/includes/helpers.inc.php'; //include_once $mypath . '/class/wechat.php'; include_once $mypath . '/contrller/serveManager.php'; wxlog('include wechatWall ok'); $userInf = getUnionId($msg['from'], $msg['me']); $userName = $userInf['nickname']; $userIcon = $userInf['headimgurl']; $sex = $userInf['sex']; $url = 'insert into wechat_wall_tbl set user_name="' . $userName . '",sex="' . $sex . '",user_icon="' . $userIcon . '",content=:content,img_url=:imgUrl,upload_time=:uploadTime'; if ($msg['type'] == 'text') { pdoInsert('wechat_wall_tbl', array('owner' => $msg['me'], 'user_name' => $userName, 'sex' => $sex, 'user_icon' => $userIcon, 'content' => $msg['content'], 'upload_time' => time())); } if ($msg['type'] == 'image') { pdoInsert('wechat_wall_tbl', array('owner' => $msg['me'], 'user_name' => $userName, 'sex' => $sex, 'user_icon' => $userIcon, 'img_url' => $msg['PicUrl'], 'upload_time' => time())); } $echoMsg = $weixin->prepareTextMsg($msg['from'], $msg['me'], '收到了'); echo $echoMsg; exit;
if (isset($_GET['linkKf'])) { include_once $GLOBALS['mypath'] . '/wechat/serveManager.php'; $respon = sendKFMessage($_SESSION['customerId'], '您好' . $_SESSION['userInf']['nickname'] . ',有什么可以帮助你?'); header('location:index.php?rand=' . $_SESSION['rand']); exit; } } //以下功能不需登录,不需判断$_SESSION['customerId'] if (isset($_GET['oauth'])) { include_once $GLOBALS['mypath'] . '/wechat/serveManager.php'; if ($_GET['code']) { // mylog('getCode'); $userId = getOauthToken($_GET['code']); // mylog('getOpenId'.$userId['openid']); $_SESSION['customerId'] = $userId['openid']; $_SESSION['userInf'] = getUnionId($userId['openid']); } else { mylog('cannot get Code'); } $rand = rand(1000, 9999); $_SESSION['rand'] = $rand; header('location:index.php?rand=' . $rand); if (isset($_SESSION['userInf'])) { foreach ($_SESSION['userInf'] as $k => $v) { if ('subscribe_time' == $k) { $v = date('Y-m-d H:i:s', $v); } $data[$k] = addslashes($v); } $re = pdoInsert('custom_inf_tbl', $data, 'update'); // mylog($re);