qrcode.php

<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="description" content="WEB,微信機器人" />
<meta name="keywords" content="微信機器人" />
<title>WEB,微信機器人</title>
<script type="text/javascript" src='static/jquery-1.7.2.js'></script>
</head>
<body>
<h3 align="center">波弟讓你的微信成爲智能機器人</h3>
<p align="center"><img src="<?php echo $qrcode; ?>" /></p>
<p align="center" class="notice">請掃描二維碼登陸</p>
<form action="index.php?act=cookies" method="post"><input type="hidden" name="url" value=""></form>
</body>
<script type="text/javascript">
//將用戶uuid存入本地緩存
var uuid = "<?php echo $uuid; ?>";
sessionStorage.uuid = uuid;
getLoginStatus();
//var state = setInterval("getLoginStatus()",3000);
function getLoginStatus(){
$.ajax({
url: 'index.php?act=status&uuid=' + uuid,
data: '',
dataType: 'json',
success: function(data){
if(data.status == 1){
getLoginStatus();
$(".notice").html('掃描成功,請確認登陸');
}else if (data.status == 2) {
//&fun=new&version=v2&lang=zh_CN 不加的話會返回1101錯誤代碼
$.post('index.php?act=cookies',{url:data.msg + '&fun=new&version=v2&lang=zh_CN'},function(res){
console.log(res);
if (res.status == 0){
alert(res.msg);
}else{
//將用戶wxuin,wxsid存入本地緩存
var wxuin = res.uin;
var wxsid = res.sid;
sessionStorage.wxuin = wxuin;
sessionStorage.wxsid = wxsid;
//獲取成功,跳轉
window.location.href = 'index.php?act=chat';
}

},'json')

}else{
$(".notice").html('請掃描二維碼確認登陸');
getLoginStatus();
}
},
error: function(data){
getLoginStatus();
console.log('獲取登陸狀態錯誤');
}

})
}
</script>
</html>javascript

相關文章
相關標籤/搜索