Beispiel #1
0
 public function before()
 {
     parent::before();
     $flag = $this->getNotOpenidAllowed();
     if ($flag) {
         return;
     }
     if (!\Session::get('wechat', false) && !\Input::get('openid', false)) {
         //获取到openid之后跳转的参数列表
         //$params = \handler\mp\UrlTool::createLinkstring(\Input::get());
         //本站域名
         $baseUrl = \Config::get('base_url');
         $url = $baseUrl . \Input::server('REQUEST_URI');
         $toUrl = urlencode($url);
         $callback = "{$baseUrl}wxapi/oauth2_callback?to_url={$toUrl}";
         $account = \Session::get('WXAccount', \Model_WXAccount::find(1));
         $url = \handler\mp\Tool::createOauthUrlForCode($account->app_id, $callback);
         \Response::redirect($url);
     } else {
         if (!\Session::get('wechat', false)) {
             $wxopenid = \Model_WechatOpenid::query()->where(['openid' => \Input::get('openid')])->get_one();
             if (!$wxopenid) {
                 \Session::set_flash('msg', ['status' => 'err', 'msg' => '未找到您的微信信息,无法确认您的身份! 系统无法为您提供服务!', 'title' => '拒绝服务']);
                 return $this->show_mesage();
             }
             \Session::set('wechat', $wxopenid->wechat);
             \Session::set('OpenID', $wxopenid);
             \Auth::force_login($wxopenid->wechat->user_id);
         } else {
             if (!\Auth::check() && \Session::get('wechat')->user_id) {
                 \Auth::force_login(\Session::get('wechat')->user_id);
             }
         }
     }
 }
Beispiel #2
0
 public function before()
 {
     parent::before();
     if (!\Auth::check() && !$this->getNotLoginAllowed()) {
         \Response::redirect('/ucenter/login?to_url=' . \Input::uri());
     }
 }
Beispiel #3
0
 public function __construct()
 {
     parent::__construct();
     // validate admin logged in
     if (\Model_Accounts::isAdminLogin() == false) {
         \Response::redirect(\Uri::create('admin/login') . '?rdr=' . urlencode(\Uri::main()));
     }
     // load global admin language
     \Lang::load('admin');
 }
Beispiel #4
0
 public function before()
 {
     parent::before();
     /*if( ! \Session::get('store', false)){
           $store = \Model_Store::find(1);
           if( ! $store){
               die();
           }
           \Session::set('store', $store);
       }*/
 }
Beispiel #5
0
 public function before()
 {
     parent::before();
     if ($this->getNotOpenidAllowed()) {
         return;
     }
     if (!\Agent::is_mobiledevice()) {
         $this->theme = 'mobile';
         $this->template->set_filename('mobile/template');
     }
     if (!\Auth::check()) {
         \Response::redirect('/admin/login');
     }
     // 检测是否后台帐户
     if (!\Session::get('employee', false) && \Auth::get_user()->username != 'admin') {
         \Auth::logout();
         \Response::redirect('/admin/login');
     }
 }
Beispiel #6
0
 public function before()
 {
     parent::before();
 }
Beispiel #7
0
 public function __construct()
 {
     parent::__construct();
     // load language
     \Lang::load('account');
 }
Beispiel #8
0
 public function before()
 {
     parent::before();
     //\Session::set('seller', \Model_Seller::find(1));
 }
Beispiel #9
0
 public function __construct()
 {
     parent::__construct();
     // load language
     \Lang::load('blog::blog');
 }
Beispiel #10
0
 public function before()
 {
     parent::before();
     \View::set_global(['controller_name' => '拍品管理']);
 }
Beispiel #11
0
 public function before()
 {
     parent::before();
     \Auth::force_login(1);
 }
Beispiel #12
0
 public function before()
 {
     parent::before();
     $params = array('controller_name' => '微信公众号管理');
     \View::set_global($params);
 }