微信开发苹果手机和安卓手机在朋友圈分享链接时出现的问题

来源:互联网 发布:游标卡尺的数据异常值 编辑:程序博客网 时间:2024/05/16 20:10

由于苹果手机和安卓手机分享链接时的按钮不同,所以分享出来的链接也就不同,安卓手机分享链接时会自动的将获取openid的后缀给编译进去,但是苹果手机分享链接时则不会出现,由于项目上线中问题比较紧,所以临时想出来的方法是在点击链接进入controller中进行拼接

           Integer id=Integer.parseInt(request.getParameter("id"));
            String canshu=request.getParameter("canshu");
            if(request.getSession().getAttribute(Constants.OPENID) == null){
                String appId = "";//公共号
                String tp_url = "http://www.startmath123.com.cn/evt/tpjg.htm?id="+id;
                if(StringUtils.isNotEmpty(canshu)){
                    
                    tp_url += "&canshu="+canshu;
                }
                String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appId + "&redirect_uri=" + URLEncoder.encode(tp_url,"UTF-8") +"&response_type=code&scope=snsapi_userinfo&state=SUNNETWX#wechat_redirect";
                return new ModelAndView("redirect:"+url);
            }else{


阅读全文
0 0
原创粉丝点击