Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
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
Plain Diff
Browse Files
Authored by
郭成尧
9 years ago
Commit
5198c9af62502f8275f9c2ae9db82d9ebf80d26c
2 parents
a86b8677
61a7d9de
店铺简介品类品牌OK
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
779 additions
and
113 deletions
library/LibModels/Wap/Product/ListData.php
library/Plugin/DataProcess/ShopProcess.php
static/sass/product/_shop-index.scss
template/m.yohobuy.com/actions/product/index/brand.phtml
template/m.yohobuy.com/actions/product/index/shop.phtml
template/m.yohobuy.com/partials/layout/use.phtml
template/m.yohobuy.com/partials/product/goods-nav-top.phtml
yohobuy/m.yohobuy.com/application/models/Product/List.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
library/LibModels/Wap/Product/ListData.php
View file @
5198c9a
...
...
@@ -56,4 +56,59 @@ class ListData
return
Yohobuy
::
yarClient
(
Yohobuy
::
SERVICE_URL
.
self
::
URI_PRODUCT
,
'getLessInfoByProductSkcs'
,
array
(
array
(
'productSkcs'
=>
$skcs
)));
}
/**
* 获取店铺装修的所有资源接口
* @param int $shopId 店铺id
* @param int $cache 接口缓存
* @author sefon 2016-4-26 21:17:15
* @return array
*/
public
static
function
getShopDecorator
(
$shopId
,
$cache
=
600
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.shopsdecorator.getList'
;
$param
[
'shop_id'
]
=
$shopId
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
//TODO
// return Yohobuy::get(Yohobuy::API_URL, $param);
return
Yohobuy
::
get
(
'http://devapi.yoho.cn:58078/'
,
$param
,
$cache
);
}
/**
* 获取店铺信息
* @param int $shopId 店铺id
* @param int $cache 接口缓存
* @author sefon 2016-4-26 21:32:57
* @return array
*/
public
static
function
getShopInfo
(
$shopId
,
$cache
=
600
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.shops.getIntro'
;
$param
[
'shop_id'
]
=
$shopId
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
//TODO
// return Yohobuy::get(Yohobuy::API_URL, $param);
return
Yohobuy
::
get
(
'http://devapi.yoho.cn:58078/'
,
$param
,
$cache
);
}
/**
* 获取店铺下面的所有品牌
* @param int $shopId 店铺id
* @param int $cache 接口缓存
* @author sefon 2016-4-26 21:48:30
* @return array
*/
public
static
function
getShopBrands
(
$shopId
,
$cache
=
600
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.shops.getShopsBrands'
;
$param
[
'shop_id'
]
=
$shopId
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
//TODO
// return Yohobuy::get(Yohobuy::API_URL, $param);
return
Yohobuy
::
get
(
'http://devapi.yoho.cn:58078/'
,
$param
,
$cache
);
}
}
...
...
library/Plugin/DataProcess/ShopProcess.php
0 → 100644
View file @
5198c9a
<?php
namespace
Plugin\DataProcess
;
use
Plugin\Helpers
;
/**
* 店铺楼层数据处理类
*/
class
ShopProcess
{
private
static
$shopData
=
array
();
/**
* 组织店铺页面数据
* @param array $data 接口返回的店铺页所需数据
* @param int $type 店铺模板id
* @author sefon 2016-4-26 21:56:32
* @return array
*/
public
static
function
formShopData
(
$data
,
$type
=
2
)
{
foreach
(
$data
as
$key
=>
$val
)
{
if
(
empty
(
$val
)
||
!
is_callable
(
"self::
$key
"
))
{
continue
;
}
self
::
$key
(
$val
);
}
// print_r($data);
// exit;
return
self
::
$shopData
;
}
/**
* 组织店铺装修
* @param array $data
* @author sefon 2016-4-26 22:04:04
* @return array
*/
private
static
function
decorator
(
$data
)
{
if
(
!
isset
(
$data
[
'code'
])
||
$data
[
'code'
]
!=
200
||
!
isset
(
$data
[
'data'
][
'list'
])
||
empty
(
$data
[
'data'
][
'list'
]))
{
return
;
}
foreach
(
$data
[
'data'
][
'list'
]
as
$val
)
{
if
(
empty
(
$val
[
'resource_data'
])
||
!
is_callable
(
"self::
$val[resource_name]
"
))
{
continue
;
}
self
::
$val
[
'resource_name'
](
json_decode
(
$val
[
'resource_data'
],
true
));
}
// print_r($data); exit;
}
/**
* 店铺Banner
* @param array $data
* @author sefon 2016-4-27 08:40:05
* @return array
*/
private
static
function
shopTopBanner
(
$data
)
{
foreach
(
$data
as
$val
)
{
self
::
$shopData
[
'bannerTop'
][
'list'
][]
=
array
(
'url'
=>
''
,
'img'
=>
$val
[
'shopSrc'
]);
}
}
/**
* 资源位小图
* @param array $data
* @author sefon 2016-4-27 08:37:30
* @return array
*/
private
static
function
oneRowTwoColImages
(
$data
)
{
foreach
(
$data
as
$key
=>
$val
)
{
if
(
empty
(
$val
[
'data'
]))
{
continue
;
}
foreach
(
$val
[
'data'
]
as
$val
)
{
self
::
$shopData
[
'spring'
][]
=
array
(
'url'
=>
$val
[
'url'
],
'springType'
=>
$val
[
'src'
]
);
}
}
return
$data
;
}
/**
* 店铺品牌一览
* @param array $data
* @author sefon 2016-4-26 22:04:04
* @return array
*/
private
static
function
brandBrowse
(
$data
)
{
foreach
(
$data
as
$val
)
{
self
::
$shopData
[
'multi-list'
][]
=
array
(
'url'
=>
''
,
'img'
=>
$val
[
'brandIco'
],
'brandName'
=>
$val
[
'brandName'
]
);
}
}
/**
* 热门分类
* @param array $data
* @author sefon 2016-4-27 08:38:36
* @return array
*/
private
static
function
hotRecommend
(
$data
)
{
return
$data
;
}
/**
* 人气单品
* @param array $data
* @author sefon 2016-4-27 08:38:36
* @return array
*/
private
static
function
hotProducts
(
$data
)
{
// print_r($data);
foreach
(
$data
as
$val
)
{
echo
$val
[
'src'
];
self
::
$shopData
[
'hotList'
][]
=
array
(
'url'
=>
$val
[
'url'
],
'img'
=>
$val
[
'src'
],
'salesPrice'
=>
'¥'
.
$val
[
'salesPrice'
],
'presentPrice'
=>
'¥'
.
$val
[
'salesPrice'
]
);
}
return
$data
;
}
}
\ No newline at end of file
...
...
static/sass/product/_shop-index.scss
View file @
5198c9a
...
...
@@ -13,6 +13,24 @@
overflow
:
hidden
;
}
.logo
{
position
:
absolute
;
overflow
:
hidden
;
left
:
30rem
/
$pxConvertRem
;
bottom
:
30rem
/
$pxConvertRem
;
width
:
100rem
/
$pxConvertRem
;
height
:
100rem
/
$pxConvertRem
;
}
.name
{
color
:
#fff
;
font-size
:
28rem
/
$pxConvertRem
;
position
:
absolute
;
overflow
:
hidden
;
left
:
148rem
/
$pxConvertRem
;
bottom
:
20rem
/
$pxConvertRem
;
}
.collect
{
width
:
128rem
/
$pxConvertRem
;
height
:
50rem
/
$pxConvertRem
;
...
...
@@ -38,7 +56,7 @@
background
:
#fff
;
overflow
:
hidden
;
border-sizing
:
border-box
;
border-bottom
:
1
px
solid
#e1e1e1
;
border-bottom
:
1
rem
/
$pxConvertRem
solid
#e1e1e1
;
li
{
color
:
#b1b1b1
;
...
...
@@ -48,7 +66,7 @@
line-height
:
28rem
/
$pxConvertRem
;
width
:
24%
;
text-align
:
center
;
border-left
:
1
px
solid
#e1e1e1
;
border-left
:
1
rem
/
$pxConvertRem
solid
#e1e1e1
;
margin-top
:
30rem
/
$pxConvertRem
;
border-sizing
:
border-box
;
color
:
#b1b1b1
;
...
...
@@ -113,12 +131,14 @@
font-size
:
20px
;
text-align
:
center
;
padding-top
:
25rem
/
$pxConvertRem
;
margin-bottom
:
30rem
/
$pxConvertRem
;
margin-bottom
:
30rem
/
$pxConvertRem
;
overflow
:
hidden
;
}
.multi-browse
{
margin-top
:
50rem
/
$pxConvertRem
;
overflow
:
hidden
;
@extend
.swiper-container
}
.brand-img
{
...
...
@@ -149,13 +169,13 @@
img
{
width
:
90%
;
border-radius
:
10
px
;
border-radius
:
10
rem
/
$pxConvertRem
;
vertical-align
:
top
;
}
}
}
.title
{
.
popularity-
title
{
background
:
#fff
;
border-bottom
:
1px
solid
#e8e8e8
;
text-align
:
center
;
...
...
@@ -248,56 +268,20 @@
.goods-container
{
position
:
relative
;
min-height
:
440
px
;
min-height
:
440
rem
/
$pxConvertRem
;
padding-left
:
0
.375rem
;
padding-top
:
20rem
/
$pxConvertRem
;
border-bottom
:
1px
solid
#e0e0e0
;
}
// .fotter {
// position: fixed;
// left: 0;
// bottom: 0;
// z-index: 3;
// width: 100%;
// height: 88rem / $pxConvertRem;
// margin: 0;
// padding: 0;
// border: 0;
// font: inherit;
// vertical-align: baseline;
// list-style: none;
// font-size: 0.7rem;
// background: #fff;
// overflow: hidden;
// border-sizing: border-box;
// border-top: 1px solid #e1e1e1;
// li{
// display: block;
// height: 28rem /$pxConvertRem;
// float: left;
// line-height: 28rem /$pxConvertRem;
// width: 33%;
// text-align: center;
// border-left: 1px solid #e1e1e1;
// margin-top: 30rem / $pxConvertRem;
// border-sizing: border-box;
// &:first-child {
// border-left: none;
// }
// }
// }
.discount-area
{
@extend
.discount-page
;
.list-nav
li
{
display
:
block
;
height
:
28rem
/
$pxConvertRem
;
height
:
28rem
/
$pxConvertRem
;
float
:
left
;
line-height
:
28rem
/
$pxConvertRem
;
line-height
:
28rem
/
$pxConvertRem
;
width
:
24%
;
text-align
:
center
;
border-left
:
1px
solid
#e1e1e1
;
...
...
@@ -305,17 +289,21 @@
margin-bottom
:
30rem
/
$pxConvertRem
;
border-sizing
:
border-box
;
span
{
font-size
:
0
.7rem
;
}
&
:first-child
{
border-left
:
none
;
}
}
.list-nav
.icon
.up
{
top
:
-
4px
;
top
:
-
6rem
/
$pxConvertRem
;
}
.list-nav
.icon
.down
{
top
:
3px
;
top
:
8rem
/
$pxConvertRem
;
}
.goods-container
{
...
...
@@ -349,12 +337,6 @@
}
// .fixed-top {
// position: fixed;
// top: 0;
// left: 0;
// }
.shop-foot-wrapper
{
position
:
absolute
;
bottom
:
0
;
...
...
@@ -416,4 +398,9 @@
background
:
image-url
(
"/img/product/sharp.png"
)
no-repeat
center
center
;
}
}
.bytouch
{
background
:
#eee
;
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/product/index/brand.phtml
View file @
5198c9a
{
{>
layout/header
}
}
{
{#
content
}
}
<a
class=
"brand-list"
href=
"{{url}}"
>
{
{brand_name
}
}
</a>
{
{/
content
}
}
<div
class=
"brand"
>
{
{#
content
}
}
<a
class=
"brand-list"
href=
"{{url}}"
>
{
{brand_name
}
}
</a>
{
{/
content
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/product/index/shop.phtml
0 → 100644
View file @
5198c9a
{
{>
layout/header
}
}
{
{#
shopIndex
}
}
<div
class=
"shop-index yoho-page"
id=
"wrapper"
>
<div
id=
"scroller"
>
<div
id=
"nav-top"
>
{
{#
headerBanner
}
}
{
{>
product/banner-swipe-and-single
}
}
{
{/
headerBanner
}
}
<div
class=
"search-area"
>
<div
id=
"search-input"
class=
"search-input"
>
<form
id=
"search-form"
action=
{
{url
}
}
method=
"get"
>
<i
class=
"search-icon iconfont"
>
60
f;</i>
<input
type=
"text"
placeholder=
"搜索店铺内潮品"
name=
"query"
>
<input
type=
"hidden"
name=
"from"
value=
"search"
>
<i
class=
"clear-input iconfont hide"
>
626
;</i>
<span
id=
"search"
class=
"search"
type=
"submit"
>搜索</span>
</form>
</div>
</div>
<div
class=
"branner-top"
>
<img
src=
"{{branerImg}}"
>
<img
class=
"logo"
src=
"{{logoImg}}"
>
<p
class=
"name"
>
{
{storeName
}
}</p>
<div
class=
"collect"
></div>
</div>
</div>
<ul
id=
"nav"
class=
"nav"
>
<li
class=
"active color"
tab=
"home-page"
>首页</li>
<li
tab=
"new-arrival"
>上新</li>
<li
tab=
"popularity"
>人气</li>
<li>
<a
href=
"#"
target=
"_blank"
>全部商品</a>
</li>
</ul>
<div
id=
"home-page"
>
<div
id=
"nav-main"
class=
"main"
>
{
{#unless
brands
}
}
<div
class=
"multi-brands"
>
<h
2
>品牌一览</h
2
>
<div
class=
"multi-browse"
>
<ul
class=
"swiper-wrapper"
>
{
{#each
multiList
}
}
<li
class=
"swiper-slide brand-img"
>
<a
href=
"{{url}}"
>
<img
src=
"{{img}}"
>
</a>
<p>
{
{brandName
}
}</p>
</li>
{
{/each
}
}
</ul>
</div>
</div>
{
{/unless
}
}
<div
class=
"banner-area"
>
{
{#
bannerTop
}
}
{
{>
home/banner_top
}
}
{
{/
bannerTop
}
}
</div>
<ul
class=
"spring"
>
{
{#each
spring
}
}
<li>
<a
href=
"{{url}}"
>
<img
src=
"{{springType}}"
>
</a>
</li>
{
{/each
}
}
</ul>
{
{!
热门品类
}
}
{
{#
hotCategory
}
}
{
{>
home/hot_category
}
}
{
{/
hotCategory
}
}
<div
class=
"popularity-title"
>
人气单品
<a
class=
"more"
href=
"{{more_url}}"
>
618
;</a>
</div>
<ul
class=
"product-list"
>
{
{#each
hotList
}
}
<li>
<a
href=
"{{url}}"
>
<img
src=
"{{listUrl}}"
>
</a>
<div
class=
"list-price"
>
<p>VANS
AP
M
BERZE</p>
<p><span
class=
"red"
>
{
{originalPrice
}
}</span>
<span>
{
{presentPrice
}
}</span>
</p>
</div>
</li>
{
{/each
}
}
</ul>
</div>
<div
class=
"discount-area"
>
{
{>
product/goods-nav-top
}
}
</div>
</div>
<div
id=
"new-arrival"
class=
""
></div>
<div
id=
"popularity"
class=
""
></div>
</div>
<ul
id=
"pos-nav"
class=
"nav hide"
>
<li
class=
"active color"
>首页</li>
<li>上新</li>
<li>人气</li>
<li>
<a
href=
"#"
target=
"_blank"
>全部商品</a>
</li>
</ul>
<ul
id=
"pos-list "
class=
"list-nav clearfixnav hide discount-area"
>
<li
class=
"new active"
>
<a
href=
"javascript:void(0);"
>
<span
class=
"spanTest"
>最新</span>
<span
class=
"iconfont cur"
>
616
;</span>
</a>
</li>
<li
class=
"price"
>
<a
href=
"javascript:void(0);"
>
<span
class=
"spanTest"
>价格</span>
<span
class=
"icon"
>
<i
class=
"iconfont up cur"
>
615
;</i>
<i
class=
"iconfont down"
>
616
;</i>
</span>
</a>
</li>
<li
class=
"discount"
>
<a
href=
"javascript:void(0);"
>
<span
class=
"spanTest"
>折扣</span>
<span
class=
"icon"
>
<i
class=
"iconfont up cur"
>
615
;</i>
<i
class=
"iconfont down"
>
616
;</i>
</span>
</a>
</li>
<li
class=
"filter"
>
<a
href=
"javascript:void(0);"
>
<span
class=
"spanTest"
>筛选</span>
<span
class=
"iconfont cur"
>
613
;</span>
</a>
</li>
</ul>
</div>
{
{/
shopIndex
}
}
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/layout/use.phtml
View file @
5198c9a
...
...
@@ -349,5 +349,6 @@
{{#if shopPage}}
<script>
seajs.use('js/product/shop');
seajs.use('js/product/newsale/discount');
</script>
{{/if}}
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/product/goods-nav-top.phtml
View file @
5198c9a
<ul id="list-nav" class="list-nav clearfix">
<li class="new active">
<a href="javascript:void(0);">
<span class="spanTest">最新</span>
<span class="iconfont cur"></span>
</a>
</li>
<li class="price">
<a href="javascript:void(0);">
<span class="spanTest">价格</span>
<span class="icon">
<i class="iconfont up cur"></i>
<i class="iconfont down"></i>
</span>
</a>
</li>
<li class="discount">
<a href="javascript:void(0);">
<span class="spanTest">折扣</span>
<span class="icon">
<i class="iconfont up cur"></i>
<i class="iconfont down"></i>
</span>
</a>
</li>
<li class="filter">
<a href="javascript:void(0);">
<span class="spanTest">筛选</span>
<span class="iconfont cur"></span>
</a>
</li>
</ul>
<li class="new active">
<a href="javascript:void(0);">
<span class="spanTest">最新</span>
<span class="iconfont cur"></span>
</a>
</li>
<li class="price">
<a href="javascript:void(0);">
<span class="spanTest">价格</span>
<span class="icon">
<i class="iconfont up cur"></i>
<i class="iconfont down"></i>
</span>
</a>
</li>
<li class="discount">
<a href="javascript:void(0);">
<span class="spanTest">折扣</span>
<span class="icon">
<i class="iconfont up cur"></i>
<i class="iconfont down"></i>
</span>
</a>
</li>
<li class="filter">
<a href="javascript:void(0);">
<span class="spanTest">筛选</span>
<span class="iconfont cur"></span>
</a>
</li>
</ul>
<div id="goods-container" class="goods-container">
<div class="new-goods container clearfix">
{{# goods}}
{{> good}}
{{/ goods}}
</div>
<div class="price-goods container hide clearfix"></div>
<div class="discount-goods container hide clearfix"></div>
<div id="goods-container" class="goods-container">
<div class="new-goods container clearfix">
{{# goods}}
{{> good}}
{{/ goods}}
</div>
<div class="price-goods container hide clearfix"></div>
<div class="discount-goods container hide clearfix"></div>
{{> filter}}
</div>
\ No newline at end of file
{{> filter}}
</div>
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/models/Product/List.php
View file @
5198c9a
...
...
@@ -5,15 +5,17 @@ namespace Product;
use
Configs\CacheConfig
;
use
LibModels\Wap\Category\ClassData
;
use
LibModels\Wap\Category\BrandData
;
use
LibModels\Wap\Product\ListData
;
use
LibModels\Wap\Product\ShopData
;
use
Plugin\DataProcess\ListProcess
;
use
Plugin\DataProcess\ShopProcess
;
use
Plugin\Helpers
;
use
Plugin\Cache
;
use
Plugin\Images
;
/**
* 商品列表相关的模板数据模型
*
*
* @name ListModel
* @package models/Product
* @copyright yoho.inc
...
...
@@ -25,7 +27,7 @@ class ListModel
/**
* 获取品类商品列表数据
*
*
* @param array $condition 条件
* @return array | false
*
...
...
@@ -58,7 +60,8 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存30分钟
}
...
...
@@ -69,7 +72,7 @@ class ListModel
/**
* 获取品牌信息
*
*
* @param int $id 唯一的ID
* @param int $uid 用户ID
* @param string $title 网站标题
...
...
@@ -100,7 +103,7 @@ class ListModel
/**
* 获取品牌商品列表数据
*
*
* @param array $condition 条件参数
* @param string $title 网站标题
* @return array
...
...
@@ -140,7 +143,8 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存30分钟
}
...
...
@@ -151,7 +155,7 @@ class ListModel
/**
* 根据品牌ID获取品牌LOGO
*
*
* @param int $id 品牌ID
* @param string $title 品牌标题
* @return array | false
...
...
@@ -185,7 +189,8 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
// 缓存1小时
}
...
...
@@ -196,7 +201,7 @@ class ListModel
/**
* 根据品牌ID获取品牌LOGO
*
*
* @param int $id 品牌ID
* @param string $title 品牌标题
* @return array | false
...
...
@@ -231,7 +236,8 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
// 缓存1小时
}
...
...
@@ -242,7 +248,7 @@ class ListModel
/**
* 获取所有的品牌名称列表
*
*
* @return array(
* 品牌ID => 品牌域名(domain)
* )
...
...
@@ -281,7 +287,8 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
}
...
...
@@ -292,7 +299,7 @@ class ListModel
/**
* 获取所有的品牌名称列表
*
*
* @return array(
* 品牌域名(domain) => 品牌名称(name)
* )
...
...
@@ -331,7 +338,8 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
}
...
...
@@ -387,5 +395,31 @@ class ListModel
}
return
$data
;
}
/**
* 新店铺首页
* @param int $shopId 店铺id
* @param int $uid 用户id
* @author sefon 2016-4-26 21:09:35
* @return array
*/
public
static
function
shopData
(
$shopId
,
$uid
)
{
$data
=
array
();
//TODO 用户是否收藏
if
(
!
empty
(
$uid
))
{
}
//店铺信息
// $data['shopInfo'] = ListData::getShopInfo($shopId);
//店铺装修资源数据
$data
[
'decorator'
]
=
ListData
::
getShopDecorator
(
$shopId
);
//品牌一览
//$data['shopBrands'] = ListData::getShopBrands($shopId);
//商品列表
$data
[
'products'
]
=
array
();
//组织楼层数据
$result
=
ShopProcess
::
formShopData
(
$data
);
return
$result
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
5198c9a
...
...
@@ -326,4 +326,301 @@ class IndexController extends AbstractAction
}
/**
* 店铺首页
* @author sefon 2016-4-26 20:50:58
*/
public
function
shopAction
()
{
$title
=
''
;
$domain
=
'vans'
;
//TODO
$brandLogo
=
Product\ListModel
::
getBrandLogoByDomain
(
$domain
,
$title
);
$shopId
=
0
;
$shopId
=
323
;
$uid
=
$this
->
getUid
(
true
);
$data
=
ListModel
::
shopData
(
$shopId
,
$uid
);
$this
->
setTitle
(
$title
);
$this
->
setNavHeader
(
$title
,
true
,
SITE_MAIN
);
$this
->
_view
->
display
(
'shop'
,
array
(
'shopIndex'
=>
$data
,
'shopPage'
=>
true
));
}
/**
* 店铺上新
*/
public
function
shopNewPro
()
{
}
/**
* 店铺人气
*/
public
function
shopTops
()
{
}
/**
* 店铺品牌首页
*
* @return mixed
*/
public
function
testAction
()
{
$data
=
array
(
'branerImg'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026e96d1b403d28407650c7228bb4ca405.jpg?imageView2/2/w/640/h/200'
,
'logoImg'
=>
''
,
'storeName'
=>
'Vans专营店'
,
'goodList'
=>
'http://www.baidu.com'
,
'brands'
=>
false
,
'multiList'
=>
array
(
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403'
,
'brandName'
=>
'123re34456556900'
),
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403'
,
'brandName'
=>
'123re34456556900'
),
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403'
,
'brandName'
=>
'123re344565'
),
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403'
,
'brandName'
=>
'123re34456556900'
),
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403'
,
'brandName'
=>
'123re34456556900'
),
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403'
,
'brandName'
=>
'123re344565'
),
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403'
,
'brandName'
=>
'123re344565'
)
),
'bannerTop'
=>
array
(
'list'
=>
array
(
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/11/02039485d87cc1b100b883244cf386e62d.jpg?imageView/2/w/640/h/200'
,
),
array
(
'url'
=>
''
,
'img'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/11/02039485d87cc1b100b883244cf386e62d.jpg?imageView/2/w/640/h/200'
,
),
)
),
'spring'
=>
array
(
array
(
'url'
=>
''
,
'springType'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/01ea96f5fd2ea8ef99d37d00f39d8e57f0.jpg?imageView/2/w/275/h/160'
),
array
(
'url'
=>
''
,
'springType'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
)
),
'hotCategory'
=>
array
(
'name'
=>
'热门品类'
,
'list'
=>
array
(
array
(
'url'
=>
'http://img12.static.yhbimg.com/yhb-img01/2016/04/15/02/0295b83dc3bcef5bd59f339841f9ee92d1.jpg?imageView2/2/w/640/h/403'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
),
array
(
'url'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
),
array
(
'url'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
),
array
(
'url'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
),
array
(
'url'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
),
array
(
'url'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
),
array
(
'url'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
),
array
(
'url'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
,
)
)
),
'hotList'
=>
array
(
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599.00'
,
'presentPrice'
=>
'¥399.00'
),
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599'
,
'presentPrice'
=>
'¥399'
),
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599'
,
'presentPrice'
=>
'¥399'
),
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599'
,
'presentPrice'
=>
'¥399'
),
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599.00'
,
'presentPrice'
=>
'¥399.00'
),
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599'
,
'presentPrice'
=>
'¥399'
),
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599'
,
'presentPrice'
=>
'¥399'
),
array
(
'url'
=>
''
,
'listUrl'
=>
'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80'
,
'originalPrice'
=>
'¥599'
,
'presentPrice'
=>
'¥399'
)
),
'goods'
=>
array
(
array
(
'url'
=>
'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html'
,
'thumb'
=>
'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314'
,
'name'
=>
'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣'
,
'salePrice'
=>
'759.00'
,
'price'
=>
'799.00'
,
'tags'
=>
array
(
'is_new'
=>
false
,
'is_advance'
=>
true
,
'is_discount'
=>
false
,
'is_yohoood'
=>
false
,
'is_limited'
=>
false
),
'is_soon_sold_out'
=>
false
),
array
(
'url'
=>
'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html'
,
'thumb'
=>
'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314'
,
'name'
=>
'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣'
,
'salePrice'
=>
'759.00'
,
'price'
=>
'799.00'
,
'tags'
=>
array
(
'is_new'
=>
true
,
'is_advance'
=>
false
,
'is_discount'
=>
false
,
'is_yohoood'
=>
false
,
'is_limited'
=>
false
),
'is_soon_sold_out'
=>
false
),
array
(
'url'
=>
'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html'
,
'thumb'
=>
'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314'
,
'name'
=>
'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣'
,
'salePrice'
=>
'759.00'
,
'price'
=>
'799.00'
,
'tags'
=>
array
(
'is_new'
=>
true
,
'is_advance'
=>
false
,
'is_discount'
=>
false
,
'is_yohoood'
=>
false
,
'is_limited'
=>
false
),
'is_soon_sold_out'
=>
false
),
array
(
'url'
=>
'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html'
,
'thumb'
=>
'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314'
,
'name'
=>
'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣'
,
'salePrice'
=>
'759.00'
,
'price'
=>
'799.00'
,
'tags'
=>
array
(
'is_new'
=>
true
,
'is_advance'
=>
false
,
'is_discount'
=>
false
,
'is_yohoood'
=>
false
,
'is_limited'
=>
false
),
'is_soon_sold_out'
=>
false
),
array
(
'url'
=>
'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html'
,
'thumb'
=>
'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314'
,
'name'
=>
'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣'
,
'salePrice'
=>
'759.00'
,
'price'
=>
'799.00'
,
'tags'
=>
array
(
'is_new'
=>
true
,
'is_advance'
=>
false
,
'is_discount'
=>
false
,
'is_yohoood'
=>
false
,
'is_limited'
=>
false
),
'is_soon_sold_out'
=>
false
),
array
(
'url'
=>
'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html'
,
'thumb'
=>
'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314'
,
'name'
=>
'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣'
,
'salePrice'
=>
'759.00'
,
'price'
=>
'799.00'
,
'tags'
=>
array
(
'is_new'
=>
true
,
'is_advance'
=>
false
,
'is_discount'
=>
false
,
'is_yohoood'
=>
false
,
'is_limited'
=>
false
),
'is_soon_sold_out'
=>
false
)
)
);
return
$this
->
_view
->
display
(
'shop'
,
array
(
'shopIndex'
=>
$data
,
'shopPage'
=>
true
));
}
}
...
...
Please
register
or
login
to post a comment