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
6f22e973
Commit
6f22e973
authored
Dec 26, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台基类,bug修复
parent
35d606af
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
12 deletions
+51
-12
Shop.php
application/api/controller/Shop.php
+3
-0
Basic.php
application/api/extend/Basic.php
+1
-1
Banner.php
application/index/controller/Banner.php
+2
-2
Login.php
application/index/controller/Login.php
+5
-5
Basic.php
application/index/extend/Basic.php
+35
-0
footer_tpl.html
application/index/view/global/footer_tpl.html
+2
-2
main.js
public/resource/js/main.js
+3
-2
No files found.
application/api/controller/Shop.php
View file @
6f22e973
...
@@ -166,6 +166,9 @@ class Shop extends Basic
...
@@ -166,6 +166,9 @@ class Shop extends Basic
$result
[
"api_path"
]
=
IMG_PATH
;
$result
[
"api_path"
]
=
IMG_PATH
;
$param
[
"house_id"
]
=
$params
[
'id'
];
$param
[
"house_id"
]
=
$params
[
'id'
];
$result
[
"images"
]
=
$this
->
dbImg
->
getHouseImages
(
$param
,
15
);
$result
[
"images"
]
=
$this
->
dbImg
->
getHouseImages
(
$param
,
15
);
$param
[
"imgtype"
]
=
4
;
//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result
[
"plan_images"
]
=
$this
->
dbImg
->
getHouseImages
(
$param
,
4
);
if
(
$result
[
'room_num_left'
]
==
0
)
{
if
(
$result
[
'room_num_left'
]
==
0
)
{
return
$this
->
response
(
"101"
,
'此楼盘已下架'
);
return
$this
->
response
(
"101"
,
'此楼盘已下架'
);
}
}
...
...
application/api/extend/Basic.php
View file @
6f22e973
...
@@ -79,7 +79,7 @@ class Basic extends Controller
...
@@ -79,7 +79,7 @@ class Basic extends Controller
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
//
$this->tokenVerify();
$this
->
tokenVerify
();
}
}
}
}
...
...
application/index/controller/Banner.php
View file @
6f22e973
...
@@ -17,12 +17,12 @@ class Banner extends Basic
...
@@ -17,12 +17,12 @@ class Banner extends Basic
{
{
protected
$bannerModel
;
protected
$bannerModel
;
public
function
__construct
()
public
function
__construct
(
$request
=
null
)
{
{
parent
::
__construct
(
$request
);
$this
->
bannerModel
=
new
BannerModel
();
$this
->
bannerModel
=
new
BannerModel
();
}
}
/**
/**
* 查询banner列表
* 查询banner列表
* @return \think\Response
* @return \think\Response
...
...
application/index/controller/Login.php
View file @
6f22e973
...
@@ -27,7 +27,7 @@ class Login extends Basic
...
@@ -27,7 +27,7 @@ class Login extends Basic
public
function
login
()
public
function
login
()
{
{
return
view
(
"login/login"
);
return
view
(
"
/
login/login"
);
}
}
public
function
loginVerify
()
public
function
loginVerify
()
...
@@ -35,7 +35,7 @@ class Login extends Basic
...
@@ -35,7 +35,7 @@ class Login extends Basic
$name
=
$_POST
[
"username"
];
$name
=
$_POST
[
"username"
];
$passwd
=
$_POST
[
"passwd"
];
$passwd
=
$_POST
[
"passwd"
];
if
(
!
isset
(
$name
)
||
!
isset
(
$passwd
))
{
if
(
!
isset
(
$name
)
||
!
isset
(
$passwd
))
{
return
view
(
"login/login"
,
[
"msg"
=>
"用户名或密码不能为空"
]);
return
view
(
"
/
login/login"
,
[
"msg"
=>
"用户名或密码不能为空"
]);
}
}
$params
[
"name"
]
=
$name
;
$params
[
"name"
]
=
$name
;
$params
[
"pswd"
]
=
md5
(
md5
(
$passwd
));
$params
[
"pswd"
]
=
md5
(
md5
(
$passwd
));
...
@@ -45,11 +45,11 @@ class Login extends Basic
...
@@ -45,11 +45,11 @@ class Login extends Basic
if
(
count
(
$result
)
>
0
)
{
if
(
count
(
$result
)
>
0
)
{
Session
::
set
(
"userName"
,
$result
[
0
][
"name"
]);
Session
::
set
(
"userName"
,
$result
[
0
][
"name"
]);
Session
::
set
(
"userId"
,
$result
[
0
][
"id"
]);
Session
::
set
(
"userId"
,
$result
[
0
][
"id"
]);
Session
::
set
(
"lastLoginTime"
,
$result
[
0
][
"last_login_time"
]
);
Session
::
set
(
"lastLoginTime"
,
time
()
);
$this
->
redirect
(
'
banner
/banner'
);
$this
->
redirect
(
'
/index
/banner'
);
}
else
{
}
else
{
return
view
(
"login/login"
,
[
"msg"
=>
"用户名或密码错误"
]);
return
view
(
"
/
login/login"
,
[
"msg"
=>
"用户名或密码错误"
]);
}
}
}
}
...
...
application/index/extend/Basic.php
View file @
6f22e973
...
@@ -12,6 +12,7 @@ namespace app\index\extend;
...
@@ -12,6 +12,7 @@ namespace app\index\extend;
use
think\Controller
;
use
think\Controller
;
use
think\Request
;
use
think\Request
;
use
think\Response
;
use
think\Response
;
use
think\Session
;
class
Basic
extends
Controller
class
Basic
extends
Controller
{
{
...
@@ -23,6 +24,17 @@ class Basic extends Controller
...
@@ -23,6 +24,17 @@ class Basic extends Controller
public
$params
;
public
$params
;
public
$userName
;
public
$userId
;
public
$lastLoginTime
;
protected
$filterVerify
=
array
(
"index/login"
,
"index/loginVerify"
,
);
/**
/**
* 基础接口SDK
* 基础接口SDK
* @param Request|null $request
* @param Request|null $request
...
@@ -39,9 +51,32 @@ class Basic extends Controller
...
@@ -39,9 +51,32 @@ class Basic extends Controller
}
elseif
(
strtoupper
(
$this
->
request
->
method
())
===
"POST"
)
{
}
elseif
(
strtoupper
(
$this
->
request
->
method
())
===
"POST"
)
{
$this
->
params
=
$this
->
request
->
param
()
!=
null
?
$this
->
request
->
param
()
:
null
;
$this
->
params
=
$this
->
request
->
param
()
!=
null
?
$this
->
request
->
param
()
:
null
;
}
}
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
$this
->
userVerify
();
}
}
}
/**
* 验证登录时效
*/
public
function
userVerify
(){
$this
->
userName
=
Session
::
get
(
"userName"
);
$this
->
userId
=
Session
::
get
(
"userId"
);
$this
->
lastLoginTime
=
Session
::
get
(
"lastLoginTime"
);
if
(
empty
(
$this
->
userName
)
||
empty
(
$this
->
userId
)
||
empty
(
$this
->
lastLoginTime
)
){
$this
->
redirect
(
'/index/login'
);
}
//登录有效期为1小时
if
((
time
()
-
$this
->
lastLoginTime
)
>
7200
)
{
$this
->
redirect
(
'/index/login'
);
}
}
/**
/**
* 输出返回数据
* 输出返回数据
* @param string $msg 提示消息内容
* @param string $msg 提示消息内容
...
...
application/index/view/global/footer_tpl.html
View file @
6f22e973
<script
src=
'/resource/lib/js/require.min.js'
data-main=
'/resource/js/main?version=1111122'
charset=
'utf-8'
></script>
<script
src=
'/resource/lib/js/require.min.js'
data-main=
'/resource/js/main?version=111'
charset=
'utf-8'
></script>
\ No newline at end of file
\ No newline at end of file
public/resource/js/main.js
View file @
6f22e973
...
@@ -17,9 +17,9 @@ require.config ({
...
@@ -17,9 +17,9 @@ require.config ({
'paginationStart'
:
'lib/js/zw.pagination'
,
'paginationStart'
:
'lib/js/zw.pagination'
,
},
},
'shim'
:
{
'shim'
:
{
/*
'jquery': {
'jquery'
:
{
'exports'
:
'jquery'
'exports'
:
'jquery'
},
*/
},
'doT'
:
{
'doT'
:
{
'exports'
:
'doT'
'exports'
:
'doT'
},
},
...
@@ -30,6 +30,7 @@ require.config ({
...
@@ -30,6 +30,7 @@ require.config ({
'exports'
:
'ckfinderStart'
'exports'
:
'ckfinderStart'
},
},
'bootstrapJs'
:
{
'bootstrapJs'
:
{
'deps'
:
[
'jquery'
],
'exports'
:
'bootstrapJs'
'exports'
:
'bootstrapJs'
},
},
'datetimepicker'
:
{
'datetimepicker'
:
{
...
...
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