Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

framework @ 75bbc3b0
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
... ...
... ... @@ -353,6 +353,8 @@ class AbstractAction extends Controller_Abstract
*/
protected function setNavSide($guangChoosed = 'all')
{
$this->_view->assign('sideNav', \Index\SideModel::getLeftNav($guangChoosed));
/*
$this->_view->assign('sideNav', array(
0 => array(
'textCn' => '男生',
... ... @@ -415,6 +417,7 @@ class AbstractAction extends Controller_Abstract
)
),
));
*/
}
/**
... ...
... ... @@ -14,5 +14,7 @@ class CacheConfig
const KEY_ACTION_GIRLS_INDEX = 'key_action_girls_index'; // 女生首页
const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页
const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页
const KEY_COMMON_SIDE_NAV = 'key_common_side_nav'; // 公共的侧边栏
}
... ...
... ... @@ -102,13 +102,15 @@ class BrandData
/**
* 获取品牌banner数据
* @param integer $brandId 品牌ID
* @param integer $uid 用户id
* @return array banner数据
*/
public static function getBrandBanner($brandId)
public static function getBrandBanner($brandId, $uid)
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $brandId;
$param['uid'] = $uid;
$param['method'] = 'app.brand.banner';
$param['client_secret'] = Sign::getSign($param);
... ... @@ -133,6 +135,9 @@ class BrandData
*/
public static function selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1)
{
// 构建必传参数
$param = Yohobuy::param();
$selectItems = array(
'gender' => $gender,
'brand' => $brand,
... ... @@ -146,9 +151,7 @@ class BrandData
$queriedParams = array_filter($selectItems, function($v) {
return $v !== null;
});
// 构建必传参数
$param = Yohobuy::param();
$param += $queriedParams;
$param['method'] = 'app.search.brand';
$param['page'] = $page;
... ...
... ... @@ -22,27 +22,26 @@ class SideData
/**
* 左侧边栏的分类和图标数据
*
* 备注:暂不使用,因很少变,获取后还需要再封装
*
* @return array
*/
public static function leftNav()
{
$param = Yohobuy::param();
$param['client_type'] = 'iphone'; // 因安卓不返回icon的地址
$param['client_secret'] = Sign::getSign($param);
$query = Yohobuy::httpBuildQuery('', $param);
$urlList = array();
$urlList['getEntrance'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_ENTRANCE . $query;
$urlList['getCategory'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY . $query;
return Yohobuy::getMulti($urlList);
// $param = Yohobuy::param();
// $param['client_type'] = 'h5'; // 因安卓不返回icon的地址
// $param['client_secret'] = Sign::getSign($param);
// $query = Yohobuy::httpBuildQuery('', $param);
//
// return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param);
// $urlList = array();
// $urlList['getEntrance'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_ENTRANCE . $query;
// $urlList['getCategory'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY . $query;
//
// return Yohobuy::getMulti($urlList);
$param = Yohobuy::param();
$param['client_type'] = 'h5'; // 调用H5手机网站的
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param);
}
}
... ...
... ... @@ -5,19 +5,20 @@ use Api\Yohobuy;
use Api\Sign;
/**
* 新品到着,折扣专区接口操作类
* 搜索有关数据操作类
*
* @name NewsaleData
* @name SearchData
* @package Library/LibModels/wap/Product
* @copyright yoho.inc
* @version 1.0 (2015-10-8)
* @author gtskk <rocky.zhang@yoho.cn>
*/
class NewsaleData
class SearchData
{
/**
* 模糊搜索提供的关键词
*
* @param string $keyword 关键词
* @return array 根据跟定关键词搜索到的结果,包括数据数目count和提供的关键词keyword
*/
... ... @@ -35,18 +36,34 @@ class NewsaleData
/**
* 根据跟定查询数据搜索数据列表
* @param string $query 查询条件
* @param string $order 排列顺序,默认为倒序
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60哥
* @return array 搜索到的数据
*
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
* @param string $gender 性别,默认为null,"1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string $p_d 折扣,默认为null
* @param string $misort 商品分类,默认为null
* @param string $msort 商品分类,默认为null
* @param string $order 排序方式,默认为按照时间倒序排列s_t_desc,
* s_t_asc表示按时间正序排列,
* s_p_asc表示按价格正序排列,
* s_p_desc表示按价格倒序排列,
* p_d_asc表示按折扣正序排列,
* p_d_desc表示按折扣倒序排列
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60哥
* @return array 搜索到的数据
*/
public static function searchLiDatas($query, $order = 's_t_desc', $page = 1, $limit = 60)
public static function searchLiDatas($query = null, $brand = null, $gender = null, $p_d = null, $misort = null, $msort = null, $order = 's_t_desc', $page = 1, $limit = 60)
{
// 构建必传参数
$param = Yohobuy::param();
$param['query'] = $query;
is_null($query) || $param['query'] = $query;
is_null($brand) || $param['brand'] = $brand;
is_null($gender) || $param['gender'] = $gender;
is_null($p_d) || $param['p_d'] = $p_d;
is_null($misort) || $param['misort'] = $misort;
is_null($msort) || $param['msort'] = $msort;
$param['method'] = 'app.search.li';
$param['order'] = $order;
$param['page'] = $page;
... ...
... ... @@ -150,8 +150,6 @@ class FloorProcess
$build['textCn'] = $one['title'];
$result['hotCategory']['list'][] = $build;
}
return $result;
}
... ...
<?php
namespace Plugin\DataProcess;
use Plugin\Helpers;
/**
* 列表数据处理类
*/
class ListProcess
{
/**
* 返回商品和过滤数据
*
* @param $data
* @return array 处理之后的商品数据
*/
public static function getListData($data)
{
$result = array('new'=>array(), 'filter'=>array());
if(isset($data['product_list']))
{
$result['new'] = self::getProductData($data['product_list']);
}
if(isset($data['filter']))
{
$result['filter'] = self::getFilterData($data['filter']);
}
return $result;
}
/**
* 处理列表商品数据
*
* @param $data
* @return array 处理之后的商品数据
*/
public static function getProductData($data)
{
// 处理商品
$products = array();
foreach ($data as $value)
{
$products[] = Helpers::formatProduct($value);
}
return $products;
}
/**
* 处理筛选数据
*
* @param $data
* @return array 处理之后的筛选数据
*/
public static function getFilterData($data)
{
// 过滤条件数据
$filters = array('classify'=>array());
foreach ($data as $key => $val) {
if(empty($val))
{
continue;
}
if (!is_callable("self::$key")) {
continue;
}
$build = self::$key($val);
$filters['classify'][] = $build;
}
return $filters;
}
private static function brand($data)
{
$result = array(
'title' => '品牌',
'name' => '所有品牌',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '所有品牌'
)
)
);
// 对品牌数据按照品牌字母进行排序
self::sortArrByField($data, 'brand_alif');
foreach ($data as $one) {
$brand = array();
$brand['dataId'] = $one['id'];
$brand['name'] = $one['brand_name'];
$result['subs'][] = $brand;
}
return $result;
}
private static function color($data)
{
$result = array(
'title' => '颜色',
'name' => '所有颜色',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '所有颜色'
)
)
);
foreach ($data as $one) {
$color = array();
$color['dataId'] = $one['color_id'];
$color['name'] = $one['color_name'];
$result['subs'][] = $color;
}
return $result;
}
private static function discount($data)
{
$result = array(
'title' => '折扣',
'name' => '所有商品',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '所有商品'
)
)
);
foreach ($data as $one) {
$discount = array();
$discount['dataId'] = $one['count'];
$discount['name'] = $one['name'] .'折商品';
$result['subs'][] = $discount;
}
return $result;
}
private static function gender($data)
{
$result = array(
'title' => '性别',
'name' => '所有性别',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '所有性别'
),
array(
'dataId' => 1,
'name' => '男'
),
array(
'dataId' => 2,
'name' => '女'
),
)
);
return $result;
}
private static function group_sort($data)
{
$result = array(
'title' => '品类',
'name' => '所有品类',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '所有品类'
)
)
);
foreach ($data as $one) {
$category = array();
$category['dataId'] = $one['category_id'];
$category['name'] = $one['category_name'];
// 子品类
if(isset($one['sub']))
{
$category['subs'] = array();
foreach ($one['sub'] as $single) {
$subitem = array();
$subitem['dataId'] = $single['category_id'];
$subitem['name'] = $single['category_name'];
$category['subs'][] = $subitem;
}
}
$result['subs'][] = $category;
}
return $result;
}
private static function priceRange($data)
{
$result = array(
'title' => '价格',
'name' => '所有价格',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '所有价格'
)
)
);
foreach ($data as $one) {
$price = array();
$price['name'] = $one;
$result[] = $price;
}
return $result;
}
private static function size($data)
{
$result = array(
'title' => '尺码',
'name' => '所有尺码',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '所有尺码'
)
)
);
foreach ($data as $one) {
$size = array();
$size['dataId'] = $one['size_id'];
$size['name'] = $one['size_name'];
$result['subs'][] = $size;
}
return $result;
}
/**
* 按照数组中指定字段排序二维数组
*
* @param array &$array 需要排序的数组
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*/
private static function sortArrByField(&$array, $field, $desc = false){
$fieldArr = array();
foreach ($array as $k => $v) {
$fieldArr[$k] = $v[$field];
}
$sort = $desc == false ? SORT_ASC : SORT_DESC;
array_multisort($fieldArr, $sort, $array);
}
}
... ...
<VirtualHost *:8080>
ServerAdmin root@localhost
CustomLog "/Data/logs/apache/access.buy.test.yoho.cn.log" combined
ErrorLog "/Data/logs/apache/error.buy.test.yoho.cn.log"
ServerName buy.test.yoho.cn
DocumentRoot "/Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public"
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$
RewriteRule ^/(.+)$ /index.php [L]
<Directory />
LimitRequestBody 10485760
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:8080>
ServerAdmin root@localhost
CustomLog "/Data/logs/apache/access.guang.test.yoho.cn.log" combined
ErrorLog "/Data/logs/apache/error.guang.test.yoho.cn.log"
ServerName guang.test.yoho.cn
DocumentRoot "/Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public"
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule / /index.php?/guang/list/index&%1 [L]
RewriteRule ^/(.+)$ /index.php [L]
<Directory />
LimitRequestBody 10485760
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
\ No newline at end of file
... ...
server
{
listen 80;
server_name wap.yohobuy.com;
server_name buy.test.yoho.cn guang.test.yoho.cn;
#access_log /Data/logs/access.wap.yohobuy.com.log combined;
error_log /Data/logs/error.wap.yohobuy.com.log warn;
#access_log /Data/logs/access.buy.test.yoho.cn.log combined;
error_log /Data/logs/error.buy.test.yoho.cn.log warn;
root /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public;
#match ip
deny 192.168.1.1;
allow 218.94.75.50;
allow 218.94.75.58;
allow 123.56.138.21;
deny all;
location ~* \.html$ {
root /Data/PE/yohobuy/assets;
if (!-f $request_filename){
root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;
rewrite ^/(.+)$ /index.php?$1& last;
root /Data/code/git/yohobuy/assets;
if (-f $request_filename){
expires 3m;
}
expires 7d;
}
location / {
index index.php;
if (!-f $request_filename){
rewrite ^/(.+)$ /index.php?$1& last;
}
}
location ~* \.(ico|woff)$ {
... ... @@ -32,27 +30,26 @@ server
expires 7d;
}
location ~ .*\.php?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
location / {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
error_page 403 = http://wap.yohobuy.com;
error_page 404 = http://wap.yohobuy.com/error.html;
}
server
{
listen 80;
server_name static.wap.yohobuy.com;
server_name static.buy.test.yoho.cn;
#access_log /Data/logs/access.static.wap.yohobuy.com.log combined;
#error_log /Data/logs/error.static.wap.yohobuy.com.log warn;
#access_log /Data/logs/access.static.buy.test.yoho.cn.log combined;
#error_log /Data/logs/error.static.buy.test.yoho.cn.log warn;
root /Data/PE/yohobuy/static;
root /Data/code/git/yohobuy/static;
location / {
log_not_found off;
... ...
server
{
listen 80;
server_name wap.yohobuy.com;
#access_log /Data/logs/access.wap.yohobuy.com.log combined;
error_log /Data/logs/error.wap.yohobuy.com.log warn;
root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;
location ~* \.html$ {
root /Data/PE/yohobuy/assets;
if (!-f $request_filename){
root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;
rewrite ^/(.+)$ /index.php?$1& last;
}
expires 7d;
}
location / {
index index.php;
if (!-f $request_filename){
rewrite ^/(.+)$ /index.php?$1& last;
}
}
location ~* \.(ico|woff)$ {
expires 7d;
}
location = /crossdomain.xml {
expires 7d;
}
location ~ .*\.php?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 403 = http://wap.yohobuy.com;
error_page 404 = http://wap.yohobuy.com/error.html;
}
server
{
listen 80;
server_name static.wap.yohobuy.com;
#access_log /Data/logs/access.static.wap.yohobuy.com.log combined;
#error_log /Data/logs/error.static.wap.yohobuy.com.log warn;
root /Data/PE/yohobuy/static;
location / {
log_not_found off;
access_log off;
expires 30d;
}
location ~* \.(svg|eot|ttf|woff|otf)$ {
add_header Access-Control-Allow-Origin *;
expires 30d;
}
}
\ No newline at end of file
... ... @@ -25,6 +25,7 @@ class BoysController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'boysHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getBoysFloor()
... ...
... ... @@ -25,6 +25,7 @@ class GirlsController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'grilsHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getGirlsFloor()
... ...
... ... @@ -25,6 +25,7 @@ class KidsController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'kidsHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getKidsFloor()
... ...
... ... @@ -25,6 +25,7 @@ class LifestyleController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'lifestyleHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getLifestyleFloor()
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\SearchData;
/**
* 搜索页
*/
... ... @@ -41,4 +43,52 @@ class SearchController extends AbstractAction
);
$this->_view->display('index', array('search' => $data, 'searchPage' => true, 'pageFooter' => true));
}
/**
* 模糊搜索指定字符
*
* @return array 模糊搜索的结果
*/
public function fuzzysearch()
{
if($this->isAjax())
{
$keyword = $this->post('keyword', '');
$result = SearchData::searchFuzzyDatas($keyword);
$this->_view->display('list', array('searchPage' => true, 'pageFooter' => true));
}
}
/**
* 根据指定字符串查询数据
*
* @return array 搜索的结果
*/
public function listsearch()
{
$query = $this->get('query', '');
$result = SearchData::searchLiDatas($query);
$this->echoJson($result);
}
/**
* 根据指定条件筛选查询到数据
*
* @return array 筛选之后的结果
*/
public function sortsearch()
{
if($this->isAjax())
{
$query = $this->post('query', '');
$result = SearchData::searchLiDatas($query);
$this->echoJson($result);
}
}
}
\ No newline at end of file
... ...
<?php
namespace Index;
use LibModels\Wap\Home\SideData;
use Configs\CacheConfig;
use Plugin\Helpers;
use Plugin\Cache;
/**
*
* @name SideModel
* @package models/Index
* @copyright yoho.inc
* @version 1.0 (2015-10-21 21:21:09)
* @author fei.hong <fei.hong@yoho.cn>
*/
class SideModel
{
/**
* 获取左侧边栏数据
*
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
*/
public static function getLeftNav($guangChoosed = 'all')
{
$result = array();
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_COMMON_SIDE_NAV, 'master');
if (!empty($result)) {
$result[] = self::genLeftNavGuang($guangChoosed);
return $result;
}
}
// 调用接口获取后台配置的侧边栏数据
$side = SideData::leftNav();
if (!empty($side['data'])) {
foreach ($side['data'] as $key => $value) {
// 逛的按照原来的做法,使用配置
if ($value['sort_name_en'] === 'TRENDFINDER') {
continue;
}
$result[$key]['textCn'] = $value['sort_name'];
$result[$key]['textEn'] = $value['sort_name_en'];
$result[$key]['styleClass'] = strtolower($value['sort_name_en']);
$result[$key]['url'] = $value['sort_url'];
$result[$key]['img'] = Helpers::getImageUrl($value['sort_ico'], 60, 60);
}
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_COMMON_SIDE_NAV, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result);
}
}
// 追加逛的子分类数据
$result[] = self::genLeftNavGuang($guangChoosed);
return $result;
}
/**
* 获取并生成左侧边栏中逛的数据
*
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
* @return array
*/
private static function genLeftNavGuang($guangChoosed = 'all')
{
return array(
'textCn' => '逛',
'textEn' => 'TRENDFINDER',
'styleClass' => 'guang',
'subNav' => array(
'list' => array(
0 => array(
'textCn' => '逛',
'textEn' => 'TrendFinder',
'back' => true,
'isSelect' => false,
'bgColor' => ($guangChoosed === 'girls') ? '#FF88AE' : false,
),
1 => array(
'textCn' => '查看全部',
'textEn' => '',
'back' => false,
'isSelect' => ($guangChoosed === 'all') ? true : false,
'url' => '/guang/list/index?gender=1,2,3'
),
2 => array(
'textCn' => '只看男生',
'textEn' => 'Boys',
'back' => false,
'isSelect' => ($guangChoosed === 'boys') ? true : false,
'url' => '/guang/list/index?gender=1,3'
),
3 => array(
'textCn' => '只看女生',
'textEn' => 'Girls',
'back' => false,
'isSelect' => ($guangChoosed === 'girls') ? true : false,
'url' => '/guang/list/index?gender=2,3',
),
)
)
);
}
}
... ...
... ... @@ -40,7 +40,7 @@ class BrandController extends AbstractAction
$brands = $brandsData['data'];
}
echo '<pre>';
/*echo '<pre>';
var_dump($brandTop, $brands);exit;*/
$data = array (
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\SearchData;
use LibModels\Wap\Category\BrandData;
use Plugin\DataProcess\ListProcess;
use Plugin\Helpers;
/**
* 商品列表页
*/
class ListController extends AbstractAction
{
public function indexAction()
... ... @@ -13,101 +16,77 @@ class ListController extends AbstractAction
$data = array(
'goodListPage' => true,
'goodList' => array(
'search' => 'Aape',
'brandWay' => array(
'url' => 'http://aape.m.yohobuy.com/',
'name' => 'Aape',
'thumb' => 'http://img13.static.yhbimg.com/brandLogo/2015/08/26/15/02261f64c198cb4b181c5ef9e61f38f4b9.jpg?imageMogr2/thumbnail/150x70/extent/150x70/background/d2hpdGU=/position/center/quality/90'
),
)
);
$brand = $this->get('brand', null);
$gender = $this->get('gender', null);
$p_d = $this->get('p_d', null);
$misort = $this->get('misort', null);
$msort = $this->get('msort', null);
// 查询数据
$listData = SearchData::searchLiDatas(null, $brand, $gender, $p_d, $misort, $msort);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] === 200) {
$tmpData = $listData['data'];
$data['goodList'] = ListProcess::getListData($tmpData);
}
$this->_view->display('index', $data);
}
public function brandAction()
{
$brand = $this->get('brand', null);
$gender = $this->get('gender', null);
$sort = $this->get('sort', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('p_d', null);
$data = array(
'pageHeader' => array(
'navHome' => '/'
),
'goodListPage' => true,
'goodList' => array(
'brand' => array(
'id' => 1,
'banner' => 'http://img10.static.yhbimg.com/brandBanner/2015/08/26/07/015af5d6ee626cb132cd9c436e896fae26.jpg?imageMogr2/crop/640x'
),
'new' => array(
array(
'id' => 1,
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/09/15/03/02e50b1037b45b90aa8f33ee328b18facf.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',
'url' => '',
'name' => 'Aape X YO’HOOD moon face YOH',
'salePrice' => 599,
'tags' => array(
'is_new' => true,
'is_discount' => true
),
'is_soon_sold_out' => true
),
array(
'id' => 2,
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/09/15/03/0101b0c3998752d02724a5512c6efcb241.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',
'url' => '',
'name' => 'Aape X YO’HOOD moon face YOH',
'salePrice' => 99,
'tags' => array(
'is_yohoood' => true
),
'is_soon_sold_out' => true
)
),
'filter' => array(
array(
'classify' => array(
array(
'title' => '性别',
'name' => '全部性别',
'default' => true,
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '全部性别'
),
array(
'dataId' => 1,
'name' => '男'
),
array(
'dataId' => 3,
'name' => '女'
)
)
),
array(
'title' => '尺寸',
'name' => 'XL',
'subs' => array(
array(
'dataId' => 0,
'name' => '全部尺寸'
),
array(
'dataId' => 1,
'name' => 'S'
),
array(
'dataId' => 2,
'name' => 'M'
),
array(
'dataId' => 3,
'name' => 'L'
),
array(
'chosed' => true,
'dataId' => 4,
'name' => 'XL'
),
array(
'dataId' => 5,
'name' => 'XXL'
)
)
)
)
)
'id' => $brand
)
)
);
// 获取品牌介绍信息
$introData = BrandData::getBrandIntro($brand);
if(isset($introData['code']) && $introData['code'] === 200)
{
$data['goodList']['brand']['intro'] = isset($introData['data']['brand_intro']) ? $introData['data']['brand_intro'] : '';
}
// 获取品牌banner的数据
$bannerData = BrandData::getBrandBanner($brand, 0);
if(isset($bannerData['code']) && $bannerData['code'] === 200)
{
$data['goodList']['brand']['banner'] = isset($bannerData['data']['banner']) ? Helpers::getImageUrl($bannerData['data']['banner'], 640, 75) : '';
}
// 查询数据
$listData = BrandData::selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] === 200) {
$tmpData = $listData['data'];
// 设置品牌名称
$data['pageHeader']['navTitle'] = isset($tmpData['brand_name']) ? $tmpData['brand_name'] : '';
$data['goodList'] += ListProcess::getListData($tmpData);
}
$this->_view->display('index', $data);
}
}
\ No newline at end of file
}
... ...
... ... @@ -16,8 +16,10 @@ class NewsaleController extends AbstractAction
$data = array(
'newArrival' => true,
'header' => array(
'title' => '新品到着'
'pageHeader' => array(
'navBack' => true,
'navTitle' => '新品到着',
'navHome' => '/'
)
);
... ... @@ -74,8 +76,10 @@ class NewsaleController extends AbstractAction
$data = array(
'discount' => true,
'header' => array(
'title' => 'SALE'
'pageHeader' => array(
'navBack' => true,
'navTitle' => 'SALE',
'navHome' => '/'
)
);
... ...