mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-05-25 06:26:47 +08:00
modified Ajax提交的状态码识别异常的BUG
finish 数据模型自动完成和数据增删改查的适配
This commit is contained in:
parent
9a957a4692
commit
848a121689
@ -10,7 +10,7 @@ use think\Controller;
|
||||
|
||||
class Base extends Controller {
|
||||
|
||||
protected $primaryKey;
|
||||
public $primaryKey;
|
||||
|
||||
public function _initialize(){
|
||||
$this->primaryKey = config('SQL_PRIMARY_KEY');
|
||||
|
@ -32,21 +32,18 @@ class User extends Base {
|
||||
return $this->error('用户名或者密码错误!');
|
||||
}else{
|
||||
if( $userInfo['status'] ){
|
||||
|
||||
//保存用户信息和登录凭证
|
||||
cache($userInfo[$this->primaryKey], session_id(), config('online_time'));
|
||||
session('uid', $userInfo[$this->primaryKey]);
|
||||
|
||||
cache($userInfo[$this->primaryKey], session_id(), config('online_time'));
|
||||
//获取跳转链接,做到从哪来到哪去
|
||||
if( $request->has('from', 'get') ){
|
||||
$url = $request->get('from');
|
||||
}else{
|
||||
$url = url('Index/index');
|
||||
}
|
||||
|
||||
//更新用户数据
|
||||
$userData = UserData::get(['uid' => $userInfo[$this->primaryKey]]);
|
||||
if( $userData->uid ){
|
||||
if( $userData ){
|
||||
$userData->loginTimes += 1;
|
||||
$userData->save();
|
||||
}else{
|
||||
@ -55,7 +52,6 @@ class User extends Base {
|
||||
$newUserData->uid = $userInfo[$this->primaryKey];
|
||||
$newUserData->save();
|
||||
}
|
||||
|
||||
return $this->success('登录成功', $url);
|
||||
}else{
|
||||
return $this->error('用户已被封禁,请联系管理员');
|
||||
|
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">
|
||||
<span class="label label-info">请填写您的账号和密码</span>
|
||||
<span class="label label-info">请填写您的账号和密码(admin/123123)</span>
|
||||
</p>
|
||||
|
||||
<form action="{:url('User/login')}" id="form-login">
|
||||
|
9
public/static/admin/dist/js/template.js
vendored
9
public/static/admin/dist/js/template.js
vendored
@ -31,7 +31,7 @@
|
||||
});
|
||||
setTimeout(function(){
|
||||
dialog.modal('hide');
|
||||
}, 2000);
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
$.buildDom = function ( jsonStr ) {
|
||||
@ -87,20 +87,21 @@
|
||||
query = form.serialize();
|
||||
target = form.attr('action');
|
||||
$.post(target, query).success(function(data) {
|
||||
if (data.status == 1) {
|
||||
if (data.code == 1) {
|
||||
if (data.url) {
|
||||
message = data.msg + ' 页面即将自动跳转~';
|
||||
message = data.msg + ' 页面即将自动跳转...';
|
||||
} else {
|
||||
message = data.msg;
|
||||
}
|
||||
$.alertMsg(message);
|
||||
var wait = 1000*data.wait;
|
||||
setTimeout(function() {
|
||||
if (data.url) {
|
||||
location.href = data.url;
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
}, 2000);
|
||||
}, wait);
|
||||
} else {
|
||||
$.alertMsg(data.msg);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user