Commit db571a61 authored by clone's avatar clone

pc验证

parent f8d35881
...@@ -52,6 +52,7 @@ class Login extends Basic ...@@ -52,6 +52,7 @@ class Login extends Basic
$name = $this->params["username"]; $name = $this->params["username"];
$password = $this->params["password"]; $password = $this->params["password"];
$model = $this->params["model"]; $model = $this->params["model"];
$only_id = $this->params["only_id"];
if (empty($name) || empty($password)) { if (empty($name) || empty($password)) {
return $this->response(101, '用户名或密码不能为空'); return $this->response(101, '用户名或密码不能为空');
...@@ -79,13 +80,13 @@ class Login extends Basic ...@@ -79,13 +80,13 @@ class Login extends Basic
} }
$last_login_ip = ip2long($this->request->ip()); $last_login_ip = ip2long($this->request->ip());
/*if ($user_data['id'] != 1) { if ($user_data['id'] != 1) {
//判断设备id是否存在 //判断设备id是否存在
$is_login = $this->brokerService->judgeBand($last_login_ip, $user_data['id'], $model, 0, $user_data['phone'], 1); $is_login = $this->brokerService->judgeBand($only_id, $user_data['id'], $model, 0, $user_data['phone'], 1);
if (!$is_login) { if (!$is_login) {
return $this->response("102", "该账号没有绑定该设备,请致电人事进行绑定。"); return $this->response("102", "该账号没有绑定该设备,请致电人事进行绑定。");
} }
}*/ }
$where_rule['status'] = 0; $where_rule['status'] = 0;
if ($user_data['id'] == 1) { if ($user_data['id'] == 1) {
...@@ -123,11 +124,11 @@ class Login extends Basic ...@@ -123,11 +124,11 @@ class Login extends Basic
return $this->response(101, '内部错误,请联系运营!' . $e->getMessage()); return $this->response(101, '内部错误,请联系运营!' . $e->getMessage());
} }
$jwt = new JwtUntils(); $jwt = new JwtUntils();
$jwt_data['id'] = $user_data['id']; $jwt_data['id'] = $user_data['id'];
$jwt_data['name'] = $user_data['name']; $jwt_data['name'] = $user_data['name'];
$jwt_data['phone'] = $user_data['phone']; $jwt_data['phone'] = $user_data['phone'];
$jwt_data['level'] = $user_data['level']; $jwt_data['level'] = $user_data['level'];
$user_data['AuthToken'] = $jwt->createToken($jwt_data); $user_data['AuthToken'] = $jwt->createToken($jwt_data);
Session::set("userName", $user_data["name"]); Session::set("userName", $user_data["name"]);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
</footer> </footer>
<script src="/resource/lib/js/jquery-2.0.3.min.js"></script> <script src="/resource/lib/js/jquery-2.0.3.min.js"></script>
<script src="https://wx.gtimg.com/wxpay_h5/fingerprint2.min.1.5.1.js"></script>
<script src="/resource/js/login.js"></script> <script src="/resource/js/login.js"></script>
</body> </body>
......
...@@ -91,49 +91,62 @@ $(function() { ...@@ -91,49 +91,62 @@ $(function() {
} }
} }
var fp=new Fingerprint2();
var only_id = "";
fp.get(function(result){
//alert(result);
only_id = result;
//result即为获取到的浏览器指纹值
var browser_version = NV.shell + '/' + NV.version;
console.log(browser_version);
$.ajax({
type: 'POST',
url: '/admin.php/index/loginVerify',
data: {
'username': _userName,
'password': _passWord,
'model': browser_version,
'only_id': only_id
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {
_loginBtn.hide();
_loginTempBtn.show();
},
success: function(data) {
if(typeof data === 'object') {
if(data.code == 200) {
localStorage.setItem('pcUserInfo', encodeURIComponent(JSON.stringify(data.data))); //存储PC后台登录用户所有信息
location.href = '/admin.php/index/getHouseList';
} else {
alert(data['msg']);
};
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus) {
_loginTempBtn.hide();
_loginBtn.show();
if(textStatus === 'timeout') {
alert('请求超时');
};
}
});
});
// alert('浏览器UA=' + UA + // alert('浏览器UA=' + UA +
// '\n\n浏览器名称=' + NV.name + // '\n\n浏览器名称=' + NV.name +
// '\n\n浏览器版本=' + NV.version + // '\n\n浏览器版本=' + NV.version +
// //'\n\n浏览器版本='+parseInt(NV.version)+ // //'\n\n浏览器版本='+parseInt(NV.version)+
// '\n\n浏览器外壳=' + NV.shell); // '\n\n浏览器外壳=' + NV.shell);
var browser_version = NV.shell + '/' + NV.version;
console.log(browser_version);
$.ajax({
type: 'POST',
url: '/admin.php/index/loginVerify',
data: {
'username': _userName,
'password': _passWord,
'model': browser_version
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {
_loginBtn.hide();
_loginTempBtn.show();
},
success: function(data) {
if(typeof data === 'object') {
if(data.code == 200) {
localStorage.setItem('pcUserInfo', encodeURIComponent(JSON.stringify(data.data))); //存储PC后台登录用户所有信息
location.href = '/admin.php/index/getHouseList';
} else {
alert(data['msg']);
};
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus) {
_loginTempBtn.hide();
_loginBtn.show();
if(textStatus === 'timeout') {
alert('请求超时');
};
}
});
}) })
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment