fetch('common@default/public/close');exit(); } $host = explode('.',$_SERVER['HTTP_HOST']); if(strpos($host[0],'t') !==false){ $wxmpid= split_host($host[0],2); cookie('wxmpid', $wxmpid,['path'=>'/','expire'=>86400,'domain'=>DOMAIN]); $this->param["setthemes"] = 'yes'; } //二维码访问 //当前特点url需要通过网页访问 需要放行 $islink = 'http://'.@$_SERVER['HTTP_HOST'].@$_SERVER['REQUEST_URI']; $is = strrpos($islink,'promotelink'); $is2 = strrpos($islink,'thirdnotify'); $is3 = strrpos($islink,'clickid'); $is4 = strrpos($islink,'wxpush'); $is5 = strrpos($islink,'clickiddel'); $is6 = strrpos($islink,'writes.bowenzw.com'); if($is===false && $is2===false && $is3===false && $is4===false && $is5===false && $is6===false){ $request = request(); // if(config('open_mobile_site')==1&&strpos($request->url(true),"/login/qrcode")===false){ // if($this->isMobile()===false&&$this->is_wechat()===false || $this->isMobile()&&$this->is_wechat()===false){ // if ($is === false) { // $this->redirect('/login/qrcode?jumpurl='.urlencode($request->url(true))); // } // } // } } //黑名单检测 $this->isuserstatus(); //设置SEO $this->setSeo(); //主题设置 $this->setThemes(); //设置客服信息 //$this->setKefu(); } protected function setThemes() { //网站主题设置 //$themes['mobile'] = config('mobile_themes') ? config('mobile_themes') : 'mobile'; if(array_key_exists('setthemes',$this->param)){ if(array_key_exists('themes',$this->param)){ $themes['mobile']=$this->param['themes']; }else{ //$mobile_themes=db('wxmp')->where('id',cookie('wxmpid'))->value('mobile_themes'); $themes['mobile']=$mobile_themes; } }else{ if(array_key_exists('themes',$this->param)){ $themes['mobile']=$this->param['themes']; }else{ $themes['mobile']=config('mobile_themes'); } } session('mobile_themes',$themes['mobile']); $view_path = 'template/' . $themes['mobile'] . '/'; $module = $this->request->module(); if (!in_array($module, array( 'install'))) { $view_path_pre = $module . '/'; } else { $view_path_pre = ''; } $this->view->config('view_path', $view_path . $view_path_pre) ->config('tpl_replace_string',array( '__IMG__' => BASE_PATH . '/' . $view_path . 'static/images', '__JS__' => BASE_PATH . '/' . $view_path . 'static/js', '__CSS__' => BASE_PATH . '/' . $view_path . 'static/css', )); } protected function setKefu(){ $host = explode('.',$_SERVER['HTTP_HOST']); if(strpos($host[0],'t') !==false){ $wxmpid= split_host($host[0],2); $kfinfo = db('wxmp')->where(['id'=>$wxmpid])->field('nickname,subscribe_url')->find(); }else{ $kfinfo = db('wxmp')->where(['id'=>1])->field('nickname,subscribe_url')->find(); } $this->assign("kfinfo",$kfinfo); } //黑名单检测 protected function isuserstatus(){ $is = session('user_auth'); if($is){ $st = session('user_auth.status'); if($st==2){ $url = config('web_site_url').'/blacklist'; header('location:'.$url); } } } }