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
fce6fa83
Commit
fce6fa83
authored
Dec 26, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登陆验证
parent
6f22e973
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
Login.php
application/index/controller/Login.php
+7
-1
AdminModel.php
application/model/AdminModel.php
+9
-1
No files found.
application/index/controller/Login.php
View file @
fce6fa83
...
...
@@ -30,6 +30,10 @@ class Login extends Basic
return
view
(
"/login/login"
);
}
/**
* 登陆验证
* @return \think\response\View
*/
public
function
loginVerify
()
{
$name
=
$_POST
[
"username"
];
...
...
@@ -41,8 +45,10 @@ class Login extends Basic
$params
[
"pswd"
]
=
md5
(
md5
(
$passwd
));
$result
=
$this
->
loginDb
->
verifyUser
(
$params
);
//todo 更新登录信息
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
());
...
...
application/model/AdminModel.php
View file @
fce6fa83
...
...
@@ -17,7 +17,8 @@ class AdminModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'u_admin'
;
protected
$db
;
protected
$db
;
public
function
__construct
()
{
$this
->
db
=
Db
::
table
(
$this
->
table
);
...
...
@@ -30,4 +31,10 @@ class AdminModel extends Model
->
select
();
}
public
function
updateLoginTime
(
$id
)
{
$param
[
"last_login_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$this
->
save
(
$param
,
$id
);
}
}
\ No newline at end of file
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