예제 #1
0
 public function index()
 {
     //判断是否存在模式锁定
     global $_W;
     $event = empty($_W['event']) ? self::discrevent($_W['msgtype']) : $_W['event'];
     //新增芒果自定义参数 user_post
     $_W['post'] = ucfirst(strtolower($event));
     $lastmodel = get_line_model();
     $crosstime = time() - $lastmodel[1];
     if (!empty($lastmodel[0]) && $crosstime <= 300) {
         $addonparam = explode('/', $lastmodel[0]);
         defined('AMANGO_ADDON_NAME') or define('AMANGO_ADDON_NAME', ucfirst($addonparam[0]));
         $publicpath = str_replace('./', 'http://' . $_SERVER['HTTP_HOST'] . '/', ONETHINK_ADDON_PATH . AMANGO_ADDON_NAME . '/Public/');
         defined('ADDON_PUBLIC') or define('ADDON_PUBLIC', $publicpath);
         defined('ADDON_ROOT') or define('ADDON_ROOT', ONETHINK_ADDON_PATH . AMANGO_ADDON_NAME . '/');
         Amango_Addons($addonparam[0], '', $addonparam[1], '', fasle);
     } else {
         //是否是通用请求
         if (in_array($event, $this->Common_request)) {
             $keyword_count = get_posttype_nums($_W['msgtype']);
             if ($keyword_count == 0) {
                 Reply::trace('Sorry!查询到0条有关【' . $_W['msgtype'] . '】类型的请求');
             }
             $preg_keword = get_keyword_match(true);
             if (empty($preg_keword['id'])) {
                 Reply::trace('查询不到关键词哦~');
             }
             //关键词组和用户权限判断
             get_keyword_user_auth(true);
             Reply::limit_top();
             Reply::cache($preg_keword['id'], '', $preg_keword['keyword_cache'], true);
             Reply::response();
         } else {
             Reply::runBundle(strtolower($event));
         }
     }
 }