Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
e47fbdb9
Commit
e47fbdb9
authored
Mar 06, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改登录
parent
4c19fb6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
Login.php
application/index/controller/Login.php
+28
-2
No files found.
application/index/controller/Login.php
View file @
e47fbdb9
...
...
@@ -3,6 +3,7 @@
namespace
app\index\controller
;
use
app\index\extend\Basic
;
use
app\model\AdminModel
;
use
app\model\Agents
;
use
app\model\AuthRule
;
use
think\Session
;
...
...
@@ -24,6 +25,7 @@ class Login extends Basic
parent
::
__construct
(
$request
);
$this
->
loginAgent
=
new
Agents
();
$this
->
authRule
=
new
AuthRule
();
$this
->
loginDb
=
new
AdminModel
();
}
public
function
login
()
...
...
@@ -40,8 +42,32 @@ class Login extends Basic
*/
public
function
loginVerify
()
{
$name
=
$_POST
[
"username"
];
$passwd
=
$_POST
[
"passwd"
];
if
(
!
isset
(
$name
)
||
!
isset
(
$passwd
))
{
return
view
(
"/login/login"
,
[
"msg"
=>
"用户名或密码不能为空"
]);
}
$params
[
"name"
]
=
$name
;
$params
[
"pswd"
]
=
md5
(
$passwd
);
$result
=
$this
->
loginDb
->
verifyUser
(
$params
);
if
(
count
(
$result
)
>
0
)
{
//todo 更新登录信息
$this
->
loginDb
->
updateLoginTime
(
$result
[
0
][
"id"
]);
Session
::
set
(
"userName"
,
$result
[
0
][
"name"
]);
Session
::
set
(
"userId"
,
$result
[
0
][
"id"
]);
Session
::
set
(
"lastLoginTime"
,
time
());
$this
->
operating_records
(
$result
[
0
][
"id"
],
1
,
'后台登陆'
);
//记录操作日志
// $this->redirect('/admin.php/index/banner');
// return view("/admin.php/index/banner", [ "msg" => "用户名或密码错误" ]);
return
$this
->
response
(
'200'
,
'登录成功'
);
}
else
{
// return view("/login/login", [ "msg" => "用户名或密码错误" ]);
return
$this
->
response
(
'101'
,
'用户名或密码错误'
);
}
$name
=
$this
->
request
->
param
(
"username"
);
/*
$name = $this->request->param("username");
$password = $this->request->param("passwd");
if (!isset($name) || !isset($password)) {
...
...
@@ -126,7 +152,7 @@ class Login extends Basic
return $this->response('200', '登录成功', $data);
}else {
$this->redirect('/admin.php/'.$url);
}
}
*/
// }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment