18910140161

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

顺晟科技

2022-09-15 14:41:48

226

一个公号号,不同的用户,在点击同一个按钮会跳转到不同的页面。
跳转正确的是没有问题的,但是不正确的跳转像是发生了没有获取到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和强制跳转的代码。
并且只有这一个页面有问题,别的页面跳转都正常

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();
    }
}
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航