公众号有些用户存在跳转页面不正常

一个公号号,不同的用户,在点击同一个按钮会跳转到不同的页面。
跳转正确的是没有问题的,但是不正确的跳转像是发生了没有获取到openid从而强制跳转的。

public function __construct()
{

    $openid = Session::get('openid');
    if($openid){
        $par_stu = new ParStu();
        $res = $par_stu->where('openid',$openid)->count();
        if($res){

        }else{
            redirect('http://zhbxsq.jiazhouedu.com.cn/binding')->send();
        }
    }else{
        WeChat::getOpenid();
    }
}

这些是关于获取openid和强制跳转的代码。
并且只有这一个页面有问题,别的页面跳转都正常
阅读 1.4k
1 个回答

public function __construct()

{
    // old Code
    // $openid = Session::get('openid');
    // if($openid){
    //     $par_stu = new ParStu();
    //     $res = $par_stu->where('openid',$openid)->count();
    //     if($res){

    //     }else{
    //         redirect('http://zhbxsq.jiazhouedu.com.cn/binding')->send();
    //     }
    // }else{
    //     WeChat::getOpenid();
    // }

    // new Code
    if(Session::has('openid')){
        $openid = Session::get('openid');
        $binding = new Bindings();
        $res = $binding->where('openid',$openid)->count();
        if($res){

        }else{
            redirect('http://zhbxsq.jiazhouedu.com.cn/binding')->send();
        }
    }else{
        WeChat::getOpenid();
    }
}
推荐问题