Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
f37ae1de931faac93dec6d00c6811b20ab8f3fe5
1 parent
852cc560
do register page
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
335 additions
and
53 deletions
library/Action/AbstractAction.php
library/Plugin/Helpers.php
template/m.yohobuy.com/partials/layout/header.phtml
yohobuy/m.yohobuy.com/application/modules/Guang/controllers/Plusstar.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Reg.php
library/Action/AbstractAction.php
View file @
f37ae1d
...
...
@@ -132,5 +132,89 @@ class AbstractAction extends Controller_Abstract
exit
;
}
/**
* 设置网站SEO的标题
*
* @param string $title 标题
* @return void
*/
protected
function
setTitle
(
$title
)
{
$this
->
_view
->
assign
(
'title'
,
$title
);
}
/**
* 设置网站SEO的关键词
*
* @param string $keywords 关键词,多个之间用","逗号分隔
* @return void
*/
protected
function
setKeywords
(
$keywords
)
{
$this
->
_view
->
assign
(
'keywords'
,
$keywords
);
}
/**
* 设置网站SEO的描述内容
*
* @param string $description 描述内容
* @return void
*/
protected
function
setDescription
(
$description
)
{
$this
->
_view
->
assign
(
'description'
,
$description
);
}
/**
* 设置网站导航头部信息
*
* @param string $backUrl 返回的链接
* @param string $title 头部标题
* @param string $homeUrl 返回首页的链接
* @return void
*/
protected
function
setNavHeader
(
$backUrl
,
$title
,
$homeUrl
)
{
$header
=
array
();
if
(
!
empty
(
$backUrl
))
{
$header
[
'pageHeader'
][
'navBack'
]
=
$backUrl
;
}
if
(
!
empty
(
$title
))
{
$header
[
'pageHeader'
][
'navTitle'
]
=
$title
;
}
if
(
!
empty
(
$homeUrl
))
{
$header
[
'pageHeader'
][
'navHome'
]
=
$homeUrl
;
}
$this
->
_view
->
assign
(
'header'
,
$header
);
}
/**
* 设置网站导航底部信息
*
* @return void
*/
protected
function
setNavFooter
()
{
$footer
=
array
();
// 已登录 @todo
if
(
false
)
{
$footer
[
'pageFooter'
][
'user'
]
=
array
();
$footer
[
'pageFooter'
][
'user'
][
'name'
]
=
'goodboy'
;
// 昵称
$footer
[
'pageFooter'
][
'user'
][
'url'
]
=
''
;
// 个人中心链接
$footer
[
'pageFooter'
][
'user'
][
'signoutUrl'
]
=
''
;
// 登出链接
}
// 未登录
else
{
$footer
[
'pageFooter'
]
=
array
();
$footer
[
'pageFooter'
][
'loginUrl'
]
=
''
;
// 登录链接
$footer
[
'pageFooter'
][
'signupUrl'
]
=
''
;
// 注册链接
}
$this
->
_view
->
assign
(
'footer'
,
$footer
);
}
}
...
...
library/Plugin/Helpers.php
View file @
f37ae1d
...
...
@@ -46,31 +46,46 @@ class Helpers
$result
[
'name'
]
=
$productData
[
'product_name'
];
$result
[
'price'
]
=
$productData
[
'market_price'
];
$result
[
'salePrice'
]
=
$productData
[
'sales_price'
];
$result
[
'isFew'
]
=
(
$productData
[
'is_soon_sold_out'
]
===
'Y'
)
?
true
:
false
;
$result
[
'isFew'
]
=
(
$productData
[
'is_soon_sold_out'
]
===
'Y'
);
$result
[
'url'
]
=
''
;
// @todo
$result
[
'tags'
]
=
array
(
'isNew'
=>
false
,
// 新品
'isSale'
=>
false
,
// 在售
'isLimit'
=>
false
,
// 限量
'isNewFestival'
=>
false
,
// 新品节
'isReNew'
=>
false
,
// 再到着
'isYohood'
=>
false
,
// YOHOOD
'midYear'
=>
false
,
// 年中
'yearEnd'
=>
false
,
// 年末
);
foreach
(
$productData
[
'tags'
]
as
$tag
)
{
if
(
$tag
[
'is_limited'
]
===
'Y'
)
{
$result
[
'tags'
][
'isLimit'
]
=
true
;
}
elseif
(
$tag
[
'is_yohood'
]
===
'Y'
)
{
$result
[
'tags'
][
'isYohood'
]
=
true
;
}
elseif
(
$tag
[
'is_new'
]
===
'Y'
)
{
$result
[
'tags'
][
'isNew'
]
=
true
;
}
}
$result
[
'tags'
]
=
array
();
$result
[
'tags'
][
'isNew'
]
=
isset
(
$productData
[
'is_new'
])
&&
$productData
[
'is_new'
]
===
'Y'
;
// 新品
$result
[
'tags'
][
'isSale'
]
=
isset
(
$productData
[
'is_discount'
])
&&
$productData
[
'is_discount'
]
===
'Y'
;
// 在售
$result
[
'tags'
][
'isLimit'
]
=
isset
(
$productData
[
'is_limited'
])
&&
$productData
[
'is_limited'
]
===
'Y'
;
// 限量
$result
[
'tags'
][
'isYohood'
]
=
isset
(
$productData
[
'is_yohood'
])
&&
$productData
[
'is_yohood'
]
===
'Y'
;
// YOHOOD
$result
[
'tags'
][
'midYear'
]
=
isset
(
$productData
[
'mid-year'
])
&&
$productData
[
'mid-year'
]
===
'Y'
;
// 年中
$result
[
'tags'
][
'yearEnd'
]
=
isset
(
$productData
[
'year-end'
])
&&
$productData
[
'year-end'
]
===
'Y'
;
// 年末
$result
[
'tags'
][
'isReNew'
]
=
false
;
// 再到着
$result
[
'tags'
][
'isNewFestival'
]
=
false
;
// 新品节
return
$result
;
}
/**
* 生成公开的TOKEN凭证
*
* @param string $string 字符串
* @return string
*/
public
static
function
makeToken
(
$string
)
{
return
md5
(
md5
(
$string
.
'#@!@#'
));
}
/**
* 验证TOKEN凭证
*
* @param string $string 字符串
* @param string $token 公开访问TOKEN
* @return bool
*/
public
static
function
verifyToken
(
$string
,
$token
)
{
if
(
$token
===
self
::
makeToken
(
$string
))
{
return
true
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/layout/header.phtml
View file @
f37ae1d
...
...
@@ -15,7 +15,6 @@
var
docEl
=
doc
.
documentElement
;
(
function
()
{
var
clientWidth
=
docEl
.
clientWidth
;
if
(
!
clientWidth
)
{
return
;
}
...
...
yohobuy/m.yohobuy.com/application/modules/Guang/controllers/Plusstar.php
View file @
f37ae1d
...
...
@@ -120,7 +120,7 @@ class PlusstarController extends AbstractAction
$data
[
'ps'
][
'name'
]
=
$brandInfo
[
'getBrandInfo'
][
'brand_name'
];
$data
[
'ps'
][
'isLike'
]
=
$brandInfo
[
'getUidBrandFav'
];
$data
[
'ps'
][
'likeUrl'
]
=
"http://guang.m.yohobuy.com/plustar/brandinfo?id=285&openby:yohobuy=
{
"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":285}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"701"}},"priority":"Y"}
}
"
;
$data
[
'ps'
][
'intro'
]
=
empty
(
$brandInfo
[
'
brand_intro'
])
?
''
:
strip_tags
(
$brandInfo
[
'brand_intro'
]
);
$data
[
'ps'
][
'intro'
]
=
empty
(
$brandInfo
[
'
getBrandInfo'
][
'brand_intro'
])
?
''
:
strtr
(
strip_tags
(
$brandInfo
[
'getBrandInfo'
][
'brand_intro'
]),
'nbsp;'
,
' '
);
$data
[
'ps'
][
'newArrival'
]
=
array
();
$data
[
'ps'
][
'newArrival'
][
'moreUrl'
]
=
''
;
// @todo
$data
[
'ps'
][
'newArrival'
][
'naList'
]
=
$brandInfo
[
'getNewProduct'
];
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Reg.php
View file @
f37ae1d
<?php
use
Action\AbstractAction
;
use
LibModels\Wap\Passport\RegData
;
use
Plugin\Helpers
;
/**
* 注册的控制器
*/
class
RegController
extends
AbstractAction
{
/**
* 注册页
*/
public
function
indexAction
()
{
$data
=
array
(
'backUrl'
=>
'm.yohobuy.com'
,
'headerText'
=>
'注册'
,
'isPassportPage'
=>
true
,
'modulePath'
=>
'passport/register/register'
,
'countrys'
=>
array
(
array
(
'areaCode'
=>
'+86'
,
'selected'
=>
true
,
'name'
=>
'中国'
),
array
(
'areaCode'
=>
'+864'
,
'name'
=>
'中国香港'
)
),
'countryCode'
=>
'+86'
);
$this
->
_view
->
assign
(
'title'
,
'注册'
);
$this
->
setTitle
(
'注册'
);
$data
=
array
();
$data
[
'backUrl'
]
=
'/'
;
$data
[
'headerText'
]
=
'注册'
;
$data
[
'isPassportPage'
]
=
true
;
$data
[
'countrys'
]
=
array
();
$area
=
RegData
::
getAreasData
();
if
(
!
empty
(
$area
[
'data'
]))
{
$build
=
array
();
foreach
(
$area
[
'data'
]
as
$value
)
{
$build
=
array
();
$build
[
'areaCode'
]
=
'+'
.
$value
[
'area'
];
$build
[
'selected'
]
=
$value
[
'area'
]
===
'86'
;
$build
[
'name'
]
=
$value
[
'name'
];
$data
[
'countrys'
][]
=
$build
;
}
}
else
{
$data
[
'countrys'
][
0
]
=
array
();
$data
[
'countrys'
][
0
][
'areaCode'
]
=
'+86'
;
$data
[
'countrys'
][
0
][
'selected'
]
=
true
;
$data
[
'countrys'
][
0
][
'name'
]
=
'中国'
;
}
$this
->
_view
->
display
(
'index'
,
$data
);
$data
=
array
();
$area
=
array
();
}
/**
* 验证码
*
* @param string area 地区编号
* @param string mobile 手机号
* @param string token 访问TOKEN凭证
*/
public
function
codeAction
()
{
$data
=
array
(
'backUrl'
=>
'm.yohobuy.com'
,
'headerText'
=>
'注册'
,
'isPassportPage'
=>
true
,
'modulePath'
=>
'passport/register/code'
,
'areaCode'
=>
'+86'
,
'phoneNum'
=>
'15895869035'
);
$token
=
$this
->
get
(
'token'
);
$mobile
=
$this
->
get
(
'mobile'
);
$area
=
$this
->
get
(
'area'
,
'86'
);
// 判断是否允许访问, 不允许则跳转到错误页面
if
(
!
is_string
(
$token
)
||
!
is_numeric
(
$mobile
)
||
!
Helpers
::
verifyToken
(
$mobile
,
$token
))
{
$this
->
error
();
}
$this
->
setTitle
(
'注册-验证码'
);
$data
=
array
();
$data
[
'backUrl'
]
=
'/'
;
$data
[
'headerText'
]
=
'注册'
;
$data
[
'isPassportPage'
]
=
true
;
$data
[
'areaCode'
]
=
$area
;
$data
[
'phoneNum'
]
=
$mobile
;
$this
->
_view
->
assign
(
'title'
,
'注册-验证码'
);
$this
->
_view
->
display
(
'code'
,
$data
);
}
/**
* 填写密码页面
*
* @param string area 地区编号
* @param string mobile 手机号
* @param string token 访问TOKEN凭证
*/
public
function
passwordAction
()
{
$data
=
array
(
...
...
@@ -55,4 +93,150 @@ class RegController extends AbstractAction
$this
->
_view
->
assign
(
'title'
,
'注册-密码'
);
$this
->
_view
->
display
(
'password'
,
$data
);
}
/**
* 验证注册的手机号
*
* @param string area 地区编号,注意不需要+号
* @param string mobile 手机号
* @param string token 访问TOKEN凭证
* @return json
*/
public
function
verifymobileAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'参数不正确!'
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$token
=
$this
->
post
(
'token'
);
$mobile
=
$this
->
post
(
'mobile'
);
$area
=
$this
->
post
(
'area'
,
'86'
);
/* 判断参数是否合法 */
if
(
!
is_string
(
$token
)
||
!
is_numeric
(
$mobile
)
||
!
is_numeric
(
$area
))
{
break
;
}
/* 判断是否允许访问 */
if
(
!
Helpers
::
verifyToken
(
$mobile
,
$token
))
{
break
;
}
/* 向手机发送注册验证码 */
$data
=
RegData
::
sendCodeToMobile
(
$area
,
$mobile
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
/* 返回跳转到验证页面的链接*/
if
(
$data
[
'code'
]
==
200
)
{
$data
[
'data'
]
=
'/passport/reg/code?token='
.
$token
.
'&mobile='
.
$mobile
.
'&area='
.
$area
;
}
}
while
(
false
);
echo
$this
->
echoJson
(
$data
);
}
/**
* 验证注册的识别码
*
* @param string area 地区编号,注意不需要+号
* @param string mobile 手机号
* @param string token 访问TOKEN凭证
* @param int code 验证码, 手机上收到的
* @return json
*/
public
function
verifycodeAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'参数不正确!'
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$token
=
$this
->
post
(
'token'
);
$mobile
=
$this
->
post
(
'mobile'
);
$area
=
$this
->
post
(
'area'
);
$code
=
$this
->
post
(
'code'
);
/* 判断参数是否合法 */
if
(
!
is_string
(
$token
)
||
!
is_numeric
(
$mobile
)
||
!
is_numeric
(
$area
)
||
!
isset
(
$code
))
{
break
;
}
/* 判断是否允许访问 */
if
(
!
Helpers
::
verifyToken
(
$mobile
,
$token
))
{
break
;
}
/* 验证注册的标识码是否有效 */
$data
=
RegData
::
validMobileCode
(
$area
,
$mobile
,
$code
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
/* 返回跳转到设置密码的链接*/
if
(
$data
[
'code'
]
==
200
)
{
$data
[
'data'
]
=
'/passport/reg/password?token='
.
$token
.
'&mobile='
.
$mobile
.
'&area='
.
$area
;
}
}
while
(
false
);
echo
$this
->
echoJson
(
$data
);
}
/**
* 设置密码
*
* @param string area 地区编号,注意不需要+号
* @param string mobile 手机号
* @param string token 访问TOKEN凭证
* @param string password 用户设置的密码
* @return json
*/
public
function
setpasswordAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'参数不正确!'
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$token
=
$this
->
post
(
'token'
);
$mobile
=
$this
->
post
(
'mobile'
);
$area
=
$this
->
post
(
'area'
);
$password
=
$this
->
post
(
'password'
);
/* 判断参数是否合法 */
if
(
!
is_string
(
$token
)
||
!
is_numeric
(
$mobile
)
||
!
is_numeric
(
$area
)
||
!
isset
(
$password
))
{
break
;
}
/* 判断是否允许访问 */
if
(
!
Helpers
::
verifyToken
(
$mobile
,
$token
))
{
break
;
}
/* 验证注册的标识码是否有效 */
$data
=
RegData
::
regMobile
(
$area
,
$mobile
,
$password
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
/* 返回跳转到设置密码的链接*/
if
(
$data
[
'code'
]
==
200
)
{
$data
[
'data'
]
=
'/passport/reg/password?token='
.
$token
.
'&mobile='
.
$mobile
.
'&area='
.
$area
;
}
}
while
(
false
);
echo
$this
->
echoJson
(
$data
);
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment