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
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
b85448f61909036940cc8ef99fe22b41289a6e61
2 parents
6d7a152c
dd35f099
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
229 additions
and
142 deletions
framework
library/Action/AbstractAction.php
library/Configs/CacheConfig.php
library/LibModels/Wap/Category/BrandData.php
library/Plugin/Helpers.php
static/js/common.js
static/js/index/search.js
static/js/product/list.js
static/js/product/newsale/discount.js
static/js/product/newsale/newarrival.js
static/sass/category/_brand.scss
static/sass/home/_maybe-like.scss
static/sass/layout/_footer.scss
template/m.yohobuy.com/actions/category/brand/index.phtml
yohobuy/m.yohobuy.com/application/controllers/Boys.php
yohobuy/m.yohobuy.com/application/controllers/Girls.php
yohobuy/m.yohobuy.com/application/controllers/Index.php
yohobuy/m.yohobuy.com/application/controllers/Kids.php
yohobuy/m.yohobuy.com/application/controllers/Lifestyle.php
yohobuy/m.yohobuy.com/application/controllers/Search.php
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
yohobuy/m.yohobuy.com/application/models/Category/Brand.php
yohobuy/m.yohobuy.com/application/models/Guang/Index.php
yohobuy/m.yohobuy.com/application/models/Guang/Plusstar.php
yohobuy/m.yohobuy.com/application/models/Index/Side.php
yohobuy/m.yohobuy.com/application/models/Product/List.php
yohobuy/m.yohobuy.com/application/modules/Guang/controllers/Plusstar.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php
framework
@
75bbc3b0
Subproject commit
119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit
75bbc3b075de19f239532f60c5995d06c5f814e2
...
...
library/Action/AbstractAction.php
View file @
b85448f
...
...
@@ -387,16 +387,4 @@ class AbstractAction extends Controller_Abstract
$this
->
_view
->
assign
(
'sideNav'
,
\Index\SideModel
::
getLeftNav
(
$guangChoosed
));
}
/**
* 设置首页以及频道页顶部信息
*
* @return void
*/
protected
function
setHomeChannelHeader
()
{
$header
[
'searchUrl'
]
=
'/search'
;
$this
->
_view
->
assign
(
'homeHeader'
,
$header
);
}
}
...
...
library/Configs/CacheConfig.php
View file @
b85448f
...
...
@@ -38,5 +38,6 @@ class CacheConfig
const
KEY_ACTION_PRODUCT_BRAND
=
'key_action_product_brand'
;
// 品类商品列表
const
KEY_ACTION_PRODUCT_BRAND_DOMAINS
=
'key_action_product_brand_domains'
;
// 所有品牌域名列表
const
KEY_ACTION_PRODUCT_BRAND_NAMES
=
'key_action_product_brand_names'
;
// 所有品牌名称列表
const
KEY_ACTION_PRODUCT_BRAND_LOGO
=
'key_action_product_brand_logo'
;
// 品牌信息
}
...
...
library/LibModels/Wap/Category/BrandData.php
View file @
b85448f
...
...
@@ -45,9 +45,9 @@ class BrandData
$param
[
'method'
]
=
'app.brand.brandlist'
;
$param
[
'yh_channel'
]
=
$channel
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
$urlList
[
'brandList'
]
=
Yohobuy
::
httpBuildQuery
(
Yohobuy
::
API_URL
,
$param
,
3600
);
// 有缓存1小时
$urlList
[
'brandList'
]
=
Yohobuy
::
httpBuildQuery
(
Yohobuy
::
API_URL
,
$param
);
return
Yohobuy
::
getMulti
(
$urlList
);
return
Yohobuy
::
getMulti
(
$urlList
,
array
(),
3600
);
// 有缓存1小时
}
/**
...
...
@@ -201,5 +201,16 @@ class BrandData
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 获取品牌LOGO信息
*
* @param int $id 用户ID
* @return array
*/
public
static
function
getBrandLogo
(
$id
)
{
return
Yohobuy
::
yarClient
(
Yohobuy
::
SERVICE_URL
.
'/shops/service/v1/brand'
,
'getBrandByids'
,
array
(
$id
));
}
}
...
...
library/Plugin/Helpers.php
View file @
b85448f
...
...
@@ -246,12 +246,21 @@ class Helpers
$result
[
'text'
]
=
$articleData
[
'intro'
];
$result
[
'publishTime'
]
=
$articleData
[
'publish_time'
];
$result
[
'pageView'
]
=
$articleData
[
'views_num'
];
$result
[
'like'
]
=
array
();
$result
[
'like'
][
'count'
]
=
$articleData
[
'praise_num'
];
$result
[
'like'
][
'isLiked'
]
=
isset
(
$articleData
[
'isPraise'
])
&&
$articleData
[
'isPraise'
]
===
'Y'
;
// 收藏
// $result['collect'] = array();
// $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y';
if
(
$isApp
)
{
$result
[
'collect'
]
=
array
();
$result
[
'collect'
][
'isCollected'
]
=
isset
(
$articleData
[
'isFavor'
])
&&
$articleData
[
'isFavor'
]
===
'Y'
;
$result
[
'collect'
][
'url'
]
=
$articleData
[
'url'
];
}
// 点赞
else
{
$result
[
'like'
]
=
array
();
$result
[
'like'
][
'count'
]
=
$articleData
[
'praise_num'
];
$result
[
'like'
][
'isLiked'
]
=
isset
(
$articleData
[
'isPraise'
])
&&
$articleData
[
'isPraise'
]
===
'Y'
;
}
// 分享链接
$result
[
'share'
]
=
$isApp
&&
isset
(
$articleData
[
'share'
][
'url'
])
?
$articleData
[
'share'
][
'url'
]
:
false
;
// 判断是否显示作者信息
...
...
static/js/common.js
View file @
b85448f
...
...
@@ -5,6 +5,10 @@
*/
var
$
=
require
(
'jquery'
);
var
$footer
=
$
(
'#yoho-footer'
);
var
FOOTERHEIGHT
=
120
;
//footer height
function
cookie
(
name
)
{
var
cookies
=
document
.
cookie
,
cookieVal
,
...
...
@@ -90,14 +94,26 @@ function getShoppingKey() {
return
JSON
.
parse
(
c
).
k
;
}
//根据页面内容重新设置通用底部的显示
function
rePosFooter
()
{
if
(
$footer
.
length
===
0
)
{
return
;
}
if
(
$
(
'body'
).
height
()
<
$
(
window
).
height
()
-
FOOTERHEIGHT
)
{
$footer
.
addClass
(
'bottom'
);
}
else
{
$footer
.
removeClass
(
'bottom'
);
}
}
//页面通用底部位置及status设置
(
function
()
{
var
$footer
=
$
(
'#yoho-footer'
),
$op
=
$footer
.
children
(
'.op-row'
);
var
$op
=
$footer
.
children
(
'.op-row'
);
var
user
=
getUser
();
if
(
$
(
'body'
).
height
()
<
$
(
window
).
height
())
{
if
(
$
(
'body'
).
height
()
<
$
(
window
).
height
()
-
FOOTERHEIGHT
)
{
$footer
.
addClass
(
'bottom'
);
}
...
...
@@ -132,3 +148,5 @@ window.getUser = getUser;
window
.
getUid
=
getUid
;
window
.
getShoppingKey
=
getShoppingKey
;
window
.
rePosFooter
=
rePosFooter
;
...
...
static/js/index/search.js
View file @
b85448f
...
...
@@ -61,7 +61,7 @@ cHammer.on('tap', function() {
continue
;
}
html
+=
'<li><a href="/?query='
+
history
+
'">'
+
history
+
'</li>'
;
html
+=
'<li><a href="
http://search.m.yohobuy.com
/?query='
+
history
+
'">'
+
history
+
'</li>'
;
}
$history
.
html
(
html
);
...
...
static/js/product/list.js
View file @
b85448f
...
...
@@ -213,6 +213,8 @@ function search(opt) {
searching
=
false
;
loading
.
hideLoadingMask
();
window
.
rePosFooter
();
}
});
...
...
static/js/product/newsale/discount.js
View file @
b85448f
...
...
@@ -218,6 +218,8 @@ function search(opt) {
searching
=
false
;
loading
.
hideLoadingMask
();
window
.
rePosFooter
();
}
});
...
...
static/js/product/newsale/newarrival.js
View file @
b85448f
...
...
@@ -244,6 +244,8 @@ function search(opt) {
searching
=
false
;
loading
.
hideLoadingMask
();
window
.
rePosFooter
();
}
});
...
...
static/sass/category/_brand.scss
View file @
b85448f
...
...
@@ -16,17 +16,25 @@
border-radius
:
30rem
/
$pxConvertRem
;
padding
:
0
32rem
/
$pxConvertRem
0
52rem
/
$pxConvertRem
;
.search-input
{
a
{
width
:
100%
;
height
:
60rem
/
$pxConvertRem
;
border
:
0
;
border
:
0
;
display
:
block
;
span
{
line-height
:
60rem
/
$pxConvertRem
;
color
:
#bdbdbd
;
font-size
:
1
.2em
;
padding-left
:
18rem
/
$pxConvertRem
;
}
}
.search-icon
{
position
:
absolute
;
font-size
:
24rem
/
$pxConvertRem
;
top
:
20rem
/
$pxConvertRem
;
top
:
0
;
left
:
24rem
/
$pxConvertRem
;
line-height
:
60rem
/
$pxConvertRem
;
color
:
#bdbdbd
;
}
...
...
static/sass/home/_maybe-like.scss
View file @
b85448f
...
...
@@ -6,6 +6,7 @@
margin-top
:
30rem
/
$pxConvertRem
;
.title
{
height
:
104rem
/
$pxConvertRem
;
font-size
:
38rem
/
$pxConvertRem
;
line-height
:
104rem
/
$pxConvertRem
;
text-align
:
center
;
color
:
#dadada
;
...
...
static/sass/layout/_footer.scss
View file @
b85448f
...
...
@@ -34,7 +34,7 @@
}
&
.bottom
{
position
:
absolute
;
position
:
fixed
;
width
:
100%
;
bottom
:
0
;
}
...
...
template/m.yohobuy.com/actions/category/brand/index.phtml
View file @
b85448f
...
...
@@ -3,7 +3,8 @@
<div
class=
"newbrand-search"
>
<div
class=
"search-box clearfix"
>
<a
href=
"{{searchUrl}}"
>
<input
type=
"text"
class=
"search-input"
placeholder=
"查找品牌"
>
<!--
<input
type=
"text"
class=
"search-input"
placeholder=
"查找品牌"
>
-->
<span>查找品牌</span>
<i
class=
"search-icon iconfont"
>
60
f;</i>
</a>
</div>
...
...
yohobuy/m.yohobuy.com/application/controllers/Boys.php
View file @
b85448f
...
...
@@ -16,50 +16,43 @@ class BoysController extends AbstractAction
{
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel
::
setSwitchToCookie
(
Index\HomeModel
::
COOKIE_NAME_BOYS
);
// 设置网站标题
$this
->
setTitle
(
'男生首页'
);
// 显示侧边栏
$this
->
setNavSide
();
// 设置顶部信息(搜索)
$this
->
setHomeChannelHeader
();
$this
->
setNavSide
(
'boys'
);
// 渲染模板并输出
$this
->
_view
->
display
(
'index'
,
array
(
'boysHomePage'
=>
true
,
'showFooterTab'
=>
false
,
'homeHeader'
=>
array
(
'searchUrl'
=>
Helpers
::
url
(
'/search.html'
,
null
,
'search'
)),
'showFooterTab'
=>
false
,
'maybeLike'
=>
true
,
'content'
=>
Index\HomeModel
::
getBoysFloor
(),
'pageFooter'
=>
true
,
));
}
/**
* 异步获取男首底部banner数据
* @return string 底部Banner数据
*/
public
function
bottomBannerAction
()
{
do
{
if
(
!
$this
->
isAjax
())
{
do
{
if
(
!
$this
->
isAjax
())
{
break
;
}
$channel
=
Helpers
::
getChannelByCookie
();
$bottomBanner
=
Index\HomeModel
::
getBottomBanner
(
$channel
);
if
(
$bottomBanner
)
{
$this
->
echoJson
(
$bottomBanner
);
$bottomBanner
=
Index\HomeModel
::
getBottomBanner
(
$channel
);
if
(
empty
(
$bottomBanner
))
{
break
;
}
}
while
(
false
);
echo
' '
;
$this
->
echoJson
(
$bottomBanner
);
}
while
(
false
);
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/Girls.php
View file @
b85448f
...
...
@@ -16,49 +16,43 @@ class GirlsController extends AbstractAction
{
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel
::
setSwitchToCookie
(
Index\HomeModel
::
COOKIE_NAME_GIRLS
);
// 设置网站标题
$this
->
setTitle
(
'女生首页'
);
// 显示侧边栏
$this
->
setNavSide
();
// 设置顶部信息(搜索)
$this
->
setHomeChannelHeader
();
$this
->
setNavSide
(
'girls'
);
// 渲染模板并输出
$this
->
_view
->
display
(
'index'
,
array
(
'grilsHomePage'
=>
true
,
'showFooterTab'
=>
false
,
'homeHeader'
=>
array
(
'searchUrl'
=>
Helpers
::
url
(
'/search.html'
,
null
,
'search'
)),
'showFooterTab'
=>
false
,
'maybeLike'
=>
true
,
'content'
=>
Index\HomeModel
::
getGirlsFloor
(),
'pageFooter'
=>
true
,
));
}
/**
* 异步获取女首底部banner数据
* @return string 底部Banner数据
*/
public
function
bottomBannerAction
()
{
do
{
if
(
!
$this
->
isAjax
())
{
do
{
if
(
!
$this
->
isAjax
())
{
break
;
}
$channel
=
Helpers
::
getChannelByCookie
();
$bottomBanner
=
Index\HomeModel
::
getBottomBanner
(
$channel
);
if
(
$bottomBanner
)
{
$this
->
echoJson
(
$bottomBanner
);
$bottomBanner
=
Index\HomeModel
::
getBottomBanner
(
$channel
);
if
(
empty
(
$bottomBanner
))
{
break
;
}
}
while
(
false
);
echo
' '
;
$this
->
echoJson
(
$bottomBanner
);
}
while
(
false
);
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/Index.php
View file @
b85448f
...
...
@@ -15,7 +15,7 @@ class IndexController extends AbstractAction
public
function
indexAction
()
{
// 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
Index\HomeModel
::
goSwitchChannel
();
//
Index\HomeModel::goSwitchChannel();
// 渲染模板
$this
->
_view
->
display
(
'index'
,
array
(
...
...
yohobuy/m.yohobuy.com/application/controllers/Kids.php
View file @
b85448f
...
...
@@ -20,13 +20,12 @@ class KidsController extends AbstractAction
$this
->
setTitle
(
'潮童首页'
);
// 显示侧边栏
$this
->
setNavSide
();
// 设置顶部信息(搜索)
$this
->
setHomeChannelHeader
();
// 渲染模板并输出
$this
->
_view
->
display
(
'index'
,
array
(
'kidsHomePage'
=>
true
,
'showFooterTab'
=>
false
,
'homeHeader'
=>
array
(
'searchUrl'
=>
Helpers
::
url
(
'/search.html'
,
null
,
'search'
)),
'showFooterTab'
=>
false
,
'maybeLike'
=>
true
,
'content'
=>
Index\HomeModel
::
getKidsFloor
(),
'pageFooter'
=>
true
,
...
...
yohobuy/m.yohobuy.com/application/controllers/Lifestyle.php
View file @
b85448f
...
...
@@ -20,13 +20,12 @@ class LifestyleController extends AbstractAction
$this
->
setTitle
(
'创意生活首页'
);
// 显示侧边栏
$this
->
setNavSide
();
// 设置顶部信息(搜索)
$this
->
setHomeChannelHeader
();
// 渲染模板并输出
$this
->
_view
->
display
(
'index'
,
array
(
'lifestyleHomePage'
=>
true
,
'showFooterTab'
=>
false
,
'homeHeader'
=>
array
(
'searchUrl'
=>
Helpers
::
url
(
'/search.html'
,
null
,
'search'
)),
'showFooterTab'
=>
false
,
'maybeLike'
=>
true
,
'content'
=>
Index\HomeModel
::
getLifestyleFloor
(),
'pageFooter'
=>
true
,
...
...
yohobuy/m.yohobuy.com/application/controllers/Search.php
View file @
b85448f
...
...
@@ -90,11 +90,11 @@ class SearchController extends AbstractAction
// 跳转到品牌商品列表页
if
(
$domain
!==
null
)
{
$url
=
Helpers
::
url
(
''
,
array
(
'from'
=>
'search'
,
'query'
=>
$query
,
'gender'
=>
$condition
[
'gender'
]
),
$domain
);
$url
=
Helpers
::
url
(
''
,
array
(
'from'
=>
'search'
,
'query'
=>
$query
,
'gender'
=>
$condition
[
'gender'
]
),
$domain
);
$this
->
go
(
$url
);
}
}
...
...
@@ -175,6 +175,8 @@ class SearchController extends AbstractAction
*/
public
function
searchAction
()
{
$data
=
array
();
if
(
$this
->
isAjax
())
{
// 过滤请求参数
$condition
=
filter_input_array
(
INPUT_GET
,
array
(
...
...
@@ -207,7 +209,6 @@ class SearchController extends AbstractAction
$type
=
$this
->
get
(
'type'
,
''
);
$order
=
Helpers
::
transOrder
(
$orderVal
,
$type
);
$data
=
array
();
// 查询品类或品牌数据
if
(
!
isset
(
$condition
[
'query'
]))
{
$condition
[
'order'
]
=
$order
;
...
...
@@ -237,12 +238,12 @@ class SearchController extends AbstractAction
}
$listData
=
array
();
}
}
if
(
empty
(
$data
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'page'
,
$data
);
}
if
(
empty
(
$data
[
'new'
]))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'page'
,
$data
);
}
}
...
...
@@ -252,6 +253,8 @@ class SearchController extends AbstractAction
*/
public
function
filterAction
()
{
$data
=
array
();
if
(
$this
->
isAjax
())
{
// 过滤请求参数
$condition
=
filter_input_array
(
INPUT_GET
,
array
(
...
...
@@ -278,21 +281,18 @@ class SearchController extends AbstractAction
$condition
[
'gender'
]
=
rawurldecode
(
$condition
[
'gender'
]);
}
$data
=
array
();
$listData
=
SearchData
::
searchByCondition
(
$condition
);
// 处理返回的数据
if
(
isset
(
$listData
[
'data'
])
&&
isset
(
$listData
[
'data'
][
'filter'
]))
{
$data
[
'filter'
]
=
ListProcess
::
getFilterData
(
$listData
[
'data'
][
'filter'
]);
}
$listData
=
array
();
}
if
(
empty
(
$data
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'filter'
,
$data
);
}
}
else
{
if
(
empty
(
$data
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'filter'
,
$data
);
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
b85448f
...
...
@@ -134,9 +134,9 @@ class ShoppingCartController extends AbstractAction
public
function
tplAction
()
{
if
(
$this
->
isAjax
())
{
$data
=
file_get_contents
(
'../../../template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml'
);
//
$data = file_get_contents('../../../template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml');
echo
(
$data
);
//
echo($data);
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Category/Brand.php
View file @
b85448f
...
...
@@ -100,6 +100,8 @@ class BrandModel
}
}
$result
[
'pageFooter'
]
=
true
;
$brand
=
array
();
return
$result
;
...
...
yohobuy/m.yohobuy.com/application/models/Guang/Index.php
View file @
b85448f
...
...
@@ -176,6 +176,9 @@ class IndexModel
}
}
// 显示底部
$data
[
'pageFooter'
]
=
true
;
$category
=
array
();
$article
=
array
();
...
...
yohobuy/m.yohobuy.com/application/models/Guang/Plusstar.php
View file @
b85448f
...
...
@@ -54,11 +54,11 @@ class PlusstarModel
$brandList
=
PlusstarData
::
firstBrandList
(
$gender
,
$channel
);
if
(
!
empty
(
$brandList
[
'recom'
][
'data'
][
'list'
][
0
][
'data'
]))
{
$result
[
'ps'
][
'star'
]
=
self
::
formatData
(
$brandList
[
'recom'
][
'data'
][
'list'
][
0
][
'data'
],
$gender
,
true
);
$result
[
'left
Name'
]
=
isset
(
$brandList
[
'recom'
][
'data'
][
'brand_type_name'
])
?
$brandList
[
'recom'
][
'data'
][
'brand_type_name'
]
:
''
;
//$result['ps']['s
Name'] = isset($brandList['recom']['data']['brand_type_name']) ? $brandList['recom']['data']['brand_type_name'] : '';
}
if
(
!
empty
(
$brandList
[
'all'
][
'data'
][
'list'
][
0
][
'data'
]))
{
$result
[
'ps'
][
'plus'
]
=
self
::
formatData
(
$brandList
[
'all'
][
'data'
][
'list'
][
0
][
'data'
],
$gender
,
true
);
$result
[
'right
Name'
]
=
isset
(
$brandList
[
'all'
][
'data'
][
'brand_type_name'
])
?
$brandList
[
'all'
][
'data'
][
'brand_type_name'
]
:
''
;
//$result['ps']['p
Name'] = isset($brandList['all']['data']['brand_type_name']) ? $brandList['all']['data']['brand_type_name'] : '';
}
if
(
USE_CACHE
)
{
...
...
@@ -110,11 +110,11 @@ class PlusstarModel
$brandList
=
PlusstarData
::
brandList
(
$gender
,
$channel
);
if
(
!
empty
(
$brandList
[
'star'
][
'data'
][
'list'
][
0
][
'data'
]))
{
$result
[
'ps'
][
'star'
]
=
self
::
formatData
(
$brandList
[
'star'
][
'data'
][
'list'
][
0
][
'data'
],
$gender
,
false
);
$result
[
'left
Name'
]
=
isset
(
$brandList
[
'star'
][
'data'
][
'brand_type_name'
])
?
$brandList
[
'star'
][
'data'
][
'brand_type_name'
]
:
''
;
//$result['ps']['p
Name'] = isset($brandList['star']['data']['brand_type_name']) ? $brandList['star']['data']['brand_type_name'] : '';
}
if
(
!
empty
(
$brandList
[
'original'
][
'data'
][
'list'
][
0
][
'data'
]))
{
$result
[
'ps'
][
'plus'
]
=
self
::
formatData
(
$brandList
[
'original'
][
'data'
][
'list'
][
0
][
'data'
],
$gender
,
true
);
$result
[
'left
Name'
]
=
isset
(
$brandList
[
'original'
][
'data'
][
'brand_type_name'
])
?
$brandList
[
'original'
][
'data'
][
'brand_type_name'
]
:
''
;
//$result['ps']['s
Name'] = isset($brandList['original']['data']['brand_type_name']) ? $brandList['original']['data']['brand_type_name'] : '';
}
if
(
USE_CACHE
)
{
...
...
yohobuy/m.yohobuy.com/application/models/Index/Side.php
View file @
b85448f
...
...
@@ -59,7 +59,7 @@ class SideModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
CacheConfig
::
KEY_COMMON_SIDE_NAV
,
$result
);
Cache
::
set
(
CacheConfig
::
KEY_COMMON_SIDE_NAV
,
$result
,
3600
);
// 缓存1小时
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/List.php
View file @
b85448f
...
...
@@ -44,7 +44,7 @@ class ListModel
}
// 调用接口查询数据
$listData
=
ClassData
::
filterClassData
(
$condition
);
$listData
=
ClassData
::
filterClassData
(
$condition
);
// 处理返回的数据
if
(
isset
(
$listData
[
'code'
])
&&
$listData
[
'code'
]
===
200
)
{
$result
=
ListProcess
::
getListData
(
$listData
[
'data'
]);
...
...
@@ -86,7 +86,7 @@ class ListModel
}
// 获取品牌banner的数据, 有缓存1小时
$bannerData
=
BrandData
::
getBrandBanner
(
$id
);
$bannerData
=
BrandData
::
getBrandBanner
(
$id
);
if
(
isset
(
$bannerData
[
'data'
][
'banner'
]))
{
$result
[
'banner'
]
=
Helpers
::
getImageUrl
(
$bannerData
[
'data'
][
'banner'
],
640
,
75
);
}
...
...
@@ -118,13 +118,13 @@ class ListModel
}
// 调用接口查询数据
$listData
=
BrandData
::
filterBrandData
(
$condition
);
$listData
=
BrandData
::
filterBrandData
(
$condition
);
// 处理返回的数据
if
(
isset
(
$listData
[
'code'
])
&&
$listData
[
'code'
]
===
200
)
{
$result
=
ListProcess
::
getListData
(
$listData
[
'data'
]);
if
(
!
empty
(
$listData
[
'data'
][
'brand'
]))
{
$result
[
'brandWay'
]
=
array
(
'url'
=>
'http://'
.
$listData
[
'data'
][
'brand'
][
'brand_domain'
]
.
SUB_DOMAIN
,
'url'
=>
'http://'
.
$listData
[
'data'
][
'brand'
][
'brand_domain'
]
.
SUB_DOMAIN
,
'thumb'
=>
Helpers
::
getImageUrl
(
$listData
[
'data'
][
'brand'
][
'brand_ico'
],
75
,
40
),
'name'
=>
$listData
[
'data'
][
'brand'
][
'brand_name'
]
);
...
...
@@ -147,6 +147,52 @@ class ListModel
}
/**
* 根据品牌ID获取品牌LOGO
*
* @param int $id 品牌ID
* @param string $title 品牌标题
* @return array | false
*/
public
static
function
getBrandLogoByIds
(
$id
,
&
$title
)
{
$result
=
false
;
if
(
USE_CACHE
)
{
$key
=
CacheConfig
::
KEY_ACTION_PRODUCT_BRAND_INFOS
.
strval
(
$id
);
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result
=
Cache
::
get
(
$key
,
'master'
);
if
(
!
empty
(
$result
))
{
return
$result
;
}
}
// 调用接口查询数据
$brandLogo
=
BrandData
::
getBrandLogo
(
$id
);
// 处理返回的数据
if
(
isset
(
$brandLogo
[
'data'
][
0
]))
{
$result
=
array
(
'url'
=>
Helpers
::
url
(
''
,
null
,
$brandLogo
[
'data'
][
0
][
'brand_domain'
]),
'thumb'
=>
Helpers
::
getImageUrl
(
$brandLogo
[
'data'
][
0
][
'brand_ico'
],
75
,
40
),
'name'
=>
$brandLogo
[
'data'
][
0
][
'brand_name'
],
);
$title
=
$result
[
'name'
];
}
if
(
USE_CACHE
)
{
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
10800
);
// 缓存3小时
}
}
return
$result
;
}
/**
* 获取所有的品牌名称列表
*
* @return array(
...
...
yohobuy/m.yohobuy.com/application/modules/Guang/controllers/Plusstar.php
View file @
b85448f
...
...
@@ -25,19 +25,25 @@ class PlusstarController extends AbstractAction
if
(
$type
==
'2'
)
{
$this
->
setTitle
(
'明星原创'
);
$this
->
setNavHeader
(
'明星原创'
,
true
,
SITE_MAIN
);
$data
=
Guang\PlusstarModel
::
getBrands
(
$gender
);
$data
[
'psList'
]
=
true
;
// 控制模板中的JS使用
$data
[
'ps'
][
'sName'
]
=
'明星潮品'
;
$data
[
'ps'
][
'pName'
]
=
'原创潮牌'
;
$data
[
'pageFooter'
]
=
true
;
$this
->
_view
->
display
(
'list'
,
$data
);
}
else
{
$this
->
setTitle
(
'国际优选'
);
$this
->
setNavHeader
(
'国际优选'
,
true
,
SITE_MAIN
);
$data
=
Guang\PlusstarModel
::
getFirstBrands
(
$gender
);
$data
[
'psList'
]
=
true
;
// 控制模板中的JS使用
$this
->
_view
->
display
(
'index'
,
$data
);
$data
[
'ps'
][
'sName'
]
=
'设计师'
;
$data
[
'ps'
][
'pName'
]
=
'经典潮牌'
;
$data
[
'pageFooter'
]
=
true
;
$this
->
_view
->
display
(
'list'
,
$data
);
}
}
...
...
@@ -51,11 +57,13 @@ class PlusstarController extends AbstractAction
{
$this
->
setTitle
(
'明星原创'
);
$this
->
setNavHeader
(
'明星原创'
,
true
,
SITE_MAIN
);
$gender
=
$this
->
get
(
'gender'
,
'1,3'
);
$data
=
Guang\PlusstarModel
::
getBrands
(
$gender
);
$data
[
'psList'
]
=
true
;
// 控制模板中的JS使用
$data
[
'ps'
][
'sName'
]
=
'明星潮品'
;
$data
[
'ps'
][
'pName'
]
=
'原创潮牌'
;
$this
->
_view
->
display
(
'list'
,
$data
);
}
...
...
@@ -84,7 +92,7 @@ class PlusstarController extends AbstractAction
break
;
}
$brandId
=
$brandInfo
[
'getBrandInfo'
][
'data'
][
'brand_id'
];
/* 获取更多品牌的链接 */
$url
=
'/brands'
;
$brandDomains
=
Product\ListModel
::
getAllBrandDomains
();
...
...
@@ -92,7 +100,7 @@ class PlusstarController extends AbstractAction
// 构建成 品牌域名.xxx.com
$url
=
Helpers
::
url
(
''
,
null
,
$brandDomains
[
$brandId
]);
}
$data
[
'psDetail'
]
=
true
;
$data
[
'ps'
][
'id'
]
=
$brandId
;
$data
[
'ps'
][
'banner'
]
=
Helpers
::
getImageUrl
(
$brandInfo
[
'getBrandInfo'
][
'data'
][
'cover_img'
],
640
,
309
);
...
...
@@ -102,7 +110,7 @@ class PlusstarController extends AbstractAction
$data
[
'ps'
][
'likeUrl'
]
=
false
;
//"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
[
'getBrandInfo'
][
'data'
][
'brand_intro'
])
?
''
:
strtr
(
strip_tags
(
$brandInfo
[
'getBrandInfo'
][
'data'
][
'brand_intro'
]),
array
(
' '
=>
' '
));
$data
[
'ps'
][
'newArrival'
]
=
array
();
$data
[
'ps'
][
'newArrival'
][
'moreUrl'
]
=
$url
;
$data
[
'ps'
][
'newArrival'
][
'moreUrl'
]
=
$url
;
$data
[
'ps'
][
'newArrival'
][
'naList'
]
=
$brandInfo
[
'getNewProduct'
];
$data
[
'ps'
][
'infos'
]
=
array
();
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
b85448f
...
...
@@ -59,6 +59,7 @@ class IndexController extends AbstractAction
'goodListPage'
=>
true
,
'showDownloadApp'
=>
true
,
'goodList'
=>
$condition
,
'pageFooter'
=>
true
,
));
}
...
...
@@ -77,14 +78,14 @@ class IndexController extends AbstractAction
/* 品牌域名参数 @see Bootstrap.php */
$domain
=
$this
->
param
(
'named'
);
if
(
empty
(
$domain
))
{
$this
->
error
(
);
$this
->
go
(
SITE_MAIN
);
}
/* 通过品牌域名找到对应的品牌ID */
$domainList
=
Product\ListModel
::
getAllBrandDomains
();
$brandIds
=
array_keys
(
$domainList
,
$domain
);
if
(
!
isset
(
$brandIds
[
0
]))
{
$this
->
error
(
);
$this
->
go
(
SITE_MAIN
);
}
// 当前的登录用户UID
...
...
@@ -113,12 +114,13 @@ class IndexController extends AbstractAction
$condition
[
'gender'
]
=
rawurldecode
(
$condition
[
'gender'
]);
}
$data
=
array
();
$data
[
'goodListPage'
]
=
true
;
$data
[
'showDownloadApp'
]
=
true
;
// 从搜索页过来的,显示搜索框, 和进入品牌引导信息
if
(
$from
===
'search'
)
{
$data
[
'goodList'
]
=
array
();
$data
[
'goodList'
][
'brandWay'
]
=
false
;
$data
[
'goodList'
][
'brandWay'
]
=
Product\ListModel
::
getBrandLogoByIds
(
$brandIds
[
0
],
$title
)
;
$data
[
'goodList'
][
'search'
][
'default'
]
=
$query
;
$data
[
'goodList'
][
'search'
][
'url'
]
=
Helpers
::
url
(
''
,
null
,
'search'
);
}
...
...
@@ -128,6 +130,7 @@ class IndexController extends AbstractAction
$data
[
'goodList'
]
=
array
();
}
$data
[
'goodList'
]
+=
$condition
;
$data
[
'pageFooter'
]
=
true
;
if
(
$title
===
''
)
{
$title
=
$domain
;
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php
View file @
b85448f
...
...
@@ -2,7 +2,6 @@
use
Action\AbstractAction
;
use
LibModels\Wap\Product\NewsaleData
;
use
Product\NewsaleModel
;
use
Plugin\Helpers
;
/**
...
...
@@ -22,13 +21,12 @@ class NewsaleController extends AbstractAction
$this
->
setNavHeader
(
'新品到着'
);
$channel
=
Helpers
::
getChannelByCookie
();
$data
=
array
();
$data
[
'newArrivalPage'
]
=
true
;
$data
[
'headerBanner'
]
=
\Product\NewsaleModel
::
getNewFocus
(
$channel
);
// 设置一些筛选的默认参数
$data
+=
array
(
'showDownloadApp'
=>
true
,
$data
=
array
(
'newArrivalPage'
=>
true
,
'showDownloadApp'
=>
true
,
'pageFooter'
=>
true
,
'headerBanner'
=>
\Product\NewsaleModel
::
getNewFocus
(
$channel
),
'brand'
=>
'0'
,
'sort'
=>
'0'
,
'gender'
=>
Helpers
::
getGenderByCookie
(),
...
...
@@ -52,13 +50,12 @@ class NewsaleController extends AbstractAction
$this
->
setNavHeader
(
'Sale'
);
$channel
=
Helpers
::
getChannelByCookie
();
$data
=
array
();
$data
[
'discountPage'
]
=
true
;
$data
[
'headerBanner'
]
=
\Product\NewsaleModel
::
getNewFocus
(
$channel
);
// 设置一些筛选的默认参数
$data
+=
array
(
'showDownloadApp'
=>
true
,
// 设置一些默认参数
$data
=
array
(
'discountPage'
=>
true
,
'headerBanner'
=>
\Product\NewsaleModel
::
getNewFocus
(
$channel
),
'showDownloadApp'
=>
true
,
'pageFooter'
=>
true
,
'brand'
=>
'0'
,
'sort'
=>
'0'
,
'gender'
=>
Helpers
::
getGenderByCookie
(),
...
...
@@ -77,6 +74,8 @@ class NewsaleController extends AbstractAction
*/
public
function
selectNewSaleAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$gender
=
$this
->
get
(
'gender'
,
null
);
$brand
=
$this
->
get
(
'brand'
,
null
);
...
...
@@ -101,14 +100,12 @@ class NewsaleController extends AbstractAction
$gender
,
$brand
,
$sort
,
$color
,
$size
,
$price
,
$p_d
,
$channel
,
$dayLimit
,
$limit
,
$page
,
$order
);
$result
=
\Product\NewsaleModel
::
selectData
(
$data
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'product'
,
$result
);
}
}
else
{
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'product'
,
$result
);
}
}
...
...
@@ -119,6 +116,8 @@ class NewsaleController extends AbstractAction
*/
public
function
filterAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$gender
=
$this
->
get
(
'gender'
,
null
);
$brand
=
$this
->
get
(
'brand'
,
null
);
...
...
@@ -142,14 +141,12 @@ class NewsaleController extends AbstractAction
$gender
,
$brand
,
$sort
,
$color
,
$size
,
$price
,
$p_d
,
$channel
,
$dayLimit
,
$limit
,
$page
,
$order
);
$result
=
\Product\NewsaleModel
::
filterData
(
$data
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'filter'
,
$result
);
}
}
else
{
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'filter'
,
$result
);
}
}
...
...
Please
register
or
login
to post a comment