Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
d1138832b3be94a064c282bcc1fbbee34d536a8c
1 parent
cab2a402
do test generate static html to page cache
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
8 deletions
library/Action/AbstractAction.php
library/Plugin/DataProcess/FloorProcess.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
library/Action/AbstractAction.php
View file @
d113883
...
...
@@ -25,6 +25,12 @@ class AbstractAction extends Controller_Abstract
* @var object
*/
protected
$_request
;
/**
* 用户相关信息
*/
protected
$_uid
;
protected
$_uname
;
/**
* 初始化
...
...
@@ -144,7 +150,7 @@ class AbstractAction extends Controller_Abstract
* @param integer $path cookie可用的路径
* @param string $domain cookie可用域名
*/
protected
function
setCookie
(
$name
,
$value
,
$expire
=
0
,
$path
=
'/'
,
$domain
=
'
yohobuy.com'
)
protected
function
setCookie
(
$name
,
$value
,
$expire
=
0
,
$path
=
'/'
,
$domain
=
'.
yohobuy.com'
)
{
setcookie
(
$name
,
$value
,
$expire
,
$path
,
$domain
);
}
...
...
@@ -158,7 +164,7 @@ class AbstractAction extends Controller_Abstract
*/
protected
function
getCookie
(
$name
,
$default
=
''
)
{
return
$this
->
request
->
getCookie
(
$name
,
$default
);
return
$this
->
_
request
->
getCookie
(
$name
,
$default
);
}
/**
...
...
@@ -198,7 +204,17 @@ class AbstractAction extends Controller_Abstract
*/
protected
function
getUid
()
{
return
0
;
if
(
!
$this
->
_uid
)
{
$cookie
=
$this
->
getCookie
(
'_UID'
);
if
(
!
empty
(
$cookie
))
{
$cookieList
=
explode
(
'::'
,
$cookie
);
if
(
isset
(
$cookieList
[
1
])
&&
is_numeric
(
$cookieList
))
{
$this
->
_uid
=
$cookieList
[
1
];
$this
->
_uname
=
$cookieList
[
0
];
}
}
}
return
$this
->
_uid
;
}
/**
...
...
@@ -215,6 +231,26 @@ class AbstractAction extends Controller_Abstract
}
return
$udid
;
}
/**
* 获取当前登录的用户名字
*
* @return int
* @todo
*/
protected
function
getUname
()
{
if
(
!
$this
->
_uname
)
{
$cookie
=
$this
->
getCookie
(
'_UID'
);
if
(
!
empty
(
$cookie
))
{
$cookieList
=
explode
(
'::'
,
$cookie
);
if
(
isset
(
$cookieList
[
0
]))
{
$this
->
_uname
=
$cookieList
[
0
];
}
}
}
return
$this
->
_uname
;
}
/*
* 设置网站SEO的标题
...
...
@@ -284,17 +320,18 @@ class AbstractAction extends Controller_Abstract
$footer
=
array
();
// 已登录 @todo
if
(
false
)
{
$name
=
$this
->
getUname
();
if
(
!
empty
(
$name
))
{
$footer
[
'user'
]
=
array
();
$footer
[
'user'
][
'name'
]
=
'goodboy'
;
// 昵称
$footer
[
'user'
][
'name'
]
=
$name
;
// 昵称
$footer
[
'user'
][
'url'
]
=
''
;
// 个人中心链接
$footer
[
'user'
][
'signoutUrl'
]
=
''
;
// 登出链接
$footer
[
'user'
][
'signoutUrl'
]
=
'
/passport/login/out
'
;
// 登出链接
}
// 未登录
else
{
$footer
=
array
();
$footer
[
'loginUrl'
]
=
'/signin.html'
;
// 登录链接
$footer
[
'signupUrl'
]
=
'/
login
.html'
;
// 注册链接
$footer
[
'signupUrl'
]
=
'/
reg
.html'
;
// 注册链接
}
$this
->
_view
->
assign
(
'pageFooter'
,
$footer
);
...
...
library/Plugin/DataProcess/FloorProcess.php
View file @
d113883
...
...
@@ -22,7 +22,6 @@ class FloorProcess
}
foreach
(
$data
[
'list'
]
as
$v
){
$fun
=
$v
[
'template_name'
];
$data
=
self
::
$fun
(
$v
[
'data'
],
$type
);
if
(
empty
(
$data
)){
continue
;
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
View file @
d113883
...
...
@@ -59,6 +59,18 @@ class LoginController extends AbstractAction
// 渲染模板
$this
->
_view
->
display
(
'interational'
,
$data
);
}
/**
* 退出
*
* @todo
*/
public
function
outAction
()
{
$this
->
setCookie
(
'_UID'
,
''
);
headers_sent
()
||
header
(
'Location: /'
);
}
/**
* 登录操作
...
...
Please
register
or
login
to post a comment