Beispiel #1
0
/**
 * 得到全周的课程表
 * @return multitype:multitype:Ambigous <multitype:>
 */
function getkcb()
{
    $openid = $_GET['openid'];
    //星期
    $weekArr = array(1, 2, 3, 4, 5);
    //节次
    $sectionArr = array("一", "三", "五", "七", "九");
    /* 当前周 */
    $weeklyNow = date('W') - 36;
    //每一天的课程表数组
    $kcbArr1 = array();
    //全周的课程表数组
    $kcbArr = array();
    $class_mysqlObj = new Class_mysql();
    // 从星期一开始循环从数据库查询课表
    for ($i = 1; $i <= 5; $i++) {
        // 节次从一开始
        foreach ($sectionArr as $section) {
            $sql_state = "select course_name,teaching_building,teaching_number,course_teacher,startWeekly,endWeekly\n\t\t\tfrom tb_studentSyllabus\n\t\t\twhere openid='{$openid}'\n\t\t\tand week='{$i}'\n\t\t\tand section='{$section}'\n\t\t\tand startWeekly<={$weeklyNow}\n\t\t\tand endWeekly>={$weeklyNow}";
            // 查询结果
            $resultArr = $class_mysqlObj->query_array($sql_state);
            $kcbArr1[] = $resultArr[0];
        }
        $kcbArr[] = $kcbArr1;
        $kcbArr1 = null;
    }
    return $kcbArr;
}
Beispiel #2
0
function getLoginCookie($openid)
{
    //数据库操作
    require_once 'utils/Mysql.class.php';
    $class_mysqlObj = new Class_mysql();
    $sql_state = "select studentid,IdCard from tb_studentInfo where openid='{$openid}'";
    $studentInfoArr = $class_mysqlObj->query_array($sql_state);
    //取出数据库里的 学号与身份证号
    $studentid = $studentInfoArr[0]['studentid'];
    $IdCard = $studentInfoArr[0]['IdCard'];
    //创建临时文件
    $cookieFile = SAE_TMP_PATH . '/personInfo_cookie.txt';
    $IdCardNum = substr($IdCard, 11, 6);
    if (strlen($IdCard) == 15) {
        $IdCardNum = substr($IdCard, 9, 6);
    }
    $login_url = "http://my.hpu.edu.cn/userPasswordValidate.portal";
    $login = "******";
    $ch = curl_init($login_url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
    // 把返回来的cookie信息保存在文件中
    curl_exec($ch);
    curl_close($ch);
    //读取文件内容
    $personInfo_cookie = file_get_contents($cookieFile);
    $mmc = memcache_init();
    // 初始化缓存
    memcache_set($mmc, $openid . "personInfo_cookie", $personInfo_cookie, 0, 600);
    return $personInfo_cookie;
}
/**
 * 图书馆当前借阅情况
 * @param unknown $openid	微信openid
 * @return multitype:multitype:NULL unknown	返回一个二维数组
 */
function getBorrowNow($openid)
{
    require_once 'utils/Mysql.class.php';
    $class_mysqlObj = new Class_mysql();
    $sql_state = "select studentid,name from tb_studentInfo where openid='{$openid}'";
    $studentInfoArr = $class_mysqlObj->query_array($sql_state);
    $studentid = $studentInfoArr[0]['studentid'];
    $name = $studentInfoArr[0]['name'];
    $name = urlencode(mb_convert_encoding($name, 'gb2312', 'utf-8'));
    $ch = curl_init("http://218.196.244.90:8080/dz1.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $str = curl_exec($ch);
    curl_close($ch);
    $pattern = '#<input type=hidden name=tday1 value=\'(.*?)\'>#is';
    preg_match($pattern, $str, $out);
    $tday1 = $out[1];
    $login_url = "http://218.196.244.90:8080/dz.php";
    $login = "******";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $login_url);
    curl_setopt($ch, CURLOPT_REFERER, "http://218.196.244.90:8080/dz1.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
    $str = curl_exec($ch);
    curl_close($ch);
    $pattern = '#<input type=hidden name=tday1 value=\'(.*?)\'>#is';
    preg_match($pattern, $str, $out);
    $tday1 = $out[1];
    // echo $tday1;
    $login_url = "http://218.196.244.90:8080/dzff.php";
    $login = "******";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $login_url);
    curl_setopt($ch, CURLOPT_REFERER, "http://218.196.244.90:8080/dz.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
    $str = curl_exec($ch);
    curl_close($ch);
    // echo $str;
    $pattern = '#<form action=\'bkxj1.php\' method=\'post\' name=formxj>([\\w\\W]*?)</form>#is';
    preg_match_all($pattern, $str, $out, PREG_SET_ORDER);
    $str = $out[0][1];
    $pattern = '#<td>([\\w\\W]*?)</td>#is';
    preg_match_all($pattern, $str, $out, PREG_SET_ORDER);
    // var_dump($out);
    $resultArr = array();
    for ($i = 1; $i < count($out); $i += 10) {
        $returnTime = $out[6][1];
        $pattern = '#<font color=\'red\'>([\\w\\W]*?)</font>#is';
        preg_match($pattern, $returnTime, $a);
        $resultArr[] = array("bookName" => iconv('gbk', 'utf-8', $out[$i][1]), "bookPlace" => iconv('gbk', 'utf-8', $out[$i + 3][1]), "borrowTime" => iconv('gbk', 'utf-8', $out[$i + 4][1]), "returnTime" => iconv('gbk', 'utf-8', $a[1]), "number" => iconv('gbk', 'utf-8', $out[$i + 8][1]));
    }
    return $resultArr;
}
Beispiel #4
0
function queryCet46($openid, $id, $name)
{
    $name2 = urlencode(mb_convert_encoding($name, "gbk", "utf-8"));
    $postData = "id={$id}&name={$name2}";
    $url = "http://cet.99sushe.com/find";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    curl_setopt($ch, CURLOPT_REFERER, "http://cet.99sushe.com/");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $outdata = curl_exec($ch);
    curl_close($ch);
    if (substr_count($outdata, "404 Not Found")) {
        return $name . "同学!\n不要着急,成绩还没出来哦^_^";
    } else {
        $arr = explode(",", $outdata);
        $studentName = iconv("gbk", "utf-8", $arr[6]);
        //名字
        $listen = $arr[1];
        //听力
        $read = $arr[2];
        //阅读
        $write = $arr[3];
        //写作和翻译
        $sum = $arr[4];
        // 总分
        $str2 = $studentName . "同学四六级成绩如下:\n\n听力:" . $listen . "\n阅读:" . $read . "\n写作和翻译:" . $write . "\n\n总分为:" . $sum;
        //插入数据库操作
        $mysqlObj = new Class_mysql();
        $sqlStr = "select * from tb_cet46 where cet_num='{$id}'";
        $resultArr = $mysqlObj->query_array($sqlStr);
        if (!empty($resultArr)) {
            //有此学生,做数据更新操作
            $sqlStr2 = "update tb_cet46 set cet_num = '{$id}',listenScore = '{$listen}',readScore='{$read}',writeScore='{$write}',sumScore='{$sum}' where name='{$studentName}'";
            $mysqlObj->query($sqlStr2);
        } else {
            // 没有该学生,做数据插入操作
            $sqlStr3 = "insert into tb_cet46 values('{$openid}','{$name}','{$id}','{$listen}','{$read}','{$write}','{$sum}')";
            $mysqlObj->query($sqlStr3);
        }
        return $str2;
    }
}
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no,email=no" name="format-detection">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>

<title>后勤报修系统</title>

<?php 
require_once '../utils/Mysql.class.php';
$openid = $_GET['openid'];
$class_mysqlObj = new Class_mysql();
$sql_state = "select name,studentid,IdCard from tb_studentInfo where openid='{$openid}'";
$studentInfo = $class_mysqlObj->query_array($sql_state);
$name = $studentInfo[0]['name'];
$username = $studentInfo[0]['studentid'];
$password = $studentInfo[0]['IdCard'];
$password2 = substr($password, count($password) - 7);
?>
    
<script>
var username  = '******';
var password  = '******';
Beispiel #6
0
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no,email=no" name="format-detection">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<title>搭讪</title>
<?php 
$fromUserFakeid = $_GET['fromUserFakeid'];
$toUserFakeid = $_GET['toUserFakeid'];
require_once '../utils/Mysql.class.php';
$class_mysqlObj = new Class_mysql();
$sql_state1 = "select nick_name from tb_studentDaShan where fakeid='{$fromUserFakeid}'";
$fromNick_nameArr = $class_mysqlObj->query_array($sql_state1);
$fromNick_name = $fromNick_nameArr[0]['nick_name'];
$sql_state2 = "select nick_name,sex,place from tb_studentDaShan where fakeid='{$toUserFakeid}'";
$toUserInfoArr = $class_mysqlObj->query_array($sql_state2);
$toUserNick_name = $toUserInfoArr[0]['nick_name'];
$toUserSex = $toUserInfoArr[0]['sex'];
$toUserPlace = $toUserInfoArr[0]['place'];
?>
<script>
var fromUserFakeid  = '<?php 
echo $fromUserFakeid;
?>
';
var toUserFakeid  = '<?php 
echo $toUserFakeid;
?>
Beispiel #7
0
 public function responseMsg()
 {
     $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
     if (!empty($postStr)) {
         libxml_disable_entity_loader(true);
         /**
          * 接收到的xml消息
          */
         $object = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
         $fromUsername = $object->FromUserName;
         // $toUsername = $object->ToUserName;
         /**
          * 接收到的关键字
          */
         $keyword = trim($object->Content);
         /**
          * 接收到的消息类型 (text,image,voice,video,location,link,event)
          */
         $msgType = $object->MsgType;
         /**
          * 包含消息回复工具类
          */
         require_once 'utils/Reply.class.php';
         $replyObj = new Reply();
         /**
          * 初始化缓存
          */
         $mmc = memcache_init();
         /**
          * 数据库操作类
          */
         require_once 'utils/Mysql.class.php';
         $class_mysqlObj = new Class_mysql();
         /**
          * 校花校草类
          */
         require_once 'topStudent/getTopInfo.php';
         /**
          * 图书馆相关类
          */
         require_once 'lib/libInfoAction.php';
         require_once 'lib/time.php';
         require_once 'lib/renewBook.php';
         require_once 'lib/queryBook.php';
         /**
          * 得到学生的姓名
          */
         $sql_state = "select name from tb_studentinfo where openid='{$fromUsername}'";
         $studentInfoArr = $class_mysqlObj->query_array($sql_state);
         $studentName = $studentInfoArr[0]['name'];
         /**
          * 更新最后交互时间
          */
         $lastTime = time();
         $sql_state1 = "select * from tb_studentdashan where openid='{$fromUsername}'";
         $fakeid2openid = $class_mysqlObj->query_array($sql_state1);
         if (!empty($fakeid2openid)) {
             $sql_state = "update tb_studentdashan set lastTime = '{$lastTime}' where openid='{$fromUsername}'";
             $class_mysqlObj->query($sql_state);
         }
         switch ($msgType) {
             case 'text':
                 // 是查看是否有聊天的缓存
                 $memcacheLt = memcache_get($mmc, $fromUsername . "lt");
                 // ============================================= 改动
                 if ($memcacheLt == "wlt") {
                     /* 进入聊天模块 */
                     if ($keyword == "886") {
                         $content = "拜拜[再见]\n-------\n☞已退出聊天模式,欢迎使用其它功能[跳跳]";
                         memcache_delete($mmc, $fromUsername . "lt");
                         // 删除缓存
                     } else {
                         $ltUrl = "http://api.mrtimo.com/Simsimi.ashx?parm={$keyword}";
                         $content = file_get_contents($ltUrl);
                         $content = $content . "\n\n☞聊天模式☞退出发送【886】";
                     }
                 } else {
                     if (substr($keyword, 0, strlen("绑定地点")) == "绑定地点") {
                         $keywordArr = explode(",", $keyword);
                         $userPlace = $keywordArr[1];
                         memcache_set($mmc, $fromUsername . "userPlace", $userPlace);
                         // 把用户所在地加入用户所在地缓存
                         $content = "所在地绑定成功,请再次点击【今日天气】";
                     } else {
                         if (preg_match('/课表,[1-7]/', $keyword)) {
                             /**
                              * 判断用户是否已经认证
                              */
                             // $mmc_Openid = memcache_get ( $mmc, $fromUsername . "zjh" );
                             if (empty($studentName)) {
                                 $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                             } else {
                                 $keywordArr = explode(",", $keyword);
                                 /* 要查询的星期 */
                                 $week = $keywordArr[1];
                                 /* 当前周 */
                                 $weeklyNow = date('W') - 36;
                                 if ($week == 6) {
                                     $content = "星期六,全天没课哦 \n🚶听说学霸都会点这里\n<a href=\"http://ifreeweixin.sinaapp.com/kongJs/kongjs.php\">📚空闲教室</a>\n\n👑听说学神都会点这里\n<a href=\"http://m.wsq.qq.com/264077463\">📚来点我呀</a>";
                                 } else {
                                     if ($week == 7) {
                                         $content = "星期日,全天没课哦 \n🚶听说学霸都会点这里\n<a href=\"http://ifreeweixin.sinaapp.com/kongJs/kongjs.php\">📚空闲教室</a>\n\n👑听说学神都会点这里\n<a href=\"http://m.wsq.qq.com/264077463\">📚来点我呀</a>";
                                     } else {
                                         $content = array();
                                         $weekNumArr = array(1 => "一", 2 => "二", 3 => "三", 4 => "四", 5 => "五");
                                         $content[] = array("Title" => "星期{$weekNumArr[$week]}课表如下:👇(📅第{$weeklyNow}周)", "Description" => "", "PicUrl" => "", "Url" => "ifreeweixin.sinaapp.com/kcbView/kcbView.php?openid={$fromUsername}");
                                         // 节次数组
                                         $sectionArr = array("一", "三", "五", "七", "九");
                                         foreach ($sectionArr as $key => $section) {
                                             // 几节到几节
                                             $sectionTo1 = $key * 2 + 1;
                                             $sectionTo2 = $key * 2 + 2;
                                             $sql_state = "select course_name,teaching_building,teaching_number,course_teacher,startWeekly,endWeekly from tb_studentsyllabus where openid='{$fromUsername}' and week='{$week}' and section='{$section}' and startWeekly<={$weeklyNow} and endWeekly>={$weeklyNow}";
                                             // 查询结果
                                             $resultArr = $class_mysqlObj->query_array($sql_state);
                                             if ($resultArr == null) {
                                                 $content[] = array("Title" => "{$sectionTo1}-{$sectionTo2} 节:\n👻没有课哦\n📢点击可查看空闲教室哦", "Description" => "", "PicUrl" => "", "Url" => "http://ifreeweixin.sinaapp.com/kongJs/kongjs.php");
                                             } else {
                                                 $course_name = $resultArr[0]['course_name'];
                                                 // 课程名
                                                 $teaching_building = $resultArr[0]['teaching_building'];
                                                 // 教学楼
                                                 $teaching_number = $resultArr[0]['teaching_number'];
                                                 // 教室
                                                 $course_teacher = $resultArr[0]['course_teacher'];
                                                 // 老师
                                                 $startWeekly = $resultArr[0]['startWeekly'];
                                                 // 开始周
                                                 $endWeekly = $resultArr[0]['endWeekly'];
                                                 // 结束周
                                                 if (!empty($resultArr[1]['course_name'])) {
                                                     $course_name2 = $resultArr[1]['course_name'];
                                                     // 课程名
                                                     $teaching_building2 = $resultArr[1]['teaching_building'];
                                                     // 教学楼
                                                     $teaching_number2 = $resultArr[1]['teaching_number'];
                                                     // 教室
                                                     $course_teacher2 = $resultArr[1]['course_teacher'];
                                                     // 老师
                                                     $startWeekly2 = $resultArr[1]['startWeekly'];
                                                     // 开始周
                                                     $endWeekly2 = $resultArr[1]['endWeekly'];
                                                     // 结束周
                                                     $title2 = "\n--------\n" . $course_name2 . "\n📍" . $teaching_building2 . $teaching_number2 . "\n🕘" . $course_teacher2 . "({$startWeekly2}-{$endWeekly2} 周上)";
                                                 }
                                                 $title = "{$sectionTo1}-{$sectionTo2} 节:\n" . $course_name . "\n📍" . $teaching_building . $teaching_number . "\n🕘" . $course_teacher . "({$startWeekly}-{$endWeekly} 周上)" . $title2;
                                                 $content[] = array("Title" => "{$title}", "Description" => "", "PicUrl" => "", "Url" => "ifreeweixin.sinaapp.com/kcbView/kcbView.php?openid={$fromUsername}");
                                             }
                                             $title2 = "";
                                         }
                                         $content[] = array("Title" => "💬回复课表+数字可以查看任意星期的课表哦,如【课表,1】\n㊙点击可以查看全周课表", "Description" => "", "PicUrl" => "", "Url" => "ifreeweixin.sinaapp.com/kcbView/kcbView.php?openid={$fromUsername}");
                                         echo $replyObj->transmitNews($object, $content);
                                         return;
                                     }
                                 }
                             }
                         } else {
                             if ($keyword == "朗读") {
                                 $json_string = file_get_contents('http://apix.sinaapp.com/daily/?appkey=ifreeweixin&type=listening');
                                 // 读取文件
                                 $obj = json_decode($json_string);
                                 $title = "每日英语朗读";
                                 $description = "听不懂,点击【每日英语】查看";
                                 $musicUrl = $obj->MusicUrl;
                                 $content = array("Title" => "{$title}", "Description" => "{$description}", "MusicUrl" => "{$musicUrl}", "HQMusicUrl" => "{$musicUrl}");
                                 echo $replyObj->transmitMusic($object, $content);
                                 return;
                             } else {
                                 if (substr_count($keyword, '成绩')) {
                                     /**
                                      * 判断用户是否已经认证
                                      */
                                     // $mmc_Openid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                     if (empty($studentName)) {
                                         // 成绩未认证转到认证页面
                                         $scoreUrl = "http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}";
                                         // 体育未认证转到认证页面
                                         $peUrl = "http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}";
                                     } else {
                                         // 已经认证转到成绩页面
                                         $scoreUrl = "http://ifreeweixin.sinaapp.com/scoreView/scoreResultView.php?openid={$fromUsername}";
                                         // 已经认证转到体育达标页面
                                         $peUrl = "http://ifreeweixin.sinaapp.com/peQuery/peView.php?openid={$fromUsername}";
                                     }
                                     $content = array();
                                     $content[] = array("Title" => "💯期末成绩", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyfiajHev0mE4QXic2vbOEJgcDIc1TJthkprMzZk3hqZPjppWibgNz7Zd1w/0", "Url" => $scoreUrl);
                                     $content[] = array("Title" => "💯四六级成绩", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyChU8rZ7t9TjgXymc2hicWkCdDW16ZtV7M9PiahpA9RYP5dxQ6QAfvwNQ/0", "Url" => "http://ifreeweixin.sinaapp.com/cet46/cet46View.php?openid={$fromUsername}");
                                     $content[] = array("Title" => "💯体育达标测试", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyEuZqXftqDwDzWtnicTNGkYWFHwyewTVE9tJygxaE4RtDMq9lk2jH0xA/0", "Url" => $peUrl);
                                     $content[] = array("Title" => "💯普通话水平测试", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlysmt4Xicn26zEUjIpVKV32roUcDJvjvLjq7m11vTEA88QjCyLAwYan5w/0", "Url" => "");
                                     $content[] = array("Title" => "💯全国计算机等级考试", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyz59ib3tXt3d8WfpLjNUJ8wAASaqcr9T8sMaDsctEYQVIjVYS9arhSicA/0", "Url" => "");
                                     echo $replyObj->transmitNews($object, $content);
                                     return;
                                 } else {
                                     if (preg_match("/重绑密码,[A-Za-z0-9]+/", $keyword)) {
                                         $keywordArr = explode(",", $keyword);
                                         $userPassword = $keywordArr[1];
                                         $sql_state = "update tb_studentinfo set password = '******'where openid='{$fromUsername}'";
                                         if ($class_mysqlObj->query($sql_state) && memcache_set($mmc, $fromUsername . "password", $userPassword)) {
                                             $content = "重绑密码成功[跳跳],为了你的密码安全请删除上条信息后继续你的操作";
                                         } else {
                                             $content = "重绑密码失败,请查看回复格式是否正确\n\n例子:\n重绑密码,123456";
                                         }
                                     } else {
                                         if ($keyword == "男神") {
                                             $resultArr = memcache_get($mmc, "topxiaocao");
                                             if (empty($resultArr)) {
                                                 $resultArr = getTopXiaocao();
                                             }
                                             $content = array();
                                             $content[] = array("Title" => "理工男神!点击可为他投票哦", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicStTQ0mMDVfW9395ElfDl2Pjk7cRwhniahMIcibSAX1hPECFiaRaUWFnLsAIrRWgmKficqaCAM6z5yGGA/0?wx_fmt=jpeg", "Url" => "http://www.facejoking.com/top/18601/1");
                                             for ($i = 0; $i < count($resultArr); $i++) {
                                                 $a = $i + 1;
                                                 $content[] = array("Title" => "Top{$a} " . $resultArr[$i]['title'], "Description" => "", "PicUrl" => $resultArr[$i]['picUrl'], "Url" => $resultArr[$i]['url']);
                                             }
                                             echo $replyObj->transmitNews($object, $content);
                                             return;
                                             //$content = '对方网站维护中……暂时无法查询';
                                         } else {
                                             if ($keyword == "女神") {
                                                 $resultArr = memcache_get($mmc, "topxiaohua");
                                                 if (empty($resultArr)) {
                                                     $resultArr = getTopXiaohua();
                                                 }
                                                 $content = array();
                                                 $content[] = array("Title" => "理工女神!点击可为她投票哦", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicStTQ0mMDVfW9395ElfDl2PReFXQUTd9HyB6c1FR8y700yxvJEO7dJsd0O1gZCBTicaD4hOstzt3Sg/0?wx_fmt=jpeg", "Url" => "http://www.facejoking.com/top/18601/0");
                                                 for ($i = 0; $i < count($resultArr); $i++) {
                                                     $a = $i + 1;
                                                     $content[] = array("Title" => "Top{$a} " . $resultArr[$i]['title'], "Description" => "", "PicUrl" => $resultArr[$i]['picUrl'], "Url" => $resultArr[$i]['url']);
                                                 }
                                                 echo $replyObj->transmitNews($object, $content);
                                                 return;
                                                 //$content = '对方网站维护中……暂时无法查询';
                                             } else {
                                                 if ($keyword == "当前借阅") {
                                                     /**
                                                      * 判断用户是否已经认证
                                                      */
                                                     // $studentid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                                     if (empty($studentName)) {
                                                         $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                                     } else {
                                                         // 得到当前借阅信息
                                                         $borrowNowArr = getBorrowNow($fromUsername);
                                                         if (!empty($borrowNowArr)) {
                                                             // 获取当前借阅为几本
                                                             $bookSum = count($borrowNowArr);
                                                             // 超期图书数目
                                                             $bookOutNum = 0;
                                                             $content = array();
                                                             foreach ($borrowNowArr as $bookInfo) {
                                                                 $returnTime = $bookInfo['returnTime'];
                                                                 $days = getTime($returnTime);
                                                                 if ($days < 0) {
                                                                     $bookOutNum++;
                                                                 }
                                                             }
                                                             $content[] = array("Title" => "{$studentName}同学,你当前借阅情况如下:\n数目:{$bookSum}本\t已超期:{$bookOutNum}本\n👻可以点击书名续借哦", "Description" => "", "PicUrl" => "", "Url" => "");
                                                             foreach ($borrowNowArr as $key => $bookInfo) {
                                                                 $numStr = $key + 1;
                                                                 $title = $numStr . "." . $bookInfo['bookName'] . "\n地点:" . $bookInfo['bookPlace'] . "\n借阅日期:" . $bookInfo['borrowTime'] . "\n应还日期:" . $bookInfo['returnTime'] . "\n续借次数:" . $bookInfo['number'];
                                                                 if ($bookInfo['number'] == 0) {
                                                                     $url = "http://ifreeweixin.sinaapp.com/lib/newsRenewView.php?openid={$fromUsername}&&numStr={$numStr}";
                                                                 } else {
                                                                     $url = "http://ifreeweixin.sinaapp.com/lib/error.php";
                                                                 }
                                                                 $content[] = array("Title" => $title, "Description" => "", "PicUrl" => "", "Url" => $url);
                                                             }
                                                             echo $replyObj->transmitNews($object, $content);
                                                             return;
                                                         } else {
                                                             $content = "亲,你目前还没有借任何书哦\n\n如果查询结果不对\n👉<a href=\"http://lib.hpu.edu.cn/\">可以点这里哦</a>";
                                                         }
                                                     }
                                                 } else {
                                                     if (substr_count($keyword, '续借')) {
                                                         $bookNumStr = substr($keyword, strlen("续借"), strlen($keyword) - strlen("续借"));
                                                         if (!empty($bookNumStr)) {
                                                             $bookNumArr = explode(",", $bookNumStr);
                                                             $content = renewBook($openid, $bookNumArr);
                                                         } else {
                                                             $content = "输入格式不对\n\n例子1:续借1\n续借第一本书\n\n例子2:续借1,3\n续借第一本和第三本书";
                                                         }
                                                     } else {
                                                         if (substr_count($keyword, '检索')) {
                                                             $bookName = substr($keyword, strlen("检索"), strlen($keyword) - strlen("检索"));
                                                             $bookInfoArr = queryBook($bookName);
                                                             $content = array();
                                                             $content[] = array("Title" => "🏢理工图书馆检索结果如下", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSRfX5wib5PVk5Yotnq3UIJUNdSBYG2EmMbYibgKs2Eop3A7H2PiaUFiblfZLD4lADCwQTgico4Pp27UibA/0?wx_fmt=jpeg", "Url" => "");
                                                             foreach ($bookInfoArr as $key => $bookInfo) {
                                                                 $num = $key + 1;
                                                                 $title = iconv('gbk', 'utf-8', $num . "." . $bookInfo[0]) . "\n🔍" . iconv('gbk', 'utf-8', $bookInfo[1]) . "\n📍地点:" . iconv('gbk', 'utf-8', $bookInfo[2]) . "\n🔔" . iconv('gbk', 'utf-8', $bookInfo[3]);
                                                                 $content[] = array("Title" => $title, "Description" => "", "PicUrl" => "", "Url" => "");
                                                             }
                                                             echo $replyObj->transmitNews($object, $content);
                                                             return;
                                                         } else {
                                                             if ($keyword == "饭卡余额") {
                                                                 /**
                                                                  * 判断用户是否已经认证
                                                                  */
                                                                 // $studentid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                                                 if (empty($studentName)) {
                                                                     $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                                                 } else {
                                                                     require_once 'personInfo/getEcard.php';
                                                                     $infoArr = getEcard($fromUsername);
                                                                     // 赛课作业数量
                                                                     $saiKeNum = $infoArr[0];
                                                                     // 借书数量
                                                                     $bookNum = $infoArr[1];
                                                                     // 超期图书数量
                                                                     $outBookNum = $infoArr[2];
                                                                     // 饭卡余额
                                                                     $eCardMoney = $infoArr[3];
                                                                     $content = "{$studentName}同学,你的饭卡余额为:{$eCardMoney}元";
                                                                     $content .= "\n\n【温馨提示】\n<a href=\"http://ifreeweixin.sinaapp.com/personInfo/saikeView.php?openid={$fromUsername}\">赛课作业</a>:{$saiKeNum}项\n图书借阅:{$bookNum}本,超期{$outBookNum}本";
                                                                     $content .= "\n\n【查询更多】\n回复:最新公告\n查看学校最新公告\n\n回复:校内招聘\n查看校内招聘信息\n\n回复:校外招聘\n查看校外招聘信息\n\n回复:学术讲座\n查看近期讲座安排";
                                                                     $content .= "\n\n<a href=\"http://hao.uc.cn/bst#!/index/\">点我查询生活百事</a>\n包括快递、公交等常用查询";
                                                                 }
                                                                 break;
                                                             } else {
                                                                 if ($keyword == "最新公告") {
                                                                     // 查看缓存中是否已有最新公告的缓存
                                                                     $newInfoArr = memcache_get($mmc, 'newInfoArr');
                                                                     if (empty($newInfoArr)) {
                                                                         /**
                                                                          * 判断用户是否已经认证
                                                                          */
                                                                         // $studentid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                                                         if (empty($studentName)) {
                                                                             $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                                                         } else {
                                                                             require_once 'personInfo/getNewInfo.php';
                                                                             $newInfoArr = getNewInfo($fromUsername);
                                                                         }
                                                                     }
                                                                     $content = array();
                                                                     $content[] = array("Title" => "🏢理工最新公告", "Description" => "", "PicUrl" => "http://mmsns.qpic.cn/mmsns/EKniaJHUPHicROc3WBNbaiac4DrrLNYGnMb665BJvdxrZsUlEpcP0hhTg/0", "Url" => "");
                                                                     foreach ($newInfoArr as $newInfo) {
                                                                         $title = $newInfo['title'] . "\n" . "发布时间:" . $newInfo['time'];
                                                                         $url = $newInfo['url'];
                                                                         $content[] = array("Title" => $title, "Description" => "", "PicUrl" => "", "Url" => $url);
                                                                     }
                                                                     echo $replyObj->transmitNews($object, $content);
                                                                     return;
                                                                 } else {
                                                                     if ($keyword == "校内招聘") {
                                                                         // 查看缓存中是否已有校内招聘的缓存
                                                                         $schoolZhaoArr = memcache_get($mmc, 'schoolZhaoArr');
                                                                         if (empty($schoolZhaoArr)) {
                                                                             /**
                                                                              * 判断用户是否已经认证
                                                                              */
                                                                             // $studentid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                                                             if (empty($studentName)) {
                                                                                 $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                                                             } else {
                                                                                 require_once 'personInfo/getSchoolZhao.php';
                                                                                 $schoolZhaoArr = getSchoolZhao($fromUsername);
                                                                             }
                                                                         }
                                                                         $content = array();
                                                                         $content[] = array("Title" => "🏢理工校内招聘", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicROc3WBNbaiac4DrrLNYGnMb8LM9Dgs0EicGiawpRnOABZzU6GE3zwORgJCf5RYc6GUpF5zDvOvzFBaw/0?wx_fmt=jpeg", "Url" => "");
                                                                         foreach ($schoolZhaoArr[0] as $schoolInZhaoArr) {
                                                                             $title = $schoolInZhaoArr[0] . "\n" . "发布时间:" . $schoolInZhaoArr[2];
                                                                             $url = $schoolInZhaoArr[1];
                                                                             $content[] = array("Title" => $title, "Description" => "", "PicUrl" => "", "Url" => $url);
                                                                         }
                                                                         echo $replyObj->transmitNews($object, $content);
                                                                         return;
                                                                     } else {
                                                                         if ($keyword == "校外招聘") {
                                                                             // 查看缓存中是否已有校外招聘的缓存
                                                                             $schoolZhaoArr = memcache_get($mmc, 'schoolZhaoArr');
                                                                             if (empty($schoolZhaoArr)) {
                                                                                 /**
                                                                                  * 判断用户是否已经认证
                                                                                  */
                                                                                 // $studentid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                                                                 if (empty($studentName)) {
                                                                                     $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                                                                 } else {
                                                                                     require_once 'personInfo/getSchoolZhao.php';
                                                                                     $schoolZhaoArr = getSchoolZhao($fromUsername);
                                                                                 }
                                                                             }
                                                                             $content = array();
                                                                             $content[] = array("Title" => "🏢理工校外招聘", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicROc3WBNbaiac4DrrLNYGnMb8LM9Dgs0EicGiawpRnOABZzU6GE3zwORgJCf5RYc6GUpF5zDvOvzFBaw/0?wx_fmt=jpeg", "Url" => "");
                                                                             foreach ($schoolZhaoArr[1] as $schoolOutZhaoArr) {
                                                                                 $title = $schoolOutZhaoArr[0] . "\n" . "发布时间:" . $schoolOutZhaoArr[2];
                                                                                 $url = $schoolOutZhaoArr[1];
                                                                                 $content[] = array("Title" => $title, "Description" => "", "PicUrl" => "", "Url" => $url);
                                                                             }
                                                                             echo $replyObj->transmitNews($object, $content);
                                                                             return;
                                                                         } else {
                                                                             if ($keyword == "学术讲座") {
                                                                                 // 查看缓存中是否已有学术讲座的缓存
                                                                                 $xueShuInfoArr = memcache_get($mmc, 'xueShuInfoArr');
                                                                                 if (empty($xueShuInfoArr)) {
                                                                                     /**
                                                                                      * 判断用户是否已经认证
                                                                                      */
                                                                                     // $studentid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                                                                     if (empty($studentName)) {
                                                                                         $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                                                                     } else {
                                                                                         require_once 'personInfo/getXueshu.php';
                                                                                         $xueShuInfoArr = getXueshu($fromUsername);
                                                                                     }
                                                                                 }
                                                                                 $content = array();
                                                                                 $content[] = array("Title" => "🏢理工学术讲座", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicROc3WBNbaiac4DrrLNYGnMb1rKnIW6V1pAXyfmvh7icKiaHc7QMXicQEBovCPfEUibVNYDbcqQUVzbymg/0?wx_fmt=jpeg", "Url" => "");
                                                                                 foreach ($xueShuInfoArr as $xueShuInfo) {
                                                                                     $title = "【题目】" . $xueShuInfo[0] . "\n【老师】" . $xueShuInfo[2] . "\n【时间】" . $xueShuInfo[3] . "\n【地点】" . $xueShuInfo[4];
                                                                                     $url = $xueShuInfo[1];
                                                                                     $content[] = array("Title" => $title, "Description" => "", "PicUrl" => "", "Url" => $url);
                                                                                 }
                                                                                 echo $replyObj->transmitNews($object, $content);
                                                                                 return;
                                                                             } else {
                                                                                 if ($keyword == "倒计时") {
                                                                                     $content = "开学倒计时,你猜还有多少天?<a href=\"http://ifreeweixin.sinaapp.com/daojishi/index.html\">点击进入</a>";
                                                                                 } else {
                                                                                     if ($keyword == "四六级") {
                                                                                         $content = "四六级成绩查询:\n\n";
                                                                                         $content .= "入口一:\n<a href=\"http://ifreeweixin.sinaapp.com/cet46/cet46View.php?openid={$fromUsername}\">知道准考证的点这里</a>\n\n";
                                                                                         $content .= "入口二:\n<a href=\"http://cet.forchange.cn/?aid=3qVhg4POSvtza3BTRjzzSwFb6zaihaBbqzaa\">忘记准考证的点这里</a>\n\n";
                                                                                     } else {
                                                                                         if ($keyword == "搭讪" || $keyword == "搭讪汉纸" || $keyword == "搭讪妹纸" || $keyword == "搭讪汉子" || $keyword == "搭讪妹子") {
                                                                                             $sql_state11 = "select fakeid from tb_studentdashan where openid='{$fromUsername}'";
                                                                                             $fromUserFakeidArr = $class_mysqlObj->query_array($sql_state11);
                                                                                             $fromUserFakeid = $fromUserFakeidArr[0]['fakeid'];
                                                                                             $nowTime = time();
                                                                                             // 取出现在的时间
                                                                                             if ($keyword == "搭讪") {
                                                                                                 $sql_state = "select fakeid,nick_name,place,sex,lastTime from tb_studentdashan where '{$nowTime}'-lastTime<172800 and openid is not null and fakeid !='{$fromUserFakeid}' order by lastTime desc";
                                                                                             } else {
                                                                                                 if ($keyword == "搭讪汉纸" || $keyword == "搭讪汉子") {
                                                                                                     $sql_state = "select fakeid,nick_name,place,sex,lastTime from tb_studentdashan where '{$nowTime}'-lastTime<172800 and openid is not null and fakeid !='{$fromUserFakeid}' and sex='汉纸' order by lastTime desc";
                                                                                                 } else {
                                                                                                     if ($keyword == "搭讪妹纸" || $keyword == "搭讪妹子") {
                                                                                                         $sql_state = "select fakeid,nick_name,place,sex,lastTime from tb_studentdashan where '{$nowTime}'-lastTime<172800 and openid is not null and fakeid !='{$fromUserFakeid}' and sex='妹纸' order by lastTime desc";
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                             $studentDaShanInfoArr = $class_mysqlObj->query_array($sql_state);
                                                                                             // 随机取出一位搭讪者
                                                                                             $daShanNum = rand(0, count($studentDaShanInfoArr) - 1);
                                                                                             $toFakeid = $studentDaShanInfoArr[$daShanNum]['fakeid'];
                                                                                             $nick_name = $studentDaShanInfoArr[$daShanNum]['nick_name'];
                                                                                             $place = $studentDaShanInfoArr[$daShanNum]['place'] != null ? "来自" . $studentDaShanInfoArr[$daShanNum]['place'] . "的" : "";
                                                                                             $sex = $studentDaShanInfoArr[$daShanNum]['sex'] == "汉纸" ? $studentDaShanInfoArr[$daShanNum]['sex'] . "👦" : "妹纸👧";
                                                                                             $lastTime = $studentDaShanInfoArr[$daShanNum]['lastTime'];
                                                                                             $lastTime = date("Y-m-d H:i:s", $lastTime);
                                                                                             $content = "成功匹配到" . $place . $nick_name . $sex . "\n\n";
                                                                                             $content .= "ta最后一次会话时间:\n" . $lastTime . "\n\n";
                                                                                             $content .= "<a href=\"http://ifreeweixin.sinaapp.com/daShan/index.php?toUserFakeid={$toFakeid}&fromUserFakeid={$fromUserFakeid}\">点击聊天</a>\n---------------\n";
                                                                                             $content .= "发送“@+你想说的话”迅速搭讪ta吧[色]\n---------------\n";
                                                                                             $content .= "[玫瑰]多与平台互动可以提高被搭讪的机率哦";
                                                                                             $content .= "<a href=\"loginView.php?openid={$fromUsername}&&flag=0\"> </a>";
                                                                                             // 提前发送消息
                                                                                             echo $replyObj->transmitText($object, $content);
                                                                                             // 设置搭讪对象缓存
                                                                                             memcache_set($mmc, $fromUsername . "dashan", $toFakeid);
                                                                                             // memcache_set ( $mmc, $fromUsername . "dashan", "1495366437",0,36000 );
                                                                                             // 睡1秒后执行绑定openid操作
                                                                                             sleep(2);
                                                                                             // 如果为空,绑定openid
                                                                                             if (empty($fromUserFakeidArr)) {
                                                                                                 require_once 'daShan/DaShan.class.php';
                                                                                                 $daShan = new DaShan();
                                                                                                 $fakeid2openidArr = $daShan->fakeid2openid();
                                                                                                 $fakeid = $fakeid2openidArr['fakeid'];
                                                                                                 $openid = $fakeid2openidArr['openid'];
                                                                                                 $lastTime2 = $fakeid2openidArr['lastTime'];
                                                                                                 $sql_state3 = "update tb_studentdashan set openid='{$openid}',lastTime='{$lastTime2}' where fakeid='{$fakeid}'";
                                                                                                 $class_mysqlObj->query($sql_state3);
                                                                                             }
                                                                                             return;
                                                                                         } else {
                                                                                             if (preg_match('/@((.*?))/', $keyword)) {
                                                                                                 // ============== 提高绑定效率 ====================
                                                                                                 $sql_state = "select fakeid,nick_name,place,sex from tb_studentdashan where openid='{$fromUsername}'";
                                                                                                 $fromUserInfoArr = $class_mysqlObj->query_array($sql_state);
                                                                                                 $fromUserFakeid = $fromUserInfoArr[0]['fakeid'];
                                                                                                 /*
                                                                                                  * 如果为空,绑定openid if (empty ( $fromFakeid )) { require_once 'daShan/DaShan.class.php'; $daShan = new DaShan (); $fakeid2openidArr = $daShan->fakeid2openid (); $fakeid = $fakeid2openidArr ['fakeid']; $openid = $fakeid2openidArr ['openid']; $lastTime2 = $fakeid2openidArr ['lastTime']; $sql_state3 = "update tb_studentDaShan set openid='{$openid}',lastTime='{$lastTime2}' where fakeid='{$fakeid}'"; $class_mysqlObj->query ( $sql_state3 ); }
                                                                                                  */
                                                                                                 // ================ 绑定结束 ========================
                                                                                                 // 消息发送给谁
                                                                                                 $toUserFakeid = memcache_get($mmc, $fromUsername . "dashan");
                                                                                                 if (empty($toUserFakeid)) {
                                                                                                     $content = "你还未匹配到搭讪对象,请回复【搭讪】进行匹配";
                                                                                                 } else {
                                                                                                     $keyword2 = str_replace("@", "", $keyword);
                                                                                                     if (!empty($fromUserFakeid)) {
                                                                                                         $fromNick_name = $fromUserInfoArr[0]['nick_name'];
                                                                                                         $fromPlace = $fromUserInfoArr[0]['place'] != null ? "来自" . $fromUserInfoArr[0]['place'] . "的" : "";
                                                                                                         $fromSex = $fromUserInfoArr[0]['sex'] == "汉纸" ? $fromUserInfoArr[0]['sex'] . "👦" : "妹纸👧";
                                                                                                         $daShan_content = $fromPlace . $fromNick_name . $fromSex . "向你发来消息:\n------------------\n\n" . $keyword2 . "\n\n";
                                                                                                         $daShan_content .= "<a href=\"http://ifreeweixin.sinaapp.com/daShan/index.php?toUserFakeid={$fromUserFakeid}&fromUserFakeid={$toUserFakeid}\">点此回复</a>\n------------------\n";
                                                                                                         $daShan_content .= "发送“@+你想说的话”可以快速回复ta哦[色]";
                                                                                                         require_once 'daShan/DaShan.class.php';
                                                                                                         $daShan = new DaShan();
                                                                                                         // 服务带传消息
                                                                                                         $flag = $daShan->singlesendpage($daShan_content, $toUserFakeid);
                                                                                                         // ========== 得到toOpenid 并帮他设置搭讪对象缓存 ================
                                                                                                         $sql_state2 = "select openid from tb_studentdashan where fakeid='{$toUserFakeid}'";
                                                                                                         $toOpenidArr = $class_mysqlObj->query_array($sql_state2);
                                                                                                         $toOpenid = $toOpenidArr[0]['openid'];
                                                                                                         memcache_set($mmc, $toOpenid . "dashan", $fromUserFakeid);
                                                                                                         $content = "消息发送成功,请耐心等待回复……";
                                                                                                     } else {
                                                                                                         $content = "搭讪对象被抢啦,请回复【搭讪】重新进行匹配……";
                                                                                                     }
                                                                                                 }
                                                                                             } else {
                                                                                                 if ($keyword == "绑定准考证") {
                                                                                                     $content = "妈妈再也不用担心忘记准考证号了\n\n请回复:\n绑定准考证,姓名,准考证号\n\n例子\n绑定准考证,小明,123456789\n\n中间逗号分隔哦";
                                                                                                 } else {
                                                                                                     if (substr_count($keyword, "绑定准考证")) {
                                                                                                         $a = explode(',', $keyword);
                                                                                                         if (count($a) == 3) {
                                                                                                             $name = $a[1];
                                                                                                             $cet_num = $a[2];
                                                                                                             $sql_str = "insert into tb_cet46(openid,name,cet_num) values('{$fromUsername}','{$name}','{$cet_num}')";
                                                                                                             if ($class_mysqlObj->query($sql_str)) {
                                                                                                                 $content = "已经成功备份你的准考证,如果以后忘记了,可以通过回复【准考证】进行查询";
                                                                                                             } else {
                                                                                                                 $content = "绑定失败,请重新回复……";
                                                                                                             }
                                                                                                         } else {
                                                                                                             $content = "回复文字的格式不对\n\n【例子】\n绑定准考证,肖何,413011151118329";
                                                                                                         }
                                                                                                     } else {
                                                                                                         if ($keyword == "准考证") {
                                                                                                             $sql_str = "select name,cet_num from tb_cet46 where openid='{$fromUsername}'";
                                                                                                             $cet46InfoArr = $class_mysqlObj->query_array($sql_str);
                                                                                                             $name = $cet46InfoArr[0]['name'];
                                                                                                             $cet_num = $cet46InfoArr[0]['cet_num'];
                                                                                                             if (!empty($cet_num)) {
                                                                                                                 $content = "查询结果如下:\n\n姓名:{$name}\n准考证号:{$cet_num}";
                                                                                                             } else {
                                                                                                                 $content = "查询结果为空……";
                                                                                                             }
                                                                                                         } else {
                                                                                                             if ($keyword == "报修") {
                                                                                                                 /**
                                                                                                                  * 判断用户是否已经认证
                                                                                                                  */
                                                                                                                 // $mmc_Openid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                                                                                                 if (empty($studentName)) {
                                                                                                                     $content = "首次使用需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                                                                                                 } else {
                                                                                                                     $content = array();
                                                                                                                     $content[] = array("Title" => "后勤报修系统", "Description" => "宿舍有什么坏了,都可以在这里报修哦,后勤会即时排人来帮你解决的哦", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRjURU8pMTODXmZXrMrZA4WNib8icc44PoicCiccvs9ib6anyMW1ZcibTq8UlnY7eBw4RKGqnHODw9pKrBg/0?wx_fmt=jpeg", "Url" => "http://ifreeweixin.sinaapp.com/baoxiu/baoxiu_index.php?openid=" . $fromUsername);
                                                                                                                 }
                                                                                                                 echo $replyObj->transmitNews($object, $content);
                                                                                                                 return;
                                                                                                             } else {
                                                                                                                 if ($keyword == "搭讪小编") {
                                                                                                                     $sql_state11 = "select fakeid from tb_studentdashan where openid='{$fromUsername}'";
                                                                                                                     $fromUserFakeidArr = $class_mysqlObj->query_array($sql_state11);
                                                                                                                     $fromUserFakeid = $fromUserFakeidArr[0]['fakeid'];
                                                                                                                     $content = "客官让您久等了,小编来啦!\n\n";
                                                                                                                     $content .= "<a href=\"http://ifreeweixin.sinaapp.com/daShan/index.php?toUserFakeid=2983555719&fromUserFakeid={$fromUserFakeid}\">点此聊天</a>";
                                                                                                                     $content .= "\n------------------\n吐槽、反馈以及使用过程中,遇到什么问题都来勾搭小编吧[愉快]";
                                                                                                                 } else {
                                                                                                                     if ($keyword == "导入课表") {
                                                                                                                         $content = "<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">快点我啊</a>[色]\n\n";
                                                                                                                     } else {
                                                                                                                         if ($keyword == '高考考生号') {
                                                                                                                             $sql_state1 = "select high_schoolId from tb_studentinfo where openid='{$fromUsername}'";
                                                                                                                             $arr = $class_mysqlObj->query_array($sql_state1);
                                                                                                                             $high_schoolId = $arr[0]['high_schoolId'];
                                                                                                                             $content = $studentName . "同学,你的高考考生号为:" . $high_schoolId;
                                                                                                                         } else {
                                                                                                                             $ltUrl = "http://www.tuling123.com/openapi/api?key=b45c5daa693dbf5f2a3d0a125a9c465c&info={$keyword}";
                                                                                                                             $jsonInfo = json_decode(file_get_contents($ltUrl), true);
                                                                                                                             $content = $jsonInfo['text'];
                                                                                                                             $content = str_replace("<br>", "\n", $content);
                                                                                                                             $content .= "\n\n☞由机器人智能回复,如果未能解决你的问题请点击人工客服";
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 break;
                 /* text结束 */
             /* text结束 */
             case 'image':
                 break;
             case 'voice':
                 break;
             case 'video':
                 break;
             case 'location':
                 break;
             case 'event':
                 /**
                  * 接收事件的类型,即接收的消息类型为event时
                  * (subscribe(订阅),unsubscribe(取消订阅),LOCATION,CLICK,VIEW)
                  */
                 $eventType = $object->Event;
                 switch ($eventType) {
                     case 'subscribe':
                         // 关注事件
                         $userNum = memcache_get($mmc, "userNum");
                         /* 如果缓存里为空,则设置他为第一位关注者 */
                         if (empty($userNum)) {
                             memcache_set($mmc, "userNum", 1);
                         }
                         $userNum = memcache_get($mmc, "userNum");
                         $content = '感谢关注ifree微信,你是第' . $userNum . '位关注者';
                         $content = $content . "\n\n为了更好的为你提供服务请<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">👉点我认证</a>\n";
                         memcache_set($mmc, "userNum", $userNum + 1);
                         echo $replyObj->transmitText($object, $content);
                         // ======= 搭讪信息获取并插入数据库 ============
                         sleep(5);
                         // 休息6秒执行
                         require_once 'daShan/DaShan.class.php';
                         $daShan = new DaShan();
                         $daShan->getUserFakeid(1);
                         return;
                         break;
                     case 'unsubscribe':
                         // 取消关注事件
                         /* 有人取消关注后把缓存里的人数减一 */
                         $userNum = memcache_get($mmc, "userNum");
                         if ($userNum > 0) {
                             memcache_set($mmc, "userNum", $userNum - 1);
                         }
                         // =========== 删除搭讪信息 =================
                         $sql_str = "delete from tb_studentdashan where openid='{$fromUsername}'";
                         $class_mysqlObj->query($sql_str);
                         break;
                     case 'LOCATION':
                         // 地址上报事件
                         break;
                     case 'CLICK':
                         // 自定义菜单点击事件
                         $eventKey = $object->EventKey;
                         switch ($eventKey) {
                             case "46ji":
                                 $content = "四六级成绩查询:\n\n";
                                 $content .= "入口一:\n<a href=\"http://ifreeweixin.sinaapp.com/cet46/cet46View.php?openid={$fromUsername}\">知道准考证的点这里</a>\n\n";
                                 $content .= "入口二:\n<a href=\"http://cet.forchange.cn/?aid=3qVhg4POSvtza3BTRjzzSwFb6zaihaBbqzaa\">忘记准考证的点这里</a>\n\n";
                                 break;
                             case "index":
                                 // 首页
                                 $content = array();
                                 $content[] = array("Title" => "走进ifree,走进微校园", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRocuIpHULp9UIb7jWcvfoMG0nV1v8V6k0xf3JNmTOruY9V7WpX2pmvUCmWRZcLJRc4rQKNvfP6Yw/0", "Url" => "http://ifreeweixin.sinaapp.com/index/index.php?openid={$fromUsername}");
                                 echo $replyObj->transmitNews($object, $content);
                                 return;
                                 break;
                             case "jrtq":
                                 // 今日天气
                                 /**
                                  * 判断用户是否已经绑定过天气地点
                                  */
                                 $userPlace = memcache_get($mmc, $fromUsername . "userPlace");
                                 if ($userPlace != null) {
                                     $geourl = "http://api.map.baidu.com/telematics/v3/weather?location={$userPlace}&output=xml&ak=F5bc9d028ff51b75ca54f1b10a5ca3be";
                                     $apiStr = file_get_contents($geourl);
                                     // 读取文件
                                     $apiObj = simplexml_load_string($apiStr);
                                     // Xml解析
                                     $addStr = $apiObj->results->currentCity;
                                     // 读取城市
                                     $todayObj = $apiObj->results->weather_data->date[0];
                                     // 读取日期
                                     $weatherObj = $apiObj->results->weather_data->weather[0];
                                     // 读取当天天气
                                     $windObj = $apiObj->results->weather_data->wind[0];
                                     // 读取当天风力
                                     $desObj = $apiObj->results->index->des[3];
                                     // 读取感冒建议
                                     $weather2Obj = $apiObj->results->weather_data->weather[0];
                                     // 读取明日天气
                                     $content = "今天{$todayObj}\n------------------\n{$addStr}今日天气:\n------------------\n{$weatherObj}\t{$windObj}\n{$desObj}\n------------------\n明天天气:{$weather2Obj}";
                                 } else {
                                     $content = "初次使用需要绑定地点,请输入:绑定地点+地点\n如发送:【绑定地点,焦作】\n\n注意:☞要先退出聊天模式";
                                 }
                                 break;
                             case "dashan":
                                 // 搭讪
                                 $content = "不搭讪,怎我们?\n\n【关键字】\n回复:搭讪\n回复:搭讪妹纸\n回复:搭讪汉纸\n回复:搭讪小编\n\n找寻我们[色]";
                                 break;
                             case "zkzh":
                                 // 绑定准考证
                                 $content = "妈妈再也不用担心忘记准考证号了\n\n请回复:\n绑定准考证,姓名,准考证号\n\n例子\n绑定准考证,小明,123456789\n\n中间逗号分隔哦";
                                 break;
                             case "ckkb":
                                 // 查看课表
                                 /**
                                  * 判断用户是否已经认证
                                  */
                                 // $mmc_Openid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                 if (empty($studentName)) {
                                     $content = "首次查询需要教务认证[愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                 } else {
                                     /* 当前周 */
                                     $weeklyNow = date('W') - 36;
                                     /* 星期 */
                                     $week = date('w');
                                     if ($week == 6) {
                                         $content = "星期六,全天没课哦 \n🚶听说学霸都会点这里\n<a href=\"http://ifreeweixin.sinaapp.com/kongJs/kongjs.php\">📚来点我呀</a>\n\n👑听说学神都会点这里\n<a href=\"http://m.wsq.qq.com/264077463\">📚来点我呀</a>";
                                     } else {
                                         if ($week == 0) {
                                             $content = "星期日,全天没课哦 \n🚶听说学霸都会点这里\n<a href=\"http://ifreeweixin.sinaapp.com/kongJs/kongjs.php\">📚空闲教室</a>\n\n👑听说学神都会点这里\n<a href=\"http://m.wsq.qq.com/264077463\">📚来点我呀</a>";
                                         } else {
                                             $content = array();
                                             $weekNumArr = array(1 => "一", 2 => "二", 3 => "三", 4 => "四", 5 => "五");
                                             $content[] = array("Title" => "星期{$weekNumArr[$week]}课表如下:👇(📅第{$weeklyNow}周)", "Description" => "", "PicUrl" => "", "Url" => "ifreeweixin.sinaapp.com/kcbView/kcbView.php?openid={$fromUsername}");
                                             // 节次数组
                                             $sectionArr = array("一", "三", "五", "七", "九");
                                             foreach ($sectionArr as $key => $section) {
                                                 // 几节到几节
                                                 $sectionTo1 = $key * 2 + 1;
                                                 $sectionTo2 = $key * 2 + 2;
                                                 $sql_state = "select course_name,teaching_building,teaching_number,course_teacher,startWeekly,endWeekly from tb_studentsyllabus where openid='{$fromUsername}' and week='{$week}' and section='{$section}' and startWeekly<={$weeklyNow} and endWeekly>={$weeklyNow}";
                                                 // 查询结果
                                                 $resultArr = $class_mysqlObj->query_array($sql_state);
                                                 if ($resultArr == null) {
                                                     $content[] = array("Title" => "{$sectionTo1}-{$sectionTo2} 节:\n👻没有课哦\n📢点击可查看空闲教室哦", "Description" => "", "PicUrl" => "", "Url" => "http://ifreeweixin.sinaapp.com/kongJs/kongjs.php");
                                                 } else {
                                                     $course_name = $resultArr[0]['course_name'];
                                                     // 课程名
                                                     $teaching_building = $resultArr[0]['teaching_building'];
                                                     // 教学楼
                                                     $teaching_number = $resultArr[0]['teaching_number'];
                                                     // 教室
                                                     $course_teacher = $resultArr[0]['course_teacher'];
                                                     // 老师
                                                     $startWeekly = $resultArr[0]['startWeekly'];
                                                     // 开始周
                                                     $endWeekly = $resultArr[0]['endWeekly'];
                                                     // 结束周
                                                     if (!empty($resultArr[1]['course_name'])) {
                                                         $course_name2 = $resultArr[1]['course_name'];
                                                         // 课程名
                                                         $teaching_building2 = $resultArr[1]['teaching_building'];
                                                         // 教学楼
                                                         $teaching_number2 = $resultArr[1]['teaching_number'];
                                                         // 教室
                                                         $course_teacher2 = $resultArr[1]['course_teacher'];
                                                         // 老师
                                                         $startWeekly2 = $resultArr[1]['startWeekly'];
                                                         // 开始周
                                                         $endWeekly2 = $resultArr[1]['endWeekly'];
                                                         // 结束周
                                                         $title2 = "\n--------\n" . $course_name2 . "\n📍" . $teaching_building2 . $teaching_number2 . "\n🕘" . $course_teacher2 . "({$startWeekly2}-{$endWeekly2} 周上)";
                                                     }
                                                     $title = "{$sectionTo1}-{$sectionTo2} 节:\n" . $course_name . "\n📍" . $teaching_building . $teaching_number . "\n🕘" . $course_teacher . "({$startWeekly}-{$endWeekly} 周上)" . $title2;
                                                     $content[] = array("Title" => "{$title}", "Description" => "", "PicUrl" => "", "Url" => "ifreeweixin.sinaapp.com/kcbView/kcbView.php?openid={$fromUsername}");
                                                 }
                                                 $title2 = "";
                                             }
                                             $content[] = array("Title" => "💬回复课表+数字可以查看任意星期的课表哦,如【课表,1】\n㊙点击可以查看全周课表", "Description" => "", "PicUrl" => "", "Url" => "ifreeweixin.sinaapp.com/kcbView/kcbView.php?openid={$fromUsername}");
                                             echo $replyObj->transmitNews($object, $content);
                                             return;
                                         }
                                     }
                                 }
                                 break;
                             case "cjcx":
                                 // 成绩查询(期末成绩、四六级成绩、体育达标测试、普通话水平测试、全国计算机等级考试)
                                 /**
                                  * 判断用户是否已经认证
                                  */
                                 // $mmc_Openid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                 if (empty($studentName)) {
                                     // 成绩未认证转到认证页面
                                     $scoreUrl = "http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}";
                                     // 体育未认证转到认证页面
                                     $peUrl = "http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}";
                                 } else {
                                     // 已经认证转到成绩页面
                                     $scoreUrl = "http://ifreeweixin.sinaapp.com/scoreView/scoreResultView.php?openid={$fromUsername}";
                                     // 已经认证转到体育达标页面
                                     $peUrl = "http://ifreeweixin.sinaapp.com/peQuery/peView.php?openid={$fromUsername}";
                                 }
                                 $content = array();
                                 $content[] = array("Title" => "💯期末成绩", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyfiajHev0mE4QXic2vbOEJgcDIc1TJthkprMzZk3hqZPjppWibgNz7Zd1w/0", "Url" => $scoreUrl);
                                 $content[] = array("Title" => "💯四六级成绩", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyChU8rZ7t9TjgXymc2hicWkCdDW16ZtV7M9PiahpA9RYP5dxQ6QAfvwNQ/0", "Url" => "http://ifreeweixin.sinaapp.com/cet46/cet46View.php?openid={$fromUsername}");
                                 $content[] = array("Title" => "💯体育达标测试", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyEuZqXftqDwDzWtnicTNGkYWFHwyewTVE9tJygxaE4RtDMq9lk2jH0xA/0", "Url" => $peUrl);
                                 $content[] = array("Title" => "💯普通话水平测试", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlysmt4Xicn26zEUjIpVKV32roUcDJvjvLjq7m11vTEA88QjCyLAwYan5w/0", "Url" => "");
                                 $content[] = array("Title" => "💯全国计算机等级考试", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRgibybsdwUO172PBkQtZzlyz59ib3tXt3d8WfpLjNUJ8wAASaqcr9T8sMaDsctEYQVIjVYS9arhSicA/0", "Url" => "");
                                 echo $replyObj->transmitNews($object, $content);
                                 return;
                                 break;
                             case "tsjs":
                                 // 图书检索
                                 $content = "突破外网限制,解决大家找书、续借难的问题\n\n回复:检索书名\n例子:检索红楼梦\n\n回复:当前借阅\n查看当前图书馆借阅情况\n\n回复:续借数字\n例子:续借1\n表示续借第一本书\n\n使用小技巧:\n1.回复当前借阅后,点击书的名字完成续借\n2.回复:续借1,2,3\n完成第一二三本书的续借,依次类推,注意以逗号分割哦\n\n提醒:超期的图书不能完成续借\n\n查询结果与实际不符\n👉<a href=\"http://lib.hpu.edu.cn/\">点这里哦</a>";
                                 break;
                             case "mryy":
                                 // 每日英语
                                 $json_mryy = file_get_contents('http://apix.sinaapp.com/daily/?appkey=ifreeweixin&type=translation');
                                 // 读取文件
                                 $newJson_mryy = trim($json_mryy, "[]");
                                 $mrryObj = json_decode($newJson_mryy);
                                 $title = "ifree微信【每日英语】";
                                 $description = $mrryObj->Description;
                                 $newDescription = $description . "\n-------------------\n*回复【朗读】获得句子语音,点击进入双语阅读";
                                 $picUrl = $mrryObj->PicUrl;
                                 $url = "http://xue.youdao.com/zx/archives/category/practical/article";
                                 $content = array();
                                 $content[] = array("Title" => "{$title}", "Description" => "{$newDescription}", "PicUrl" => "{$picUrl}", "Url" => "{$url}");
                                 echo $replyObj->transmitNews($object, $content);
                                 return;
                                 break;
                             case "fkye":
                                 // 饭卡余额
                                 /**
                                  * 判断用户是否已经认证
                                  */
                                 // $studentid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                 if (empty($studentName)) {
                                     $content = "首次查询需要教务认证哦![愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                 } else {
                                     require_once 'personInfo/getEcard.php';
                                     $infoArr = getEcard($fromUsername);
                                     // 赛课作业数量
                                     $saiKeNum = $infoArr[0];
                                     // 借书数量
                                     $bookNum = $infoArr[1];
                                     // 超期图书数量
                                     $outBookNum = $infoArr[2];
                                     // 饭卡余额
                                     $eCardMoney = $infoArr[3];
                                     $content = "{$studentName}同学,你的饭卡余额为:{$eCardMoney}元";
                                     $content .= "\n\n【温馨提示】\n<a href=\"http://ifreeweixin.sinaapp.com/personInfo/saikeView.php?openid={$fromUsername}\">赛课作业</a>:{$saiKeNum}项\n图书借阅:{$bookNum}本,超期{$outBookNum}本";
                                     $content .= "\n\n【查询更多】\n回复:最新公告\n查看学校最新公告\n\n回复:校内招聘\n查看校内招聘信息\n\n回复:校外招聘\n查看校外招聘信息\n\n回复:学术讲座\n查看近期讲座安排";
                                     $content .= "\n\n回复:报修\n再也不用去找阿姨说宿舍哪里坏啦[玫瑰]";
                                 }
                                 break;
                             case "wyly":
                                 $content = "不要着急哦,我要留意功能程序猿正在努力开发中……";
                                 break;
                             case "ylb":
                                 // 娱乐吧
                                 $content = array();
                                 // $content [] = array (
                                 // "Title" => "【表白墙】爱就大声说出来",
                                 // "Description" => "",
                                 // "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bEDaCtHBfqJcickbxBMUk12ctubxMEjz1gUw8uw1BiaRu3A4nyvUFXDUrVQ/0",
                                 // "Url" => "http://m.wsq.qq.com/264077463/v/25"
                                 // );
                                 // $content [] = array (
                                 // "Title" => "【许愿树】\n我想做一个安静的美男子",
                                 // "Description" => "",
                                 // "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bEDvQuCQhontqCddW570DKGj7DYLGgBD6cYlib4vMQlObcFicO7Sowa22sQ/0",
                                 // "Url" => "http://m.wsq.qq.com/264077463/v/26"
                                 // );
                                 // $content [] = array (
                                 // "Title" => "【微语录】\n放下执著奔向新生命",
                                 // "Description" => "",
                                 // "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bEDmIBQt101DdicALVE0KAiaqtYm1pCXRyRKHOAVQIvnctsiaF7mHW57srww/0",
                                 // "Url" => "http://m.wsq.qq.com/264077463/v/27"
                                 // );
                                 $content[] = array("Title" => "【小游戏】最强眼力", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bEDxPgaiclGYZYEcPE384xWSxicwSPBiclUQ3QzXLHdobpa0Vyz5fiafBmUfA/0", "Url" => "http://ifreeweixin.sinaapp.com/ifreegame/zuiqiangyanli/index.html");
                                 $content[] = array("Title" => "【小游戏】围住神精猫", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bED4ZZj0ibr9THtOIoiaXIx5TzX0sow7MelmZ3zXZoM6bzic7Z3sRWSQPibxA/0", "Url" => "http://ifreeweixin.sinaapp.com/ifreegame/shenjingmao/index.html");
                                 $content[] = array("Title" => "【小游戏】2048", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bEDdS51wd3ktIibTWqT37fsZ3Wibko5gLCsibJe9mxI1uAYu2rw7lKeneJNA/0", "Url" => "http://ifreeweixin.sinaapp.com/ifreegame/2048/index.html");
                                 echo $replyObj->transmitNews($object, $content);
                                 return;
                                 break;
                             case "nsns":
                                 $content = "回复  <a href=\"http://www.facejoking.com/top/18601/0/\">女神</a>\n查看理工女神排行榜\n\n回复  <a href=\"http://www.facejoking.com/top/18601/1/\">男神</a>\n查看理工男神排行榜\n\n点击Ta的头像可以评论或投票哦,赶快行动吧[色]";
                                 break;
                             case "wylt":
                                 // 我要聊天
                                 // 设置机器人聊天时长为10分钟
                                 // memcache_set ( $mmc, $fromUsername . "lt", "wylt", 0, 600 );
                                 $sql_state11 = "select fakeid from tb_studentdashan where openid='{$fromUsername}'";
                                 $fromUserFakeidArr = $class_mysqlObj->query_array($sql_state11);
                                 $fromUserFakeid = $fromUserFakeidArr[0]['fakeid'];
                                 $content = array();
                                 $content[] = array("Title" => "👦小编在线,时刻为你服务", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicTKqsC5EZpyzuicHZhrNCNYhePOwnWaWoQPrAvucjCib85hUalbDiaAibnJH5b8XPkrxhAoUJvX1GEATA/0?wx_fmt=jpeg", "Url" => "http://ifreeweixin.sinaapp.com/daShan/index.php?toUserFakeid=2983555719&fromUserFakeid={$fromUserFakeid}");
                                 $content[] = array("Title" => "【🙎人工客服】\n使用过程中遇到的问题或者有什么想问的都可以👇点这里", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bEDVv9sn46maficLJHibia6H0BcLssHxcXg5EVzH9pwPupgtp35v1jibUAMcQ/0", "Url" => "http://wpa.qq.com/msgrd?v=3&uin=1334506819&site=qq&menu=yes");
                                 $content[] = array("Title" => "【💞加入平台交流群】\n想知道本平台都有谁吗?男神?女神?萌妹子?👇点这里", "Description" => "", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicSGTe3UeGJYENpy8nmB6bEDOVjPvP1KsrdwGYXThjMGeEXLzwKkhsvLv4DaicWLSbzI4XV2cVek8HQ/0", "Url" => "http://jq.qq.com/?_wv=1027&k=bhNTRl");
                                 echo $replyObj->transmitNews($object, $content);
                                 return;
                                 break;
                             case "gdgn":
                                 // 更多功能
                                 $content = "👉点此进入<a href=\"http://ifreeweixin.sinaapp.com/index/index.php?openid={$fromUsername}\">首页</a>\n\n";
                                 $content .= "👉点此进入<a href=\"http://jiejing.qq.com/#pano=23081037131012133740100&heading=85&pitch=0&zoom=1&isappinstalled=-1&poi=0\">校园街景</a>\n\n";
                                 $content .= "👉点此进入<a href=\"http://m.weibo.cn/d/hpu1909?jumpfrom=weibocom\">理工微博</a>\n\n";
                                 $content .= "👉点此进入<a href=\"http://ifreeweixin.sinaapp.com/daojishi/index.html\">放假倒计时</a>\n\n";
                                 $content .= "👉点此进入<a href=\"http://hao.uc.cn/bst#!/index/\">生活百事通</a>\n\n";
                                 $content .= "👉点此进入<a href=\"http://www.play68.com/\">微信小游戏</a>\n\n";
                                 // $content .= "👉点此进入<a href=\"http://m.wsq.qq.com/264077463/v/29\">一起约跑吧</a>\n\n";
                                 $content .= "👉点此进入<a href=\"http://m.wsq.qq.com/app?sId=264077463&appId=wsq52871049344258\">每日逗比对话</a>\n\n";
                                 // $content .= "👉点此进入<a href=\"http://m.wsq.qq.com/264077463/v/22\">帮室友找对象</a>\n\n";
                                 // $content .= "👉点此进入<a href=\"http://m.wsq.qq.com/264077463/v/28\">英雄联盟交流</a>\n\n";
                                 $content .= "更多精彩,尽在ifree微信平台";
                                 break;
                             case 'drkb':
                                 //导入课表
                                 $content .= "<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">快点我啊</a>[色]\n\n";
                                 break;
                             case "wsbx":
                                 // 报修
                                 /**
                                  * 判断用户是否已经认证
                                  */
                                 // $mmc_Openid = memcache_get ( $mmc, $fromUsername . "zjh" );
                                 if (empty($studentName)) {
                                     $content = "首次使用需要教务认证 [愉快]<a href=\"http://218.196.240.171/weixinapi/index.php/Home/Jiaowu/loginview/openid/{$fromUsername}\">点我认证</a>";
                                 } else {
                                     $content = array();
                                     $content[] = array("Title" => "后勤报修系统", "Description" => "宿舍有什么坏了,都可以在这里报修哦,后勤会即时排人来帮你解决的哦", "PicUrl" => "https://mmbiz.qlogo.cn/mmbiz/EKniaJHUPHicRjURU8pMTODXmZXrMrZA4WNib8icc44PoicCiccvs9ib6anyMW1ZcibTq8UlnY7eBw4RKGqnHODw9pKrBg/0?wx_fmt=jpeg", "Url" => "http://ifreeweixin.sinaapp.com/baoxiu/baoxiu_index.php?openid=" . $fromUsername);
                                 }
                                 echo $replyObj->transmitNews($object, $content);
                                 return;
                                 break;
                         }
                         break;
                 }
                 break;
         }
         echo $replyObj->transmitText($object, $content);
     } else {
         echo "";
         exit;
     }
 }
<?php

require_once 'DaShan.class.php';
require_once '../utils/Mysql.class.php';
//接收参数
$content = $_POST['content'];
$fromUserFakeid = $_POST['fromUserFakeid'];
$toUserFakeid = $_POST['toUserFakeid'];
$daShan = new DaShan();
$class_mysqlObj = new Class_mysql();
$sql_state1 = "select openid,nick_name from tb_studentDaShan where fakeid='{$toUserFakeid}'";
$toOpenidArr = $class_mysqlObj->query_array($sql_state1);
$toNick_name = $toOpenidArr[0]['nick_name'];
$toOpenid = $toOpenidArr[0]['openid'];
$mmc = memcache_init();
//帮被搭讪对象设置缓存
memcache_set($mmc, $toOpenid . "dashan", $fromUserFakeid);
// ========== 拼接发送内容 ==================
$sql_state2 = "select nick_name,place,sex from tb_studentDaShan where fakeid='{$fromUserFakeid}'";
$fromUserInfoArr = $class_mysqlObj->query_array($sql_state2);
$fromNick_name = $fromUserInfoArr[0]['nick_name'];
$fromPlace = $fromUserInfoArr[0]['place'] != null ? "来自" . $fromUserInfoArr[0]['place'] . "的" : "";
$fromSex = $fromUserInfoArr[0]['sex'] == "汉纸" ? $fromUserInfoArr[0]['sex'] . "👦" : "妹纸👧";
$daShan_content = $fromPlace . $fromNick_name . $fromSex . "向你发来消息:\n------------------\n\n" . $content . "\n\n";
$daShan_content .= "<a href=\"http://ifreeweixin.sinaapp.com/daShan/index.php?toUserFakeid={$fromUserFakeid}&fromUserFakeid={$toUserFakeid}\">点此回复</a>\n------------------\n";
$daShan_content .= "发送“@+你想说的话”可以快速回复ta哦[色]";
//是否发送成功? true or false
$flag = $daShan->singlesendpage($daShan_content, $toUserFakeid);
if ($flag) {
    //向自己的平台发送消息
    $content3 = "你对" . $toNick_name . "说:\n------------------\n\n" . $content;
 function getUserFakeid($page)
 {
     $mmc = memcache_init();
     self::$cookie = memcache_get($mmc, "daShanLoginCookie");
     self::$token = memcache_get($mmc, "daShanLoginToken");
     if (empty(self::$cookie)) {
         $this->cookie();
     }
     $j = 1;
     for ($i = 0; $i <= $page; $i++) {
         $url = 'https://mp.weixin.qq.com/cgi-bin/contactmanage?t=user/index&pagesize=10&pageidx=' . $i . '&type=0&groupid=0&token=' . self::$token . '&lang=zh_CN';
         $header = array('Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Encoding:gzip,deflate', 'Accept-Language:zh-CN', 'Cache-Control:max-age=0', 'Connection:keep-alive', 'DNT:1', 'Host:mp.weixin.qq.com', 'User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0');
         $curl = curl_init();
         // 启动一个CURL会话
         curl_setopt($curl, CURLOPT_URL, $url);
         // 要访问的地址
         curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
         // 设置HTTP头字段的数组
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
         // 对认证证书来源的检查
         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
         // 从证书中检查SSL加密算法是否存在
         curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0');
         // 模拟用户使用的浏览器
         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
         // 使用自动跳转
         curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
         // 自动设置Referer
         curl_setopt($curl, CURLOPT_HTTPGET, 1);
         // 发送一个常规的GET请求
         curl_setopt($curl, CURLOPT_COOKIE, self::$cookie);
         // 读取上面所储存的Cookie信息
         curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
         curl_setopt($curl, CURLOPT_TIMEOUT, 30);
         // 设置超时限制防止死循环
         curl_setopt($curl, CURLOPT_HEADER, 0);
         // 显示返回的Header区域内容
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         // 获取的信息以文件流的形式返回
         $user = curl_exec($curl);
         $preg = "/\"id\":(\\d+),\"nick_name\":\"([^\"]*)\"/";
         preg_match_all($preg, $user, $a);
         for ($k = 0; $k < 10; $k++) {
             $fakeid = $a[1][$k];
             // fakeid
             $nick_name = $a[2][$k];
             // 昵称
             $userInfoArr = $this->getUserInfo($fakeid);
             $place = $userInfoArr['place'];
             // 所在地
             $sex = $userInfoArr['sex'];
             // 性别
             $userOpenidArr = $this->getUserOpenid($fakeid);
             $openid = $userOpenidArr['openid'];
             // openid
             $lastTime = $userOpenidArr['lastTime'];
             // 最后交互时间
             if (!empty($fakeid)) {
                 // 执行插入数据库操作
                 require_once 'utils/Mysql.class.php';
                 $class_mysqlObj = new Class_mysql();
                 // 先进行数据库查询操作,如果不存在做插入操作
                 $sql_state = "select * from tb_studentDaShan where fakeid='{$fakeid}'";
                 $studentDaShanInfo = $class_mysqlObj->query_array($sql_state);
                 if (empty($studentDaShanInfo)) {
                     $sql_state = "insert into tb_studentDaShan(openid,fakeid,nick_name,place,sex,flag,lastTime) values('{$openid}','{$fakeid}','{$nick_name}','{$place}','{$sex}','1','{$lastTime}')";
                     $class_mysqlObj->query($sql_state);
                 }
             }
         }
     }
 }
Beispiel #10
0
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<link rel="shortcut icon" type="image/x-icon" href="https://res.wx.qq.com/mpres/zh_CN/htmledition/comm_htmledition/images/icon/common/favicon.ico">
	<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<link rel="stylesheet" href="bangding.css">
	
	<title>四六级查询</title>
	</head>

<?php 
require_once '../utils/Mysql.class.php';
$openid = $_GET['openid'];
$mysqlObj = new Class_mysql();
$sqlStr = "select * from tb_cet46 where openid='{$openid}'";
$resultArr = $mysqlObj->query_array($sqlStr);
?>
<script type="text/javascript">
	var openid = '<?php 
echo $openid;
?>
';
	function CheckInfo(){
		if(document.formData.id.value==""){
			alert("请输入准考号");
			document.formData.id.focus();
			return;
		}
		if(document.formData.name.value==""){
			alert("请输入姓名");
			document.formData.name.focus();
Beispiel #11
0
function renewBook($openid, $numArr)
{
    require_once 'utils/Mysql.class.php';
    $class_mysqlObj = new Class_mysql();
    $sql_state = "select studentid,name from tb_studentInfo where openid='{$openid}'";
    $studentInfoArr = $class_mysqlObj->query_array($sql_state);
    $studentid = $studentInfoArr[0]['studentid'];
    $name = $studentInfoArr[0]['name'];
    $name = urlencode(mb_convert_encoding($name, 'gb2312', 'utf-8'));
    $ch = curl_init("http://218.196.244.90:8080/dz1.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $str = curl_exec($ch);
    curl_close($ch);
    $pattern = '#<input type=hidden name=tday1 value=\'(.*?)\'>#is';
    preg_match($pattern, $str, $out);
    $tday1 = $out[1];
    $login_url = "http://218.196.244.90:8080/dz.php";
    $login = "******";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $login_url);
    curl_setopt($ch, CURLOPT_REFERER, "http://218.196.244.90:8080/dz1.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
    $str = curl_exec($ch);
    curl_close($ch);
    $pattern = '#<input type=hidden name=tday1 value=\'(.*?)\'>#is';
    preg_match($pattern, $str, $out);
    $tday1 = $out[1];
    // echo $tday1;
    $login_url = "http://218.196.244.90:8080/dzff.php";
    $login = "******";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $login_url);
    curl_setopt($ch, CURLOPT_REFERER, "http://218.196.244.90:8080/dz.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
    $str = curl_exec($ch);
    curl_close($ch);
    // 	echo $str;
    $pattern = '#<input type=\'checkbox\' name=netxj\\[\\] value=\'(.*?)\'>#is';
    preg_match_all($pattern, $str, $out, PREG_SET_ORDER);
    //	var_dump($out) ;
    foreach ($numArr as $num) {
        $netxj = $out[$num - 1][1];
        $netxj = urlencode(mb_convert_encoding($out[$num - 1][1], 'gb2312', 'utf-8'));
        // 	echo $netxj;
        // 拼接提交参数
        $login = "******";
        $login_url = "http://218.196.244.90:8080/bkxj1.php";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $login_url);
        curl_setopt($ch, CURLOPT_REFERER, "http://218.196.244.90:8080/dzff.php");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
        $str = curl_exec($ch);
        curl_close($ch);
    }
    return "续借成功!🎉\n\n🙏提醒:可以再次回复 当前借阅 检查续借结果";
}
Beispiel #12
0
<?php

header("Content-Type:text/html;charset=utf-8");
require_once '../daShan/DaShan.class.php';
require_once '../utils/Mysql.class.php';
$class_mysqlObj = new Class_mysql();
$sql_state = "select fakeid from tb_studentDaShan";
$studentFakeidArr = $class_mysqlObj->query_array($sql_state);
$daShan = new DaShan();
$daShan->username = "******";
$daShan->password = "******";
$daShan->cookie();
for ($i = 0; $i < count($studentFakeidArr); $i++) {
    $tofakeid = $studentFakeidArr[$i]['fakeid'];
    $content = "一餐东门,免费抽奖活动,快去看看啊,键盘鼠标,水杯,情侣手链应有尽有~~~ \n\n首先在www.hpu2shou.com注册并完善个人资料,然后拿着自己的手机去一餐东门抽奖处拿手机给工作人员看你的ID记录就可以参加抽奖啦~~~~中奖概率很高哟~~~  先到先得~~~\n\n该网站是理工大二手市场,毕业季来临,二货都在这里哦";
    if ($daShan->singlesendpage($content, $tofakeid)) {
        echo "发送成功" . $i . "条<br>";
    } else {
        echo $i . "发送失败<br>";
    }
}
// 	$content = "一餐东门,免费抽奖活动,快去看看啊,键盘鼠标,水杯,情侣手链应有尽有~~~ \n\n首先在www.hpu2shou.com注册并完善个人资料,然后拿着自己的手机去一餐东门抽奖处拿手机给工作人员看你的ID记录就可以参加抽奖啦~~~~中奖概率很高哟~~~  先到先得~~~\n\n该网站是理工大二手市场,毕业季来临,二货都在这里哦";
// 	echo $daShan->singlesendpage($content, "2983555719");
Beispiel #13
0
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no,email=no" name="format-detection">
<link rel="stylesheet" type="text/css" href="style.css">

<title>体育达标测试成绩</title>
</head>
<?php 
require_once '../utils/Mysql.class.php';
require_once 'peAction.php';
$openid = $_GET['openid'];
$class_mysqlObj = new Class_mysql();
$sql_state = "select studentid,IdCard from tb_studentInfo where openid='{$openid}'";
$result = $class_mysqlObj->query_array($sql_state);
$txtAccount = $result[0]['studentid'];
//学号
$txtPassword = $result[0]['IdCard'];
$txtPassword = substr($txtPassword, strlen($txtPassword) - 8, 8);
//密码身份证后8位
$peScoreStr = getPeScore($txtAccount, $txtPassword);
$peScoreArr = explode(',', $peScoreStr);
//总分
$sumScoreArr = explode(':', $peScoreArr[11]);
$sumScore = $sumScoreArr[1];
//年度
$year = $peScoreArr[0];
//姓名
$name = $peScoreArr[2];
//学号
<!DOCTYPE html>

<?php 
require_once '../utils/Mysql.class.php';
$openid = $_GET['openid'];
$errStr = $_GET['errStr'];
$class_mysqlObj = new Class_mysql();
$sql_state = "select course_name,credit,score from tb_studentScore where openid='{$openid}'";
$scoreArr = $class_mysqlObj->query_array($sql_state);
//通过门数
$scoreNum = 0;
//已修学分
$creditNum = 0;
if (!empty($scoreArr)) {
    foreach ($scoreArr as $a) {
        if (!($a['score'] < 60 || $a['score'] == '不及格')) {
            $scoreNum++;
            $creditNum += $a['credit'];
        }
    }
}
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">  
<meta name="apple-mobile-web-app-status-bar-style" content="black">  
<meta content="telephone=no,email=no" name="format-detection">	
<link rel="stylesheet" type="text/css" href="style.css">