Esempio n. 1
0
function reply_main($request, $w)
{
    $to = $request['ToUserName'];
    $from = $request['FromUserName'];
    // 大众接口
    if ($w->get_msg_type() == "location") {
        $lacation = "x@" . (string) $request['Location_X'] . "@" . (string) $request['Location_Y'];
        $lacation = urlencode(str_replace('\\.', '\\\\.', $lacation));
        $lacation = urldecode(xiaojo($lacation, $from, $to));
        return $lacation;
    } else {
        if ($w->get_msg_type() == "image") {
            $PicUrl = $request['PicUrl'];
            $w->set_funcflag();
            return "咦,我也有这张照片:" . $PicUrl;
        } else {
            if ($w->get_msg_type() == "voice") {
                return array("title" => "你好", "description" => "亲爱的主人", "murl" => "http://weixen-file.stor.sinaapp.com/b/xiaojo.mp3", "hqurl" => "http://weixen-file.stor.sinaapp.com/b/xiaojo.mp3");
            } else {
                if ($w->get_msg_type() == "event") {
                    // 关注
                    if ($w->get_event_type() == "subscribe") {
                        $welcome = WELCOME;
                        return $welcome;
                    } elseif ($w->get_event_type() == "unsubscribe") {
                        $unsub = urldecode(xiaojo("subscribe", $from, $to));
                        return $unsub;
                    } elseif ($w->get_event_type() == "click") {
                        $menukey = $w->get_event_key();
                        $menu = urldecode(xiaojo($menukey, $from, $to));
                        return $menu;
                    } else {
                        $menukey = $w->get_event_key();
                        return $menukey;
                    }
                }
            }
        }
    }
    /**
     *  $content:获取http的content字段
     *  $reply_content:返回处理结果
     */
    $content = trim($request['Content']);
    // 开户指南
    if (strstr($content, '开')) {
        $url = 'http://mp.weixin.qq.com/s?__biz=MjM5OTA1NzMyMg==&mid=201721356&idx=1&sn=2ab0f94f0514fc6d01b5addc76caf446&scene=4#wechat_redirect';
        $reply_content = '#title|开户@title|开户指南入口#url|' . $url . '#pic';
        // 多图文回复
        if (strstr($reply_content, 'pic')) {
            $reply_content = replypic($reply_content);
        }
        return $reply_content;
    }
    if ($content == '校历') {
        $reply_content = "#title|广药2014-2015第一学期校历@title|查看校历点此进入#url|http://mp.weixin.qq.com/s?__biz=MjM5OTA1NzMyMg==&mid=202787753&idx=1&sn=c37f9e9566bf0dcd016d685c12bc3baa#rd#pic";
        $reply_content = replypic($reply_content);
        return $reply_content;
    }
    //交通卡查询
    if (strstr($content, '交') || strstr($content, '羊') || $content == "6") {
        $arr = explode('#', $content);
        $ctype = $arr[1];
        $cno = $arr[2];
        if ($ctype == 'yct' && !empty($cno) && $cno != '') {
            return "请到羊城通官方公众号查询 谢谢!";
            $url = "http://av.jejeso.com/helper/api/transfer/get_yct.php?cardno={$cno}";
            return file_get_contents($url);
        } elseif ($ctype == 'szt' && !empty($cno) && $cno != '') {
            $url = "http://av.jejeso.com/helper/api/transfer/get_szt.php?cardno={$cno}";
            return file_get_contents($url);
        } else {
            return "小助手交通卡余额查询Beta\n\n发送:交通#yct#卡号\n即可查询羊城通余额\n\n发送:交通#szt#卡号\n即可查询深圳通余额^_^\n更多便利将陆续推出";
        }
    }
    //content处理
    if (!empty($content)) {
        $flag = "0";
        // 广药内网接口
        if ($content == "?" || $content == '?' || $content == 'help') {
            $flag = 'menu';
        } else {
            if ($content == "菜单" || $content == '帮助' || $content == "列表" || $content == '清单' || $content == '功能') {
                $flag = "text";
            } else {
                if (strstr($content, "网号") || $content == "6") {
                    $flag = "6";
                } else {
                    if ($content == "1" || $content == "2" || $content == "9" || $content == "3" || $content == "4" || strstr($content, "还书") || strstr($content, "还") || strstr($content, "图书")) {
                        $flag = "gdpuapi";
                    } else {
                        if (strstr($content, "表白") || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "CET6") || strstr($content, "CET") || strstr($content, "cet4") || strstr($content, "cet6") || strstr($content, "CET4") || strstr($content, "四级") || strstr($content, "六级") || strstr($content, "4级") || strstr($content, "6级") || strstr($content, "手机") || $content == "f" || $content == "F" || strstr($content, "解梦") || $content == "e" || $content == "E" || strstr($content, "身份") || $content == "G" || $content == "g" || strstr($content, "找找帮") || $content == "8" || strstr($content, "音乐") || strstr($content, "视频") || strstr($content, "公交") || $content == "A" || $content == "a" || $content == "B" || $content == "b" || $content == "C" || $content == "c" || strstr($content, "翻译") || $content == "D" || $content == 'd' || strstr($content, "快递") || strstr($content, "天气") || strstr($content, "t") || strstr($content, "T")) {
                            $flag = "webapi";
                        } elseif (strstr($content, "成绩") || $content == "10") {
                            $content = str_replace('#', '#', $content);
                            $ret = explode('#', $content);
                            $xh = $ret[1];
                            $pw = $ret[2];
                            if (!$xh || !$pw) {
                                $name = $from;
                                $user = new user();
                                $xh = $user->get_num($name);
                                $pw = $user->get_pw($name);
                            }
                            if ($xh && $pw) {
                                $url = 'http://av.jejeso.com/helper/api/chengji/get_chengji.php?xh=' . $xh . '&pw=' . $pw;
                                $content = '#title|成绩单@title|亲爱的学霸Orz,这是您的成绩单请笑纳~^_^(单击获取,若页面为空请确认密码学号无误)' . '#url|' . $url . '#pic';
                                $content = replypic($content);
                            } else {
                                $content = "帐号或密码错误,请输入“重绑”重新绑定帐号和密码。\n或者按格式#学号#密码  查询";
                            }
                            // $content = '由于教务处当前不允许查成绩,所以小助手暂时无法帮您查询,非常抱歉!';
                            return $content;
                        } elseif ($content == "11" || strstr($content, "选修")) {
                            $content = str_replace('#', '#', $content);
                            $ret = explode('#', $content);
                            $xh = $ret[1];
                            $pw = $ret[2];
                            if (!$xh || !$pw) {
                                $name = $from;
                                $user = new user();
                                $xh = $user->get_num($name);
                                $pw = $user->get_pw($name);
                            }
                            if ($xh && $pw) {
                                $url = 'http://branch2.gdpu.edu.cn/gd/jwc/wx.xuanxiu.api.php?xh=' . $xh . '&pw=' . $pw;
                                $reply_content = file_get_contents($url);
                            } else {
                                $reply_content = "帐号或密码错误,请输入“重绑”重新绑定帐号和密码。\n或者按格式#学号#密码  查询";
                            }
                            return $reply_content;
                        } elseif (strstr($content, "绑定")) {
                            //查询用户名
                            $name = $from;
                            $url = "http://av.jejeso.com/helper/api/check.php?name=" . $name;
                            $reply_content = file_get_contents($url);
                            if ($reply_content != '') {
                                //判断用户是否存在
                                // $reply_content = "用户已绑定";
                                return "用户已绑定";
                            } else {
                                $user = new user();
                                $content = str_replace('#', '#', $content);
                                $ret = explode('#', $content);
                                $xh = $ret[1];
                                $pw = $ret[2];
                                if ($xh && $pw) {
                                    $num = $xh;
                                    $pwd = $pw;
                                    $user->blind($name, $num, $pwd);
                                    $content = "绑定成功,以后直接输入成绩即可查成绩,无需再输入学号密码\n";
                                } else {
                                    $content = "请确认【格式】正确\n\n绑定#学号#密码\n重新绑定请回复\n重绑#学号#密码";
                                }
                                return $content;
                            }
                        } elseif (strstr($content, "重新绑定") || strstr($content, "重绑")) {
                            $name = $from;
                            $user = new user();
                            $content = str_replace('#', '#', $content);
                            $ret = explode('#', $content);
                            $xh = $ret[1];
                            $pw = $ret[2];
                            if (!$xh || !$pw) {
                                $content = "请确认【格式】正确\n\n重绑#学号#密码";
                            } else {
                                $user->reblind($name, $xh, $pw);
                                $content = "重新绑定成功";
                            }
                            return $content;
                        } else {
                            if (strstr($content, "课表") || $content == "7") {
                                $content = str_replace('#', '#', $content);
                                $ret = explode('#', $content);
                                $xh = $ret[1];
                                $pw = $ret[2];
                                $day = date("w");
                                if (!$xh || !$pw) {
                                    $name = $from;
                                    $user = new user();
                                    $xh = $user->get_num($name);
                                    $pw = $user->get_pw($name);
                                    if ($ret[1]) {
                                        $day = $ret[1];
                                    }
                                }
                                if (isset($ret[3])) {
                                    if ($ret[3] >= 1 && $ret[3] <= 5) {
                                        $day = $ret[3];
                                    }
                                }
                                //			else
                                //                    $day = 1;
                                //            }
                                if ($xh && $pw) {
                                    $url = 'http://av.jejeso.com/helper/kb/kb.php?xh=' . $xh . '&pw=' . $pw . '&day=' . $day;
                                    $reply_content = file_get_contents($url);
                                } elseif (!$xh || !$pw) {
                                    $reply_content = "【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1";
                                } else {
                                    $reply_content = "【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1";
                                }
                                return $reply_content;
                            } else {
                                if (strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                    if (strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                        $content = trim($content);
                                        $content = str_replace('#', '#', $content);
                                        $ret = explode('#', $content);
                                        $zkzh = trim($ret[1]);
                                        $xm = trim($ret[2]);
                                        if ($zkzh == '' || $xm == '') {
                                            $reply_content = "【CET4,6级查询】\nby Ourstudio工作室\n请检查格式是否正确\n发送\n\ncet#准考证号#姓名\n\n即可查询";
                                        }
                                        if ($zkzh && $xm) {
                                            $url = 'http://av.jejeso.com/helper/api/cet/cet_wx.php?zkzh=' . $zkzh . '&xm=' . $xm;
                                            $reply_content = file_get_contents($url);
                                            if ($reply_content == "") {
                                                $reply_content = "无法查找到你的成绩,请检查学号、姓名是否正确\n";
                                            }
                                            return $reply_content;
                                        }
                                    }
                                } else {
                                    if (strstr($content, "动漫") || $content == "5") {
                                        $url = 'http://110.75.189.200/chris/helper/media_update.php';
                                        $reply_content = file_get_contents($url);
                                        return $reply_content;
                                    } else {
                                        if (strstr($content, "外卖") || strstr($content, "KFC") || strstr($content, "快餐")) {
                                            $reply_content = "1、龙旺食府 1884214432 短号:66694\n9块钱3肉一菜";
                                            return $reply_content;
                                        } else {
                                            if (strstr($content, "建议") || strstr($content, "意见") || strstr($content, "投诉")) {
                                                $content = "#title|有奖征集意见@title|填写意见点此进入.感谢您的建议#url|http://av.jejeso.com/helper/api/add_advices/commit.html#pic";
                                                if (strstr($reply_content, 'pic')) {
                                                    $reply_content = replypic($reply_content);
                                                }
                                                return $reply_content;
                                            } else {
                                                if (strstr($content, "报障") || strstr($content, "上不了网") || strstr($content, "校园网常见错误") || strstr($content, "114.w")) {
                                                    $reply_content = "#title|校园网常见错误@title|查询校园网错误点此进入#url|http://av.jejeso.com/Ours/911/index.php#pic";
                                                    if (strstr($reply_content, 'pic')) {
                                                        $reply_content = replypic($reply_content);
                                                    }
                                                    return $reply_content;
                                                } else {
                                                    if ($content == "合作" || $content == "推送") {
                                                        $reply_content = "联系人:陈正勇\n手机号、微信:18825076954(61954)\nQQ:1249192238";
                                                        return $reply_content;
                                                    } else {
                                                        if (strstr($content, "新闻")) {
                                                            $reply_content = "#title|广药新闻@title|查看最新广药新闻点此进入#url|http://ours.123nat.com:59832/news/#pic";
                                                            if (strstr($reply_content, 'pic')) {
                                                                $reply_content = replypic($reply_content);
                                                            }
                                                            return $reply_content;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // menu内容
        if ($flag == "menu" || strstr($content, "查询")) {
            $reply_content = MENU;
        } else {
            if ($flag == "text") {
                $reply_content = TEXT;
            } else {
                if ($flag == "gdpuapi") {
                    $g = new WebAPI();
                    //广药新闻
                    if ($content == "1" || strstr($content, "新闻")) {
                        $reply_content = "#title|广药新闻@title|查看最新广药新闻点此进入#url|http://ours.123nat.com:59832/news/#pic";
                        //$reply_content = $g->get_gdpu_news ();
                    } else {
                        if ($content == "2") {
                            $reply_content = $g->get_gdpu_jobs();
                        } else {
                            if ($content == "9") {
                                $reply_content = $g->get_gdpu_partime();
                            } else {
                                if (strstr($content, "图书") || $content == "3") {
                                    $keyword = str_replace("图书", "", $content);
                                    $reply_content = $g->get_lib_book($keyword);
                                } else {
                                    if ($content == "4" || strstr($content, "还")) {
                                        $array = explode("#", $content);
                                        $xh = $array[1];
                                        if (!$xh) {
                                            $name = $from;
                                            $user = new user();
                                            $xh = $user->get_num($name);
                                        }
                                        if ($xh == '') {
                                            $reply_content = "查询正确格式为:\n还书#学号";
                                        } else {
                                            $reply_content = $g->get_lib_borrowbook($xh);
                                        }
                                    } else {
                                        $reply_content = "未知外网接口!";
                                    }
                                }
                            }
                        }
                    }
                } else {
                    if ($flag == "webapi") {
                        $o = new WebAPI();
                        //四六级
                        if ($content == "4" || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                            if ($content == "4" || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                $content = trim($content);
                                $content = str_replace('#', '#', $content);
                                $ret = explode('#', $content);
                                $zkzh = trim($ret[1]);
                                $xm = trim($ret[2]);
                                if ($zkzh == '' || $xm == '') {
                                    $reply_content = "【CET4,6级查询】\nby Ourstudio工作室\n请检查格式是否正确\n发送\n\ncet#准考证号#姓名\n\n即可查询";
                                }
                                if ($zkzh && $xm) {
                                    $url = 'http://av.jejeso.com/helper/api/cet/cet_wx.php?zkzh=' . $zkzh . '&xm=' . $xm;
                                    $reply_content = file_get_contents($url);
                                    if ($reply_content == "") {
                                        $reply_content = "无法查找到你的成绩,请检查学号、姓名是否正确\n";
                                    }
                                    return $reply_content;
                                }
                            }
                        } else {
                            if (strstr($content, "手机") || $content == "f" || $content == "F") {
                                $date = explode("#", $content);
                                $number = $date[1];
                                if ($number == '') {
                                    $reply_content = "查归属地格式:手机#手机号\n即可查询归属地";
                                } else {
                                    $reply_content = $o->get_mobile($number);
                                }
                            } else {
                                if (strstr($content, "解梦") || $content == "e" || $content == "E") {
                                    $date = explode("#", $content);
                                    $key = $date[1];
                                    if ($key == '') {
                                        $reply_content = "发送格式:解梦#关键词\n即可解开你的梦境";
                                    } else {
                                        $reply_content = $o->get_dream($key);
                                    }
                                } else {
                                    if ($content == "l" || $content == "L") {
                                        $reply_content = $o->get_award();
                                    } else {
                                        if (strstr($content, "身份") || $content == "g" || $content == "G") {
                                            $date = explode("#", $content);
                                            $no = $date[1];
                                            if ($no == '') {
                                                $reply_content = "查看身份:\n输入\t身份#身份证";
                                            } else {
                                                $reply_content = $o->get_idcard($no);
                                            }
                                        } else {
                                            if (strstr($content, "快递") || $content == "D" || $content == "d") {
                                                $date = explode("#", $content);
                                                $com = $date[1];
                                                $no = $date[2];
                                                if ($com == '' || $no == '') {
                                                    $reply_content = "输入格式:\n快递#快递公司#单号\n即可查询您的包裹\n最新状态";
                                                } else {
                                                    $reply_content = $o->kuaidi($com, $no);
                                                }
                                            } else {
                                                if ($content == "A" || $content == "a") {
                                                    $reply_content = $o->get_song_douban();
                                                } else {
                                                    if (strstr($content, "公交") || $content == "B" || $content == "b") {
                                                        $date = explode("#", $content);
                                                        $city = $date[1];
                                                        $no = $date[2];
                                                        if ($city == '' || $no == '') {
                                                            $reply_content = "输入:公交#城市#公交线路\n即可获得线路";
                                                        } else {
                                                            $reply_content = $o->get_bus($city, $no);
                                                        }
                                                    } else {
                                                        if (strstr($content, "翻译") || $content == "C" || $content == "c") {
                                                            $date = explode("#", $content);
                                                            $key = $date[1];
                                                            if ($key == '') {
                                                                $reply_content = "输入:翻译#英文\n或者直接告诉小助手你想知道的英文单词\n小助手即刻帮您翻译";
                                                            } else {
                                                                $reply_content = $o->enTozh($key);
                                                            }
                                                        } else {
                                                            if (strstr($content, "天气") || $content == "t" || $content == "T") {
                                                                $date = explode("#", $content);
                                                                $key = $date[1];
                                                                if ($key == '') {
                                                                    $reply_content = "发送格式:天气#城市\n即可查询天气预报";
                                                                } else {
                                                                    $reply_content = $o->get_weather($key);
                                                                }
                                                            } else {
                                                                if (strstr($content, "找找帮") || ($content = "8")) {
                                                                    $text = str_replace('找找帮', '', $content);
                                                                    $reply_content = $o->send_zzbon($text, $from);
                                                                } else {
                                                                    if (strstr($content, "音乐") || $content == "h" || $content == "H") {
                                                                        $reply_content = $o->get_song_tencent($content);
                                                                        $reply_content = mb_convert_encoding($reply_content, 'utf-8', 'gbk');
                                                                    } else {
                                                                        if (strstr($content, "视频")) {
                                                                            $reply_content = $o->get_video_youku($content);
                                                                        } else {
                                                                            if (strstr($content, "表白")) {
                                                                                $reply_content = $o->get_biaobai($content, $from);
                                                                            } else {
                                                                                $reply_content = "未知外部接口!";
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        // 表情处理
                        $content = $w->biaoqing($content);
                        // 如果有星标的标记则设为星标(用于留言)
                        if (strstr($content, FLAG)) {
                            $w->set_funcflag();
                        }
                        $url = 'http://www.tuling123.com/openapi/api?key=2de48f93cfa6fb3fff1c0ede2ac8b953&info=' . $content;
                        $reply_content = file_get_contents($url);
                        preg_match_all('/{"code":100000,"text":"(.+?)"}/is', $reply_content, $core);
                        $reply_content = $core[1][0];
                        if (YOURNICK) {
                            $reply_content = str_replace('小豆', YOURNICK, $reply_content);
                        }
                        if ($reply_content == "") {
                            $reply_content = "你说的话太深奥了,教我如何答你好呢?\n命令:问...答...\n";
                        }
                    }
                }
            }
        }
    } else {
        if ($welcome != '') {
            $reply_content = WELCOME;
        }
    }
    // 音乐地址
    if (strstr($reply_content, 'murl')) {
        // 音乐
        $a = array();
        foreach (explode('#', $reply_content) as $reply_content) {
            list($k, $v) = explode('|', $reply_content);
            $a[$k] = $v;
        }
        $reply_content = $a;
    } elseif (strstr($reply_content, 'pic')) {
        $reply_content = replypic($reply_content);
    }
    // 最后返回
    return $reply_content;
}
Esempio n. 2
0
 /**
  * Return path to agent photo file, if file not exist, download it and save on disk.
  * @param string $customSize Custom size, written as width_height, ex. 400_300
  * @return string
  */
 public function GetPhotoImageSrc($customSize)
 {
     if ($this->GetPhotoFile() == "") {
         return "";
     }
     $api = new WebAPI();
     return $api->GetAgentDepartmentPhoto($this->GetId(), $customSize, 3, str_replace(array('-', ':', ' ', '.jpg'), array(''), $this->GetPhotoFile()));
 }
Esempio n. 3
0
function reply_main($request, $w)
{
    $to = $request['ToUserName'];
    $from = $request['FromUserName'];
    //大众接口
    if ($w->get_msg_type() == "location") {
        $lacation = "x@" . (string) $request['Location_X'] . "@" . (string) $request['Location_Y'];
        $lacation = urlencode(str_replace('\\.', '\\\\.', $lacation));
        $lacation = urldecode(xiaojo($lacation, $from, $to));
        return $lacation;
    } else {
        if ($w->get_msg_type() == "image") {
            $PicUrl = $request['PicUrl'];
            $w->set_funcflag();
            return "咦,我也有这张照片:" . $PicUrl;
        } else {
            if ($w->get_msg_type() == "voice") {
                return array("title" => "你好", "description" => "亲爱的主人", "murl" => "http://weixen-file.stor.sinaapp.com/b/xiaojo.mp3", "hqurl" => "http://weixen-file.stor.sinaapp.com/b/xiaojo.mp3");
            } else {
                if ($w->get_msg_type() == "event") {
                    //关注
                    if ($w->get_event_type() == "subscribe") {
                        $welcome = WELCOME;
                        return $welcome;
                    } elseif ($w->get_event_type() == "unsubscribe") {
                        $unsub = urldecode(xiaojo("subscribe", $from, $to));
                        return $unsub;
                    } elseif ($w->get_event_type() == "click") {
                        $menukey = $w->get_event_key();
                        $menu = urldecode(xiaojo($menukey, $from, $to));
                        return $menu;
                    } else {
                        $menukey = $w->get_event_key();
                        return $menukey;
                    }
                }
            }
        }
    }
    //获取http的content字段
    $content = trim($request['Content']);
    if (!empty($content)) {
        $flag = "0";
        //广药内网接口
        if ($content == "?" || $content == '?') {
            $flag = 'menu';
        } else {
            if (strstr($content, "绑定")) {
                return $content = "【管理员回复】\n\n绑定以及相关功能目前还在内测,还没有接入到本平台,可以加微信号doctoryanson(Y博士)或者gdpucafe(广药淅水咖啡厅)进行测试>>>\n\n有菜单版本更加方便快捷<a href=\"weixin://contacts/profile/gh_a450baf872ec\">点击关注</a>";
            } else {
                if ($content == "菜单" || $content == '帮助' || $content == "列表" || $content == '清单' || $content == '功能') {
                    $flag = "text";
                } else {
                    if (strstr($content, "开户")) {
                        $flag = "5";
                    } else {
                        if (strstr($content, "网号")) {
                            $flag = "6";
                        } else {
                            if ($content == "1" || $content == "2" || $content == "9" || strstr($content, "还书") || strstr($content, "图书")) {
                                $flag = "gdpuapi";
                            } else {
                                if (strstr($content, "表白") || strstr($content, "绑定") || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "CET6") || strstr($content, "CET") || strstr($content, "cet4") || strstr($content, "cet6") || strstr($content, "CET4") || strstr($content, "4") || strstr($content, "四级") || strstr($content, "六级") || strstr($content, "4级") || strstr($content, "6级") || strstr($content, "归属地") || strstr($content, "解梦") || strstr($content, "身份证") || strstr($content, "找找帮") || strstr($content, "音乐") || strstr($content, "视频") || $content == "A" || $content == "a") {
                                    $flag = "webapi";
                                } else {
                                    if (strstr($content, "成绩") || strstr($content, "10")) {
                                        $content = str_replace('#', '#', $content);
                                        $ret = explode('#', $content);
                                        $xh = $ret[1];
                                        $pw = $ret[2];
                                        if ($xh && $pw) {
                                            $url = 'http://ours.123nat.com:59832/helper/api/jwcapi.php?xh=' . $xh . '&pw=' . $pw . '&flag=2';
                                            $content = file_get_contents($url);
                                            //			$content = explode("2014学年",$content);
                                            //			$content = $content[1];
                                            //			$content = str_replace('2013','-',$content);
                                            $content = substr($content, 0, 1900);
                                        } elseif (!$xh || !$pw) {
                                            $content = "请确认【格式】是否正确\n\n成绩#学号#密码";
                                        } else {
                                            $content = "请确认格式是否正确\n\n成绩#学号#密码";
                                        }
                                        return $content;
                                    } else {
                                        if (strstr($content, "课表") || strstr($content, "7")) {
                                            $content = str_replace('#', '#', $content);
                                            $ret = explode('#', $content);
                                            $xh = $ret[1];
                                            $pw = $ret[2];
                                            $day = date("w");
                                            if (isset($ret[3])) {
                                                if ($ret[3] >= 1 && $ret[3] <= 5) {
                                                    $day = $ret[3];
                                                }
                                                if (strtolower($ret[3]) == 'all') {
                                                    $day = 'all';
                                                }
                                            }
                                            if ($xh && $pw) {
                                                $url = 'http://ours.123nat.com:59832/helper/kb/kb.php?xh=' . $xh . '&pw=' . $pw . '&day=' . $day;
                                                $content = file_get_contents($url);
                                            } elseif (!$xh || !$pw) {
                                                $content = "【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1\n\n获取全部课表:\n课表#1207511199#1207511199#all";
                                            } else {
                                                $content = "【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1\n\n获取全部课表:\n课表#1207511199#1207511199#all";
                                            }
                                            return $content;
                                        } else {
                                            if (strstr($content, "11") || strstr($content, "选修")) {
                                                $content = str_replace('#', '#', $content);
                                                $ret = explode('#', $content);
                                                $xh = $ret[1];
                                                $pw = $ret[2];
                                                if ($xh && $pw) {
                                                    $url = 'http://ours.123nat.com:59832/helper/jwc/wx.xuanxiu.api.php?xh=' . $xh . '&pw=' . $pw;
                                                    $content = file_get_contents($url);
                                                } elseif (!$xh || !$pw) {
                                                    $content = "请确认【格式】是否正确\n\n选修#学号#密码";
                                                } else {
                                                    $content = "请确认【格式】是否正确\n\n选修#学号#密码";
                                                }
                                                return $content;
                                            } else {
                                                if (strstr($content, "4") || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                                    if (strstr($content, "4") || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                                        $content = trim($content);
                                                        $content = str_replace('#', '#', $content);
                                                        $ret = explode('#', $content);
                                                        $zkzh = trim($ret[1]);
                                                        $xm = trim($ret[2]);
                                                        if ($zkzh == '' || $xm == '') {
                                                            $content = "【CET4,6级查询】\nby Ourstudio工作室\n请检查格式是否正确\n发送\n\ncet#准考证号#姓名\n\n即可查询";
                                                        }
                                                        if ($zkzh && $xm) {
                                                            $url = 'http://ours.123nat.com:59832/helper/chengji/cet_wx.php?zkzh=' . $zkzh . '&xm=' . $xm;
                                                            $content = file_get_contents($url);
                                                            if ($content == "") {
                                                                $content = "无法查找到你的成绩,请检查学号、姓名是否正确\n";
                                                            }
                                                            return $content;
                                                            //  $content="请确认信息全部正确,比如名字一定要全称,不能简写。收到最新消息称要到9点各网站才开通查询4,6级成绩";
                                                        }
                                                    }
                                                } else {
                                                    if (strstr($content, "动漫")) {
                                                        $url = 'http://110.75.189.200/chris/helper/media_update.php';
                                                        $content = file_get_contents($url);
                                                        return $content;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        //menu内容
        if ($flag == "menu" || strstr($content, "查询")) {
            $content = MENU;
        } else {
            if ($flag == "text") {
                $content = TEXT;
            } else {
                if ($flag == "5" || $flag == "6") {
                    if ($flag == "5") {
                        $content = ltrim($content, "开户");
                    } else {
                        if ($flag == "6") {
                            $content = ltrim($content, "网号");
                        }
                    }
                    $url = 'http://zlgc.gdpu.edu.cn/gdpuer/api.php?flag=' . $flag . '&content=' . $content;
                    $content = file_get_contents($url);
                } else {
                    if ($flag == "gdpuapi") {
                        $g = new WebAPI();
                        if ($content == "1") {
                            $content = $g->get_gdpu_news();
                        } else {
                            if ($content == "2") {
                                $content = "开发中";
                                // $content=$g->get_gdpu_jobs();
                            } else {
                                if ($content == "9") {
                                    $content = $g->get_gdpu_partime();
                                } else {
                                    if (strstr($content, "图书")) {
                                        $keyword = str_replace("图书", "", $content);
                                        $content = $g->get_lib_book($keyword);
                                    } else {
                                        if (strstr($content, "还书")) {
                                            $keyword = str_replace("还书", "", $content);
                                            $content = $g->get_lib_boorowbook($keyword);
                                        } else {
                                            $content = "未知外网接口!";
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        if ($flag == "webapi") {
                            $o = new WebAPI();
                            if (strstr($content, "4") || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                if (strstr($content, "4") || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                    $content = trim($content);
                                    $content = str_replace('#', '#', $content);
                                    $ret = explode('#', $content);
                                    $zkzh = trim($ret[1]);
                                    $xm = trim($ret[2]);
                                    if ($zkzh == '' || $xm == '') {
                                        $content = "【CET4,6级查询】\nby Ourstudio工作室\n请检查格式是否正确\n发送\n\ncet#准考证号#姓名\n\n即可查询";
                                    }
                                    if ($zkzh && $xm) {
                                        $url = 'http://ours.123nat.com:59832/helper/chengji/cet_wx.php?zkzh=' . $zkzh . '&xm=' . $xm;
                                        $content = file_get_contents($url);
                                        if ($content == "") {
                                            $content = "无法查找到你的成绩,请检查学号、姓名是否正确\n";
                                        }
                                        return $content;
                                        //	$content="请确认信息全部正确,比如名字一定要全称,不能简写。收到最新消息称要到9点各网站才开通查询4,6级成绩";
                                    }
                                }
                                /*
                                  $content=ltrim($content,"cet");
                                  $regex = '/[0-9]*$/';
                                  preg_match($regex, $content, $zkzh);
                                  $xm=rtrim($content,$zkzh[0]);
                                  $content=$o->get_ours_cet($zkzh[0],$xm);
                                */
                            } else {
                                if (strstr($content, "归属地")) {
                                    $number = ltrim($content, "归属地");
                                    $content = $o->get_ours_mobile($number);
                                } else {
                                    if (strstr($content, "解梦")) {
                                        $key = str_replace('解梦', '', $content);
                                        $content = $o->get_ours_dream($key);
                                    } else {
                                        if ($content == "l" || $content == "L") {
                                            $content = $o->get_ours_award();
                                        } else {
                                            if (strstr($content, "身份证")) {
                                                $no = str_replace('身份证', '', $content);
                                                $content = $o->get_ours_idcard($no);
                                            } else {
                                                if (strstr($content, "找找帮")) {
                                                    $text = str_replace('找找帮', '', $content);
                                                    $content = $o->send_ours_zzbon($text, $from);
                                                } else {
                                                    if ($content == "A" || $content == "a") {
                                                        $content = $o->get_song_random();
                                                    } else {
                                                        if (strstr($content, "音乐")) {
                                                            $content = $o->get_song_tencent($content);
                                                            $content = mb_convert_encoding($content, 'utf-8', 'gbk');
                                                        } else {
                                                            if (strstr($content, "视频")) {
                                                                $content = $o->get_video_youku($content);
                                                            } else {
                                                                if (strstr($content, "表白")) {
                                                                    $content = $o->get_biaobai($content, $from);
                                                                } else {
                                                                    $content = "未知外部接口!";
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        } else {
                            //表情处理
                            $content = $w->biaoqing($content);
                            //如果有星标的标记则设为星标(用于留言)
                            if (strstr($content, FLAG)) {
                                $w->set_funcflag();
                            }
                            //	$url = 'http://xiao.douqq.com/api.php?msg='.$content.'&type=txt';
                            $url = 'http://www.tuling123.com/openapi/api?key=2de48f93cfa6fb3fff1c0ede2ac8b953&info=' . $content;
                            $content = file_get_contents($url);
                            preg_match_all('/{"code":100000,"text":"(.+?)"}/is', $content, $core);
                            $content = $core[1][0];
                            if (YOURNICK) {
                                $content = str_replace('小豆', YOURNICK, $content);
                            }
                            if ($content == "") {
                                $content = "你说的话太深奥了,教我如何答你好呢?\n命令:问...答...\n";
                            }
                        }
                    }
                }
            }
        }
    } else {
        if ($welcome != '') {
            $content = WELCOME;
        }
    }
    //音乐地址
    if (strstr($content, 'murl')) {
        //音乐
        $a = array();
        foreach (explode('#', $content) as $content) {
            list($k, $v) = explode('|', $content);
            $a[$k] = $v;
        }
        $content = $a;
    } elseif (strstr($content, 'pic')) {
        $a = array();
        $b = array();
        $c = array();
        $n = 0;
        $contents = $content;
        foreach (explode('@t', $content) as $b[$n]) {
            if (strstr($contents, '@t')) {
                $b[$n] = str_replace("itle", "title", $b[$n]);
                $b[$n] = str_replace("ttitle", "title", $b[$n]);
            }
            foreach (explode('#', $b[$n]) as $content) {
                list($k, $v) = explode('|', $content);
                $a[$k] = $v;
                $d .= $k;
            }
            $c[$n] = $a;
            $n++;
        }
        $content = $c;
    }
    //最后返回
    return $content;
}
Esempio n. 4
0
 public function createProceeding($data)
 {
     try {
         $bookData = WebAPI::searchBookData($data['ISBN'][0]);
     } catch (CException $e) {
         $bookData = null;
     }
     $proc = new Proceeding();
     $proc->type = $data['type'];
     $proc->authors = $data['author'];
     $proc->year = $data['issued']['date-parts'][0][0];
     $proc->title = $data['title'][0];
     $proc->proc_name = StringHelper::titleCase($data['container-title'][0]);
     $proc->pages = null;
     // sigh. no info available
     if ($bookData !== null) {
         $proc->pub = $bookData['publisher'];
         $city = explode(",", $bookData['city']);
         $proc->pub_city = reset($city);
         $proc->pub_city = preg_replace("/[^A-Za-z0-9 \\-']/", "", $proc->pub_city);
         // additional filtering
         $proc->pub_country = WebAPI::searchCityData($proc->pub_city);
         // editors, con_date, con_city uses Stanford NER
         // sometimes editors in author, sometimes in title~
         $combined = $bookData['author'] . ' ' . $bookData['title'];
         $ner_result = StringHelper::NER($combined);
         $proc->editors = StringHelper::parseNerPerson($ner_result);
         $proc->con_date = StringHelper::parseNerDate($ner_result);
         $proc->con_city = StringHelper::parseNerLocation($ner_result);
     } else {
         $proc->pub = $data['publisher'];
     }
     return $proc;
 }
Esempio n. 5
0
 /**
  * Gets serwis params from database
  * @param string $key
  * @param object $defValue
  * @return array[]
  */
 public static function Params($key, $defValue = null)
 {
     if (self::$_Params == null) {
         self::$_Params = array();
         $db = DataBase::GetDbInstance();
         $query = "SELECT key_name, value FROM #S#settings";
         $result = $db->ExecuteQuery($query);
         if ($result) {
             while ($row = $db->FetchArray($result)) {
                 self::$_Params[$row['key_name']] = $row['value'];
             }
         }
     }
     if (array_key_exists($key, self::$_Params)) {
         return self::$_Params[$key];
     } else {
         return $defValue;
     }
 }
Esempio n. 6
0
function reply_main($request, $w)
{
    $to = $request['ToUserName'];
    $from = $request['FromUserName'];
    //大众接口
    if ($w->get_msg_type() == "location") {
        $lacation = "x@" . (string) $request['Location_X'] . "@" . (string) $request['Location_Y'];
        $lacation = urlencode(str_replace('\\.', '\\\\.', $lacation));
        $lacation = urldecode(xiaojo($lacation, $from, $to));
        return $lacation;
    } else {
        if ($w->get_msg_type() == "image") {
            $PicUrl = $request['PicUrl'];
            $w->set_funcflag();
            return "咦,我也有这张照片:" . $PicUrl;
        } else {
            if ($w->get_msg_type() == "voice") {
                return array("title" => "你好", "description" => "亲爱的主人", "murl" => "http://weixen-file.stor.sinaapp.com/b/xiaojo.mp3", "hqurl" => "http://weixen-file.stor.sinaapp.com/b/xiaojo.mp3");
            } else {
                if ($w->get_msg_type() == "event") {
                    //关注
                    if ($w->get_event_type() == "subscribe") {
                        $welcome = WELCOME;
                        return $welcome;
                    } elseif ($w->get_event_type() == "unsubscribe") {
                        $unsub = urldecode(xiaojo("subscribe", $from, $to));
                        return $unsub;
                    } elseif ($w->get_event_type() == "click") {
                        $menukey = $w->get_event_key();
                        $menu = urldecode(xiaojo($menukey, $from, $to));
                        return $menu;
                    } else {
                        $menukey = $w->get_event_key();
                        return $menukey;
                    }
                }
            }
        }
    }
    //获取http的content字段
    $content = trim($request['Content']);
    //开户指南
    if (strstr($content, '开')) {
        $url = 'http://mp.weixin.qq.com/s?__biz=MjM5OTA1NzMyMg==&mid=201721356&idx=1&sn=2ab0f94f0514fc6d01b5addc76caf446&scene=4#wechat_redirect';
        $content = '#title|开户@title|开户指南入口' . '#url|' . $url . '#pic';
        if (strstr($content, 'pic')) {
            $a = array();
            $b = array();
            $c = array();
            $n = 0;
            $contents = $content;
            foreach (explode('@t', $content) as $b[$n]) {
                if (strstr($contents, '@t')) {
                    $b[$n] = str_replace("itle", "title", $b[$n]);
                    $b[$n] = str_replace("ttitle", "title", $b[$n]);
                }
                foreach (explode('#', $b[$n]) as $content) {
                    list($k, $v) = explode('|', $content);
                    $a[$k] = $v;
                    $d .= $k;
                }
                $c[$n] = $a;
                $n++;
            }
            $content = $c;
        }
        return $content;
    }
    //开户指南结束
    if (!empty($content)) {
        $flag = "0";
        //广药内网接口
        if ($content == "?" || $content == '?' || $content == 'help') {
            $flag = 'menu';
        } else {
            if (strstr($content, "绑定")) {
                return $content = "【管理员回复】\n\n绑定以及相关功能目前还在内测,还没有接入到本平台,可以加微信号doctoryanson(Y博士)或者gdpucafe(广药淅水咖啡厅)进行测试>>>\n\n有菜单版本更加方便快捷<a href=\"weixin://contacts/profile/gh_a450baf872ec\">点击关注</a>";
            } else {
                if ($content == "菜单" || $content == '帮助' || $content == "列表" || $content == '清单' || $content == '功能') {
                    $flag = "text";
                } else {
                    if (strstr($content, "网号") || $content == "6") {
                        $flag = "6";
                    } else {
                        if ($content == "1" || $content == "2" || $content == "9" || $content == "3" || $content == "4" || strstr($content, "还书") || strstr($content, "还") || strstr($content, "图书")) {
                            $flag = "gdpuapi";
                        } else {
                            if (strstr($content, "表白") || strstr($content, "绑定") || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "CET6") || strstr($content, "CET") || strstr($content, "cet4") || strstr($content, "cet6") || strstr($content, "CET4") || strstr($content, "四级") || strstr($content, "六级") || strstr($content, "4级") || strstr($content, "6级") || strstr($content, "手机") || $content == "i" || $content == "I" || strstr($content, "解梦") || $content == "g" || $content == "G" || strstr($content, "身份") || $content == "j" || $content == "J" || strstr($content, "找找帮") || $content == "8" || strstr($content, "音乐") || strstr($content, "视频") || strstr($content, "公交") || $content == "A" || $content == "a" || $content == "B" || $content == "b" || $content == "E" || $content == "e" || strstr($content, "翻译") || $content == "F" || $content == 'f' || strstr($content, "快递")) {
                                $flag = "webapi";
                            } else {
                                if (strstr($content, "成绩") || $content == "10") {
                                    $content = str_replace('#', '#', $content);
                                    $ret = explode('#', $content);
                                    $xh = $ret[1];
                                    $pw = $ret[2];
                                    if ($xh && $pw) {
                                        // $url = 'http://phpdo9.nat123.net:52182/helper/api/jwcapi.php?xh='.$xh.'&pw='.$pw.'&flag=2';
                                        $url = 'http://av.jejeso.com/helper/api/get_chengji.php?xh=' . $xh . '&pw=' . $pw;
                                        //2014 09 15 $content = file_get_contents($url);
                                        //			$content = explode("2014学年",$content);
                                        //			$content = $content[1];
                                        //			$content = str_replace('2013','-',$content);
                                        //2014 09 15 $content = substr($content,0,1900);
                                        //2014 09 15 add start
                                        //$g = file_get_contents($url);
                                        $content = '#title|成绩单@title|亲爱的学霸Orz,这是您的成绩单请笑纳~^_^(单击获取,若页面为空请确认密码学号无误)' . '#url|' . $url . '#pic';
                                        if (strstr($content, 'pic')) {
                                            $a = array();
                                            $b = array();
                                            $c = array();
                                            $n = 0;
                                            $contents = $content;
                                            foreach (explode('@t', $content) as $b[$n]) {
                                                if (strstr($contents, '@t')) {
                                                    $b[$n] = str_replace("itle", "title", $b[$n]);
                                                    $b[$n] = str_replace("ttitle", "title", $b[$n]);
                                                }
                                                foreach (explode('#', $b[$n]) as $content) {
                                                    list($k, $v) = explode('|', $content);
                                                    $a[$k] = $v;
                                                    $d .= $k;
                                                }
                                                $c[$n] = $a;
                                                $n++;
                                            }
                                            $content = $c;
                                        }
                                        return $content;
                                        //2014 09 15 add end
                                    } elseif (!$xh || !$pw) {
                                        $content = "请确认【格式】是否正确\n\n成绩#学号#密码";
                                    } else {
                                        $content = "请确认格式是否正确\n\n成绩#学号#密码";
                                    }
                                    return $content;
                                } else {
                                    if (strstr($content, "课表") || $content == "7") {
                                        $content = str_replace('#', '#', $content);
                                        $ret = explode('#', $content);
                                        $xh = $ret[1];
                                        $pw = $ret[2];
                                        $day = date("w");
                                        if (isset($ret[3])) {
                                            if ($ret[3] >= 1 && $ret[3] <= 5) {
                                                $day = $ret[3];
                                            }
                                            if (strtolower($ret[3]) == 'all') {
                                                $day = 'all';
                                            }
                                        }
                                        if ($xh && $pw) {
                                            $url = 'http://phpdo9.nat123.net:52182/helper/kb/kb.php?xh=' . $xh . '&pw=' . $pw . '&day=' . $day;
                                            $content = file_get_contents($url);
                                        } elseif (!$xh || !$pw) {
                                            // $content="【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1\n\n获取全部课表:\n课表#1207511199#1207511199#all";
                                            $content = "【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1";
                                        } else {
                                            // $content="【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1\n\n获取全部课表:\n课表#1207511199#1207511199#all";
                                            $content = "【现已支持所有校区】\n按照以下格式获取课表\n\n【今天课表】\n课表#学号#密码\n\n【周X课表】\n课表#学号#密码#X\n\n(X为1-5,或者是all,否则均默认为当天,周六、日显示全部课表)\n\n【例如】\n获取今天课表:\n课表#1207511199#1207511199\n\n获取周1课表:\n课表#1207511199#1207511199#1";
                                        }
                                        return $content;
                                    } else {
                                        if ($content == "11" || strstr($content, "选修")) {
                                            $content = str_replace('#', '#', $content);
                                            $ret = explode('#', $content);
                                            $xh = $ret[1];
                                            $pw = $ret[2];
                                            if ($xh && $pw) {
                                                $url = 'http://phpdo9.nat123.net:52182/helper/jwc/wx.xuanxiu.api.php?xh=' . $xh . '&pw=' . $pw;
                                                $content = file_get_contents($url);
                                            } elseif (!$xh || !$pw) {
                                                $content = "请确认【格式】是否正确\n\n选修#学号#密码";
                                            } else {
                                                $content = "请确认【格式】是否正确\n\n选修#学号#密码";
                                            }
                                            return $content;
                                        } else {
                                            if (strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                                if (strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                                    $content = trim($content);
                                                    $content = str_replace('#', '#', $content);
                                                    $ret = explode('#', $content);
                                                    $zkzh = trim($ret[1]);
                                                    $xm = trim($ret[2]);
                                                    if ($zkzh == '' || $xm == '') {
                                                        $content = "【CET4,6级查询】\nby Ourstudio工作室\n请检查格式是否正确\n发送\n\ncet#准考证号#姓名\n\n即可查询";
                                                    }
                                                    if ($zkzh && $xm) {
                                                        $url = 'http://ours.123nat.com:59832/helper/chengji/cet_wx.php?zkzh=' . $zkzh . '&xm=' . $xm;
                                                        $content = file_get_contents($url);
                                                        if ($content == "") {
                                                            $content = "无法查找到你的成绩,请检查学号、姓名是否正确\n";
                                                        }
                                                        return $content;
                                                        //  $content="请确认信息全部正确,比如名字一定要全称,不能简写。收到最新消息称要到9点各网站才开通查询4,6级成绩";
                                                    }
                                                }
                                            } else {
                                                if (strstr($content, "动漫") || $content == "5") {
                                                    $url = 'http://110.75.189.200/chris/helper/media_update.php';
                                                    $content = file_get_contents($url);
                                                    return $content;
                                                } else {
                                                    if (strstr($content, "外卖") || strstr($content, "KFC") || strstr($content, "快餐")) {
                                                        $content = "1、龙旺食府 1884214432 短号:66694\n9块钱3肉一菜";
                                                        return $content;
                                                    } else {
                                                        if (strstr($content, "建议") || strstr($content, "意见") || strstr($content, "投诉")) {
                                                            // $content = "请打开网站:<a>http://av.jejeso.com/helper/api/add_advices/commit.html</a>,进去提建议,谢谢:)";
                                                            $content = "http://av.jejeso.com/helper/api/add_advices/commit.html\n复制网址到您的浏览器中\n即可建议\n感谢您宝贵的建议:)";
                                                            return $content;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        //menu内容
        if ($flag == "menu" || strstr($content, "查询")) {
            $content = MENU;
        } else {
            if ($flag == "text") {
                $content = TEXT;
            } else {
                if ($flag == "6" || $content == "6") {
                    // if($flag=="6"){$content=ltrim($content,"网号");}
                    // $url = 'http://zlgc.gdpu.edu.cn/gdpuer/api.php?flag='.$flag.'&content='.$content;
                    //     $content= file_get_contents($url);
                    if ($flag == "6") {
                        $content = "查询接口http://www.gzekt.com";
                    }
                } else {
                    if ($flag == "gdpuapi") {
                        $g = new WebAPI();
                        if ($content == "1") {
                            $content = $g->get_gdpu_news();
                        } else {
                            if ($content == "2") {
                                // $content="开发中";
                                $content = $g->get_gdpu_jobs();
                            } else {
                                if ($content == "9") {
                                    $content = $g->get_gdpu_partime();
                                } else {
                                    if (strstr($content, "图书") || $content == "3") {
                                        $keyword = str_replace("图书", "", $content);
                                        $content = $g->get_lib_book($keyword);
                                    } else {
                                        if ($content == "4" || strstr($content, "还")) {
                                            $array = explode("#", $content);
                                            $xh = $array[1];
                                            if ($xh == '') {
                                                $content = "查询正确格式为:\n还书#学号";
                                            } else {
                                                // $keyword=str_replace("还书","",$content);
                                                // $content=$g->get_lib_boorowbook($keyword);
                                                $content = $g->get_lib_boorowbook($xh);
                                            }
                                        } else {
                                            $content = "未知外网接口!";
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        if ($flag == "webapi") {
                            $o = new WebAPI();
                            if ($content == "4" || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                if ($content == "4" || strstr($content, "cet") || strstr($content, "Cet") || strstr($content, "四级") || strstr($content, "六级")) {
                                    $content = trim($content);
                                    $content = str_replace('#', '#', $content);
                                    $ret = explode('#', $content);
                                    $zkzh = trim($ret[1]);
                                    $xm = trim($ret[2]);
                                    if ($zkzh == '' || $xm == '') {
                                        $content = "【CET4,6级查询】\nby Ourstudio工作室\n请检查格式是否正确\n发送\n\ncet#准考证号#姓名\n\n即可查询";
                                    }
                                    if ($zkzh && $xm) {
                                        $url = 'http://av.jejeso.com/helper/chengji/cet_wx.php?zkzh=' . $zkzh . '&xm=' . $xm;
                                        $content = file_get_contents($url);
                                        if ($content == "") {
                                            $content = "无法查找到你的成绩,请检查学号、姓名是否正确\n";
                                        }
                                        return $content;
                                        //  $content="请确认信息全部正确,比如名字一定要全称,不能简写。收到最新消息称要到9点各网站才开通查询4,6级成绩";
                                    }
                                }
                                /*
                                  $content=ltrim($content,"cet");
                                  $regex = '/[0-9]*$/';
                                  preg_match($regex, $content, $zkzh);
                                  $xm=rtrim($content,$zkzh[0]);
                                  $content=$o->get_ours_cet($zkzh[0],$xm);
                                */
                            } else {
                                if (strstr($content, "手机") || $content == "i" || $content == "I") {
                                    $date = explode("#", $content);
                                    $number = $date[1];
                                    if ($number == '') {
                                        $content = "查归属地格式:手机#手机号\n即可查询归属地";
                                    } else {
                                        $content = $o->get_ours_mobile($number);
                                    }
                                } else {
                                    if (strstr($content, "解梦") || $content == "g" || $content == "G") {
                                        // $key=str_replace('解梦','',$content);
                                        $date = explode("#", $content);
                                        $key = $date[1];
                                        if ($key == '') {
                                            $content = "发送格式:解梦#关键词\n即可解开你的梦境";
                                        } else {
                                            $content = $o->get_ours_dream($key);
                                        }
                                    } else {
                                        if ($content == "l" || $content == "L") {
                                            $content = $o->get_ours_award();
                                        } else {
                                            if (strstr($content, "身份") || $content == "j" || $content == "J") {
                                                $date = explode("#", $content);
                                                // $no=str_replace('身份证','',$content);
                                                $no = $date[1];
                                                if ($no == '') {
                                                    $content = "查看身份:\n输入\t身份#身份证";
                                                } else {
                                                    $content = $o->get_ours_idcard($no);
                                                }
                                            } else {
                                                if (strstr($content, "快递") || $content == "F" || $content == "f") {
                                                    $date = explode("#", $content);
                                                    $com = $date[1];
                                                    $no = $date[2];
                                                    if ($com == '' || $no == '') {
                                                        $content = "输入格式:\n快递#快递公司#单号\n即可查询您的包裹\n最新状态";
                                                    } else {
                                                        $content = $o->kuaidi($com, $no);
                                                    }
                                                } else {
                                                    if ($content == "A" || $content == "a") {
                                                        $content = $o->get_song_random();
                                                    } else {
                                                        if (strstr($content, "公交") || $content == "B" || $content == "b") {
                                                            $date = explode("#", $content);
                                                            $city = $date[1];
                                                            $no = $date[2];
                                                            if ($city == '' || $no == '') {
                                                                $content = "输入:公交#城市#公交线路\n即可获得线路";
                                                            } else {
                                                                $content = $o->get_bus($city, $no);
                                                            }
                                                        } else {
                                                            if (strstr($content, "翻译") || $content == "E" || $content == "e") {
                                                                $date = explode("#", $content);
                                                                $key = $date[1];
                                                                if ($key == '') {
                                                                    $content = "输入:翻译#英文\n或者直接告诉小助手你想知道的英文单词\n小助手即刻帮您翻译";
                                                                } else {
                                                                    $content = $o->enTozh($key);
                                                                }
                                                            } else {
                                                                if (strstr($content, "找找帮") || ($content = "8")) {
                                                                    $text = str_replace('找找帮', '', $content);
                                                                    $content = $o->send_ours_zzbon($text, $from);
                                                                } else {
                                                                    if (strstr($content, "音乐")) {
                                                                        $content = $o->get_song_tencent($content);
                                                                        $content = mb_convert_encoding($content, 'utf-8', 'gbk');
                                                                    } else {
                                                                        if (strstr($content, "视频")) {
                                                                            $content = $o->get_video_youku($content);
                                                                        } else {
                                                                            if (strstr($content, "表白")) {
                                                                                $content = $o->get_biaobai($content, $from);
                                                                            } else {
                                                                                $content = "未知外部接口!";
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        } else {
                            //表情处理
                            $content = $w->biaoqing($content);
                            //如果有星标的标记则设为星标(用于留言)
                            if (strstr($content, FLAG)) {
                                $w->set_funcflag();
                            }
                            //  $url = 'http://xiao.douqq.com/api.php?msg='.$content.'&type=txt';
                            $url = 'http://www.tuling123.com/openapi/api?key=2de48f93cfa6fb3fff1c0ede2ac8b953&info=' . $content;
                            $content = file_get_contents($url);
                            preg_match_all('/{"code":100000,"text":"(.+?)"}/is', $content, $core);
                            $content = $core[1][0];
                            if (YOURNICK) {
                                $content = str_replace('小豆', YOURNICK, $content);
                            }
                            if ($content == "") {
                                $content = "你说的话太深奥了,教我如何答你好呢?\n命令:问...答...\n";
                            }
                        }
                    }
                }
            }
        }
    } else {
        if ($welcome != '') {
            $content = WELCOME;
        }
    }
    //音乐地址
    if (strstr($content, 'murl')) {
        //音乐
        $a = array();
        foreach (explode('#', $content) as $content) {
            list($k, $v) = explode('|', $content);
            $a[$k] = $v;
        }
        $content = $a;
    } elseif (strstr($content, 'pic')) {
        $a = array();
        $b = array();
        $c = array();
        $n = 0;
        $contents = $content;
        foreach (explode('@t', $content) as $b[$n]) {
            if (strstr($contents, '@t')) {
                $b[$n] = str_replace("itle", "title", $b[$n]);
                $b[$n] = str_replace("ttitle", "title", $b[$n]);
            }
            foreach (explode('#', $b[$n]) as $content) {
                list($k, $v) = explode('|', $content);
                $a[$k] = $v;
                $d .= $k;
            }
            $c[$n] = $a;
            $n++;
        }
        $content = $c;
    }
    //最后返回
    return $content;
}
Esempio n. 7
0
 /**
  * Starts site synchronization process.
  * @return string
  */
 public function SynchronizeSite()
 {
     $msg = parent::SynchronizeSite();
     return $msg;
 }
 public function actionDoi()
 {
     $doi = Yii::app()->request->getParam('doi');
     $context = Yii::app()->request->getParam('context');
     $ref = WebAPI::searchCrossRefDOI($doi);
     if ($ref->type == 'journal-article' && $context == 'journal') {
         $ref->authors = $ref->unmakeAuthors();
         $this->renderJSON((array) $ref);
     } else {
         if ($ref->type == 'proceedings-article' && $context == 'proceeding') {
             $ref->authors = $ref->unmakeAuthors();
             $this->renderJSON((array) $ref);
         } else {
             throw new CHttpException(404, "Tidak ditemukan referensi dengan DOI tersebut.");
         }
     }
 }
Esempio n. 9
0
        $data = json_decode(file_get_contents('php://input'), true);
        $db->insertData2("datos", $data["name"], $data["lastname"], $data["email"], $data["age"], $data["student"]);
        $this->response('', 200);
    }
    //-------------------------->>>
    private function DeleteFile()
    {
        if ($this->get_request_method() != "POST") {
            $this->response('', 406);
        }
        $db = new DB();
        $data = json_decode(file_get_contents('php://input'), true);
        $db->Delete_Data("datos", $data["id"]);
        $this->response('', 200);
    }
    //-------------------------->>>
    private function UpdateFile()
    {
        if ($this->get_request_method() != "POST") {
            $this->response('', 406);
        }
        $db = new DB();
        $data = json_decode(file_get_contents('php://input'), true);
        $db->Update_Data2("datos", $data["name"], $data["lastname"], $data["email"], $data["age"], $data["student"], $data["id"]);
        $this->response('', 200);
        //$valores2= array('$set'=>array("name"=>"Jorge", "lastname"=>"Rincon", "email"=>"*****@*****.**", "age"=>25, "student"=>"true"));
        //$valorupdate = $db->Update_Data("datos",$valores2, "5658c061e4b09df266618703");
    }
}
$api = new WebAPI();
$api->processApi();