Authored by 周少峰

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/web-list

... ... @@ -465,14 +465,14 @@ class WebAction extends Controller_Abstract
*/
protected function setWebNavHeader($channel = '')
{
if(empty($channel)) {
$channel = \Index\HomeModel::getSwitchChannel();
}
else {//设置频道
\Index\HomeModel::setSwitchToCookie($channel);
}
// if(empty($channel)) {
// $channel = \Index\HomeModel::getSwitchChannel();
// }
// else {//设置频道
// \Index\HomeModel::setSwitchToCookie($channel);
// }
$header = array(
'navbars'=>\Index\HomeModel::getNavBars($channel),
'navbars'=> \Index\HomeModel::getNavBars($channel),
'gobytype'=> 'gobuy'.$channel,
'searchcate'=>'searchcate'.$channel,
'myyoho' => array(
... ...
... ... @@ -59,5 +59,9 @@ class CacheConfig
const KEY_INDEX_BRANDS_LIST_DATA = 'key_index_brands_list_data';//频道brands数据
const KEY_CODE_YOHOCOIN_BANNER = 'key_code_yohocoin_banner';// 有货币banner数据
const KEY_WEB_HOME_NAVBAR_DATA = 'key_web_home_navbar_data';//web的导航数据
const KEY_WEB_HOME_CHANNEL_DATA = 'key_web_home_channel_data';//web首页频道数据[boys, girls, kids, lifestyle]
const KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA = 'key_web_home_newarrival_data';//web频道最新上架数据[boys, girls, kids, lifestyle]
}
... ...
... ... @@ -22,7 +22,7 @@ class IndexData
$params = array('parent_id'=>'','platform'=>'web',
'status'=> $status,'fields'=> $fields
);
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_CATEGORY,'getCategory', $params, false);
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_CATEGORY,'getCategory', $params, true);
}
/**
... ...
<?php
namespace LibModels\Web\Product;
use Api\Yohobuy;
use Api\Sign;
/**
* 热销排行
*
* */
class HotrankData extends \LibModels\Wap\Product\SearchData
{
const URI_HOTRANK_RES = '/operations/service/v4/resource';
const URI_HOTRANK_TAG = '/operations/api/v5/resource/get';
/**
获取热销排行
* 分类标签
*/
public static function getHotranktag($client_type = 'web',$channel = 0, $is_concurrent = true, $callback = '')
{
// 构建必传参数
$params = Yohobuy::param();
$params['client_type'] = 'web';
$params['channel'] =$channel ;
$params['is_concurrent'] = true;
$params['callback'] = $callback;
$params['client_secret'] = Sign::getSign($params);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_HOTRANK_TAG, $params);
}
}
\ No newline at end of file
... ...
... ... @@ -263,7 +263,8 @@ class Process
'mergeNewReportData',
'mergeSinglehotData2',
'mergeHotCategoryData',
'mergeGirlkidsData'
'mergeGirlkidsData',
'mergeHotBrandsData'
);
foreach ($data as $key => $val) {
foreach ($mergeProcessList as $merge) {
... ... @@ -807,7 +808,7 @@ class Process
// 排序
uksort($result, function ($a, $b) use($skns) {
$skn_arr = explode(' ', $skns);
return array_search($a, $skn_arr) > array_search($b, $skn_arr);
return array_search($a, $skn_arr) > array_search($b, $skn_arr);
});
$pos = 1;
//添加TOP标示
... ... @@ -819,8 +820,61 @@ class Process
break;
}
$pos ++;
}
return $result;
}
}
return $result;
}
/**
* 热门品牌数据处理
*
* @param array $data
* @param string $type
*/
public static function mergeHotBrandsData($key,array &$data,$type)
{
$result = array();
$temp = array();
if ($data[$key]['template_name'] == 'custom_brands')
{
// print_r($data[$key]);
$result = array(
'hotBrands' => array(
'name' => '',
'brandUrl' => ''
)
);
// text模版
$result['hotBrands']['name'] = '热门品牌';
//floor模板
$floor = array(
'logoBrand' => '',
'moreBrand' => ''
);
$brands = $data[$key]['data']['list'];
foreach ($brands as $val)
{
$width = 185;
$height = 86;
$type = 'lifestyle';
$val['src'] = Images::getImageUrl($val['src'], $width, $height, 2);
$val['url'] = Helpers::transUrl($val['url'], $type);
$floor['logoBrand'][] = array(
'href' => $val['url'],
'img' => $val['src']
);
}
$floor['moreBrand'] = 'http://yohobuy.com/brands';
//$floor['moreBrand'] = 'http://yohobuy.com/brands?gender=1,3&openby:yohobuy={"action":"go.list","params":{"actiontype":0,"gender":"1,3"}}';
//print_r($floor);
$type_key = sprintf("%s_%s", $type, $key);
$cacheKey = sprintf("%s_%s", CacheConfig::KEY_INDEX_BRANDS_LIST_DATA, $type_key);
//print_r($cacheKey);
Cache::set($cacheKey, $floor, 7200);
$result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key;
//print_r($result['hotBrands']['brandUrl']);
}
return $result;
}
}
\ No newline at end of file
... ...
... ... @@ -240,9 +240,8 @@ class HelperSearch
public static function groupSort($sort)
{
$options = self::$options;
if (isset($options['controller']) && $options['controller'] != 'Search') {
if (isset($options['controller']) && $options['controller'] == 'Search') {
return array();
}
//设置导航
... ... @@ -286,7 +285,6 @@ class HelperSearch
}
}
$result['list'] = $sortList;
// print_r($result); exit;
return $result;
}
... ... @@ -294,7 +292,7 @@ class HelperSearch
{
$result = array();
$options = self::$options;
if (!isset($options['controller']) || $options['controller'] != 'Search') {
if (!isset($options['controller']) || $options['controller'] == 'Search') {
return $result;
}
$params = self::$params;
... ...
... ... @@ -88,7 +88,6 @@ $invoice.on('touchend', '.checkbox', function() {
if ($this.hasClass('icon-checkbox')) {
$invoice.removeClass('focus');
}
return false;
});
function orderCompute() {
... ... @@ -243,10 +242,10 @@ $('.coin').on('touchend', function() {
orderCompute();
});
$invoice.on('touchend', function(e) {
$invoice.on('touchend', '.checkbox', function(e) {
var $this = $(this);
orderInfo('invoice', $this.find('.checkbox').hasClass('icon-cb-checked'));
orderInfo('invoice', $this.hasClass('icon-cb-checked'));
e.preventDefault();
e.stopPropagation();
});
... ...
... ... @@ -34,6 +34,20 @@
</div>
{{/if}}
{{#if gender}}
<div class="channel section">
<span class="title">性别:</span>
<div class="attr-content clearfix">
{{#each channel}}
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
{{name}}
</a>
{{/each}}
</div>
</div>
{{/if}}
{{#if sort}}
<div class="sort section">
<span class="title">分类:</span>
... ...
... ... @@ -135,7 +135,6 @@ exports.init = function(num) {
// 鼠标悬浮获取到商品信息后显示第一张图片
if (data[0] && data[0].src) {
$(event.target).find('.good-thumb img').attr('src', data[0].src);
$goodInfoMain.find('.good-thumb img').attr('src', data[0].src);
}
... ...
... ... @@ -82,6 +82,7 @@
width: 14px;
border: 1px solid #fff;
margin-bottom: -3px;
background-size: 100% !important;
}
.clear-checked {
... ... @@ -283,6 +284,7 @@
border: 1px solid #ccc;
margin-bottom: -6px;
margin-right: 5px;
background-size: 100% !important;
}
.senior {
... ...
... ... @@ -125,9 +125,20 @@
}
}
@keyframes slideRight {
from {
max-width: 0;
}
to {
max-width: 150px;
}
}
.good-select-color {
float: left;
margin-top: 22px;
overflow: hidden;
animation: slideRight 600ms 1;
ul {
display: block;
... ... @@ -175,4 +186,4 @@
}
}
\ No newline at end of file
}
... ...
... ... @@ -167,15 +167,15 @@ class DetailModel
$colorGroup = array();
$sizeGroup = array();
$goodsGroup = array();
$colorList = array();
$sizeList = array();
$allSizeList = array(); // 所有尺码列表
$thumbImageList = array();
$colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔
$colorStorageNum = 0;
$totalStorageNum = 0; // 总库存数
foreach ($baseInfo['goodsList'] as $value) {
$colorStorageNum = 0;
$sizeStorageStr = '';
// 商品分组
if (isset($value['goodsImagesList'])) {
... ... @@ -188,10 +188,10 @@ class DetailModel
}
// 商品的尺码列表
$colorStorageGroup[$value['productSkc']] = array();
$colorStorageGroup[ $value['productSkc'] ] = array();
if (isset($value['goodsSizeBoList'])) {
foreach ($value['goodsSizeBoList'] as $size) {
$sizeList[$value['productSkc']][] = array(
$sizeList[ $value['productSkc'] ][] = array(
'id' => $size['id'],
'skuId' => $size['goodsSizeSkuId'],
'goodsId' => $size['goodsId'],
... ... @@ -199,19 +199,21 @@ class DetailModel
'name' => $size['sizeName'],
'sizeNum' => $size['goodsSizeStorageNum'],
);
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
$allSizeList[ $size['sizeName'] ] = empty($allSizeList[ $size['sizeName'] ]) ? $size['goodsSizeStorageNum'] : $allSizeList[ $size['sizeName'] ];
$colorStorageNum += intval($size['goodsSizeStorageNum']);
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
$colorStorageGroup[$value['productSkc']][$size['sizeName']] = $size['goodsSizeStorageNum'];
}
// 颜色分组
$colorGroup[] = array(
$colorList[] = array(
'id' => $value['colorId'],
'skcId' => $value['productSkc'],
'name' => $value['colorName'],
'goodsName' => $value['goodsName'],
'colorNum' => $colorStorageNum,
'sizeNumStr' => rtrim($sizeStorageStr, '/'),
);
}
... ... @@ -221,25 +223,30 @@ class DetailModel
// 商品库存总数
$totalStorageNum += $colorStorageNum;
}
// 遍历所有尺码,构建颜色显示数据
$i = 1;
foreach ($allSizeList as $sizeName => $value) {
// 默认尺码
$sizeGroup[0]['size'][] = array(
'name' => $sizeName, // 尺码名称
'sizeNum' => empty($value) ? false : true, // 是否有库存 (false:表示没有库存,true:表示有库存)
);
// 遍历所有尺码,统计出该尺码的每个颜色的库存量,没有时添0,不能空着,因为JS中需要判断
foreach ($sizeList as $skc => $sizeArr) {
foreach ($sizeArr as $key => $value) {
$sizeStorageStr = '';
foreach ($colorStorageGroup as $colorArr) {
if (isset($colorArr[$value['name']])) {
$sizeStorageStr .= $colorArr[$value['name']] . '/';
} else {
$sizeStorageStr .= '0/';
}
}
$sizeList[$skc][$key]['colorNumStr'] = rtrim($sizeStorageStr, '/');
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
foreach ($colorList as $colorArr) {
$colorArr['colorNum'] = isset($colorStorageGroup[ $colorArr['skcId'] ][$sizeName]) ? $colorStorageGroup[ $colorArr['skcId'] ][$sizeName] : 0;
$colorGroup[$i]['color'][] = $colorArr;
}
++ $i;
}
// 格式化尺码对应的各个颜色分组
foreach ($colorGroup as $value) {
$sizeGroup[]['size'] = $sizeList[$value['skcId']];
// 遍历所有颜色, 构建尺码显示数据
foreach ($colorList as $value) {
// 各个尺码的颜色,每行显示一个颜色的对应尺码
$sizeGroup[]['size'] = $sizeList[ $value['skcId'] ];
// 默认颜色
$colorGroup[0]['color'][] = $value;
}
// 商品图: 多个
... ... @@ -563,9 +570,8 @@ class DetailModel
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$consultList = DetailData::consultList($uid, $productId, $pageNum, $pageSize);
if (isset($consultList['code']) && $consultList['code'] === 200) {
$consultList = $consultList['data']['list'];
$build = array();
foreach ($consultList as $value) {
foreach ($consultList['data']['list'] as $value) {
$build['question'] = $value['ask'];
$build['time'] = $value['ask_time'];
$build['answer'] = $value['answer'];
... ... @@ -615,21 +621,20 @@ class DetailModel
$result = array('code' => 400, 'message' => '出错啦~');
do {
$record = DetailData::upvoteConsult($uid, $id);
if (empty($uid)) {
$result['code'] = 401;
$result['message'] = '用户id为空';
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
break;
}
// 处理数据
if ($record && isset($record['code'])) {
$record = DetailData::upvoteConsult($uid, $id);
if (!empty($record['code'])) {
$result['code'] = $record['code'];
$result['message'] = $record['message'];
}
}while(false);
} while (false);
return $result;
}
... ... @@ -648,21 +653,20 @@ class DetailModel
$result = array('code' => 400, 'message' => '出错啦~');
do {
$record = DetailData::usefulConsult($uid, $id);
if (empty($uid)) {
$result['code'] = 401;
$result['message'] = '用户id为空';
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
break;
}
// 处理数据
if ($record && isset($record['code'])) {
$record = DetailData::usefulConsult($uid, $id);
if (!empty($record['code'])) {
$result['code'] = $record['code'];
$result['message'] = $record['message'];
}
}while(false);
} while (false);
return $result;
}
... ...
<?php
use Action\WebAction;
/**
* 默认控制器
*/
use Action\WebAction;
class IndexController extends WebAction
{
... ...
... ... @@ -63,59 +63,64 @@ class HomeModel
return array();
}
$menu = array();
$item = array();
foreach ($data['data'] as $val) {
$item = array(
'name_cn' => $val['sort_name'], // 父级
'name_en' => $val['sort_name_en'],
'link' => $val['sort_url'],
'icon' => $val['sort_ico'],
'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
'index_main' => 0,
'is_hot' => $val['is_hot'] == 'Y' ? true : false,
'is_new' => $val['is_new'] == 'Y' ? true : false,
// 'subnav' => array()
);
foreach ($val['sub'] as $sub) { // 二级
$index_sub = 0;
$subnav = array(
'name' => $sub['sort_name'],
'name_en' => $sub['sort_name_en'],
'link' => $sub['sort_url'],
'is_hot' => $sub['is_hot'] == 'Y' ? true : false,
'is_new' => $sub['is_new'] == 'Y' ? true : false,
// 'thirdnav' => array(),
'index_sub' => $index_sub ++
);
if (isset($sub['sub'])) {
foreach ($sub['sub'] as $thirdsub) { // 三级
$thirdnav = array(
'title' => $thirdsub['sort_name'],
'name_en' => $thirdsub['sort_name_en'],
'link' => $thirdsub['sort_url'],
// 'branditems' => array()
);
if (isset($thirdsub['sub'])) {
foreach ($thirdsub['sub'] as $fourthnav) { // 四级
$thirdnav['branditems'][] = array(
'brandname' => $fourthnav['sort_name'],
'link' => $fourthnav['sort_url'],
'hot' => $fourthnav['is_hot'] == 'Y' ? 'hot' : ''
);
}
}
$subnav['thirdnav'][] = $thirdnav;
}
}
$item['subnav'][] = $subnav;
}
$menu[] = $item;
$key = sprintf('%s_%s_%s',CacheConfig::KEY_WEB_HOME_NAVBAR_DATA, md5(serialize($data)), $channel);
$menu = Cache::get($key);
if(empty($menu)) {
$item = array();
foreach ($data['data'] as $val) {
$item = array(
'name_cn' => $val['sort_name'], // 父级
'name_en' => $val['sort_name_en'],
'link' => $val['sort_url'],
'icon' => $val['sort_ico'],
'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
'index_main' => 0,
'is_hot' => $val['is_hot'] == 'Y' ? true : false,
'is_new' => $val['is_new'] == 'Y' ? true : false,
// 'subnav' => array()
);
foreach ($val['sub'] as $sub) { // 二级
$index_sub = 0;
$subnav = array(
'name' => $sub['sort_name'],
'name_en' => $sub['sort_name_en'],
'link' => $sub['sort_url'],
'is_hot' => $sub['is_hot'] == 'Y' ? true : false,
'is_new' => $sub['is_new'] == 'Y' ? true : false,
// 'thirdnav' => array(),
'index_sub' => $index_sub ++
);
if (isset($sub['sub'])) {
foreach ($sub['sub'] as $thirdsub) { // 三级
$thirdnav = array(
'title' => $thirdsub['sort_name'],
'name_en' => $thirdsub['sort_name_en'],
'link' => $thirdsub['sort_url'],
// 'branditems' => array()
);
if (isset($thirdsub['sub'])) {
foreach ($thirdsub['sub'] as $fourthnav) { // 四级
$thirdnav['branditems'][] = array(
'brandname' => $fourthnav['sort_name'],
'link' => $fourthnav['sort_url'],
'hot' => $fourthnav['is_hot'] == 'Y' ? 'hot' : ''
);
}
}
$subnav['thirdnav'][] = $thirdnav;
}
}
$item['subnav'][] = $subnav;
}
$menu[] = $item;
}
Cache::set($key, $menu, 3600);
}
return $menu;
}
/**
/**
* 选择频道
*
* @return void
... ... @@ -165,9 +170,14 @@ class HomeModel
*/
public static function getChannelResource($channel, $content_code)
{
$resource = IndexData::getResourceData($content_code);
// 格式化数据
$data = ChannelProcess::getFormat($channel, $resource['data']);
$key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.$channel);
$data = Cache::get($key);
if(empty($data)) {
$resource = IndexData::getResourceData($content_code);
// 格式化数据
$data = ChannelProcess::getFormat($channel, $resource['data']);
Cache::set($key, $data, 3600);
}
return $data;
}
... ... @@ -213,45 +223,51 @@ class HomeModel
public static function getNewArrival($channel)
{
$result = array();
$params = array(
'order' => 's_t_desc',
'shelve_time' => strtotime("-60 days") . ',' . time()
);
//男首频道最新上架参数是gender=1,3
if($channel == self::COOKIE_NAME_BOYS) {
$params['gender'] = '1,3';
}
//女首频道最新上架参数是gender=2,3
else if($channel == self::COOKIE_NAME_GIRLS) {
$params['gender'] = '2,3';
}
// 最新上架分类
if (isset(ChannelConfig::$newArrivalSortList[$channel])) {
$sortList = ChannelConfig::$newArrivalSortList[$channel];
// 获取分类列表获取商品信息
$goodsList = SearchData::getSearchDataBySort($params, $sortList);
$pos = 1;
foreach ($goodsList as $goods) {
// 格式化数据
$val = Helpers::formatProduct($goods, true, true, true, 280, 373);
if ($val['price'] == false) {
$val['price'] = $val['salePrice'];
}
$val['url'] = sprintf('%s?channel=%s&from=%s-n_%s', $val['url'], $channel , $channel, $pos++);
//TODO 字段要调整
$val['isFew'] = $val['is_soon_sold_out'];
$val['tags']['isLimit'] = $val['tags']['is_limited'];
$val['tags']['isSale'] = false;//$val['tags']['is_discount'];暂时不显示
$val['tags']['isNew'] = false;//$val['tags']['is_new'];暂时不显示
$val['tags']['isYearMidPromotion'] = $val['tags']['midYear'];
$val['tags']['isYearEndPromotion'] = $val['tags']['yearEnd'];
$val['tags']['isReNew'] = false;//$val['tags']['is_advance'];暂时不显示
unset($val['tags']['is_advance'], $val['tags']['is_discount'], $val['tags']['is_limited'], $val['tags']['is_new'],
$val['tags']['is_yohood'], $val['tags']['midYear'], $val['tags']['yearEnd']);
if (! empty($val)) {
$result[] = $val;
}
}
$key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA.'_'.$channel);
//缓存数据
$result = Cache::get($key);
if(empty($result)) {
$params = array(
'order' => 's_t_desc',
'shelve_time' => strtotime("-60 days") . ',' . time()
);
//男首频道最新上架参数是gender=1,3
if($channel == self::COOKIE_NAME_BOYS) {
$params['gender'] = '1,3';
}
//女首频道最新上架参数是gender=2,3
else if($channel == self::COOKIE_NAME_GIRLS) {
$params['gender'] = '2,3';
}
// 最新上架分类
if (isset(ChannelConfig::$newArrivalSortList[$channel])) {
$sortList = ChannelConfig::$newArrivalSortList[$channel];
// 获取分类列表获取商品信息
$goodsList = SearchData::getSearchDataBySort($params, $sortList);
$pos = 1;
foreach ($goodsList as $goods) {
// 格式化数据
$val = Helpers::formatProduct($goods, true, true, true, 280, 373);
if ($val['price'] == false) {
$val['price'] = $val['salePrice'];
}
$val['url'] = sprintf('%s?channel=%s&from=%s-n_%s', $val['url'], $channel , $channel, $pos++);
//TODO 字段要调整
$val['isFew'] = $val['is_soon_sold_out'];
$val['tags']['isLimit'] = $val['tags']['is_limited'];
$val['tags']['isSale'] = false;//$val['tags']['is_discount'];暂时不显示
$val['tags']['isNew'] = false;//$val['tags']['is_new'];暂时不显示
$val['tags']['isYearMidPromotion'] = $val['tags']['midYear'];
$val['tags']['isYearEndPromotion'] = $val['tags']['yearEnd'];
$val['tags']['isReNew'] = false;//$val['tags']['is_advance'];暂时不显示
unset($val['tags']['is_advance'], $val['tags']['is_discount'], $val['tags']['is_limited'], $val['tags']['is_new'],
$val['tags']['is_yohood'], $val['tags']['midYear'], $val['tags']['yearEnd']);
if (! empty($val)) {
$result[] = $val;
}
}
}
Cache::set($key, $result, 3600);
}
return $result;
}
... ...
<?php
namespace product;
use Plugin\Images;
use Plugin\Helpers;
use Plugin\Cache;
use Configs\CacheConfig;
use LibModels\Web\Home\IndexData;
use \LibModels\Web\Product\HotrankData;
use \LibModels\Web\Product\SearchData;
class HotrankModel {
/**
* 人气单品 一周热卖
*/
static public function getSearchData($condition, $options)
{
// 调用接口查询商品数据
$result = SearchData::searchElasticByCondition($condition);
//print_r($result);
if(!empty($result)){
$res = self::getProductList($result);
if(!empty($res['popular'])){
$data['popular'] = $res['popular'];
}
if(!empty($res['hotWeek'])){
$data['hotWeek'] = $res['hotWeek'];
}
}
return $data;
}
/**
* 获取分类标签
*/
static public function getHotranktag($classes)
{
$list = SearchData::getClassesData($classes);
//print_r($list);
$nav = array();
if(!empty($list['data']['sort'])){
foreach($list['data']['sort'] as $li=>$lt){
$nav[$li]['sid'] = $lt['sort_id'];
$nav[$li]['textCn'] = $lt['sort_name'];
}
}
//print_r($nav);
return $nav;
}
/**
* 人气单品 一周热卖 数据处理
*/
static public function getProductList($result)
{
/*----product start---------*/
if(empty($result) || empty($result['data']) || empty($result['data']['product_list'])){
return;
}
$data = $result['data']['product_list'];
$popular = array();
$hotWeek = array();
foreach($data as $key=>$val){
if(empty($val['goods_list'])){
continue;
}
$defaultGoodsId = 0;
foreach ($val['goods_list'] as $v){
if($v['is_default'] == 'Y'){
$defaultGoodsId = $v['goods_id'];
}
}
if(empty($defaultGoodsId)){
$defaultGoodsId = $val['goods_list'][0]['goods_id'];
}
$product_id = empty($val['product_id']) ? '' : $val['product_id'];
$re['url'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html';
$re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
$re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
$re['name'] = $val['product_name'];
if($key <= 9){
$re['rank'] = $key + 1;
if($key <= 5){
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$popular['list'][] = $re;
}else{
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$popular['list'][] = $re;
}
}else{
$re['rank'] = '';
$re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$hot[] = $re;
}
}
$popular['name'] = '人气单品';
$hotWeek = array(
'name'=>'一周热卖',
'list'=>$hot,
);
return array('popular'=>$popular,'hotWeek'=>$hotWeek);
}
}
\ No newline at end of file
... ...
<?php
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use Passport\PassportModel;
use Plugin\Helpers;
use LibModels\Wap\Passport\BackData;
use Plugin\AuthCode;
class BackController extends WebAction {
/**
* 找回密码
*/
public function indexAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'backPage' => true,
'back' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countryCode' => '86',
'countryName' => '中国',
'captchaUrl' => '/passport/images?t=1449799445',
'countryList' => RegData::getAreasData()
)
);
$this->_view->display ( 'index', $data );
}
/**
* 校验验证码
*/
public function authcodeAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post( 'area', '86' ));
$verifyCode = $this->post ('verifyCode', '');
$data = array('code' => 400, 'message' =>'验证失败');
if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))
&& PassportModel::verifyCode($verifyCode)) {
$data['code'] = 200;
$data['message'] = '验证成功';
}
echo $this->echoJson($data);
}
/**
* 邮箱
*/
public function emailAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post('area', '86'));
$verifyCode = $this->post('verifyCode', '');
if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if ($data ['code'] == 200) {
$this->setSession('email', $email);
$this->redirect ('sendemail');
} else {
$this->redirect ('index');
}
} else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile, $area);
if ($data ['code'] == 200) {
$this->setSession ('mobile', $mobile );
$this->setSession ('area', $area );
$this->setSession ('verifyCode', $verifyCode );
$this->redirect ('verification');
} else {
$this->redirect ('index');
}
}
}
/**
* 发送邮件页面
*/
public function sendemailAction() {
$email = $this->getSession ('email');
if (empty ( $email )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'sendEmail' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码页面
*/
public function backcodeAction() {
$code = $this->get('code');
$info = $this->checkCode($code);
if (empty ( $info )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetPage' => true,
'resetPwd' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array(),
'code' => $code
)
);
$this->_view->display('reset-pwd', $data);
}
/**
* 更新密码接口
*/
public function updateAction() {
$code = $this->post('code');
$password = $this->post('pwd');
$info = $this->checkCode($code);
if (Helpers::verifyPassword ($password) && ! empty ($info)) {
// 修改密码
if (isset ( $info ['mobile'] )) { // 手机号修改密码
$mobile = $info ['mobile'];
$token = $info ['token'];
$area = $info ['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if ($data ['code'] == 200) {
$this->redirect ( 'resetSuccess' );
}
} else if (isset ($info ['uid'])) { // 其他方式修改密码
$uid = $info ['uid'];
$this->redirect ( 'resetSuccess' );
}
}
// 跳转错误页面
// $this->redirect('/error/index');
}
/**
* 重置密码成功
*/
public function resetSuccessAction() {
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'resetSuccess' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display ( 'reset-success', $data );
}
/**
* 手机验证页面
*/
public function verificationAction() {
$mobile = $this->getSession ('mobile');
$area = $this->getSession ('area');
$verifyCode = $this->getSession ('verifyCode');
if (empty ($mobile)) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'vertificationPage' => true,
'verification' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'mobile' => $mobile,
'area' => $area,
'verifyCode' => $verifyCode,
'countrys' => array ()
)
);
$this->_view->display ('verification', $data);
}
/**
* 手机找回密码验证
*/
public function backmobileAction() {
$mobile = $this->post ( 'mobile' );
$area = $this->post ( 'area' );
$verifyCode = $this->post ( 'verifyCode' );
$code = $this->post ( 'code' ); // code
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
$result = BackData::validateMobileCode ( $mobile, $code, $area );
if ($result ['code'] == 200) {
$str = json_encode ( array (
'mobile' => $mobile,
'area' => $area,
'token' => $result ['data'] ['token'],
'create_time' => time ()
) );
$code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
$url = '/passport/back/backcode?code=' . base64_encode ( $code );
$this->redirect ( SITE_MAIN . $url );
}
}
}
/**
* 检查code
*
* @param string $code
* @return boolean
*/
private function checkCode($code) {
$code = base64_decode ( $code );
$info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );
if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {
return array ();
}
return $info;
}
<?php
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use Passport\PassportModel;
use Plugin\Helpers;
use LibModels\Wap\Passport\BackData;
use Plugin\AuthCode;
class BackController extends WebAction {
/**
* 找回密码
*/
public function indexAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'backPage' => true,
'back' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countryCode' => '86',
'countryName' => '中国',
'captchaUrl' => '/passport/images?t=1449799445',
'countryList' => RegData::getAreasData()
)
);
$this->_view->display ( 'index', $data );
}
/**
* 校验验证码
*/
public function authcodeAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post( 'area', '86' ));
$verifyCode = $this->post ('verifyCode', '');
$data = array('code' => 400, 'message' =>'验证失败');
if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))
&& PassportModel::verifyCode($verifyCode)) {
$data['code'] = 200;
$data['message'] = '验证成功';
}
echo $this->echoJson($data);
}
/**
* 邮箱
*/
public function emailAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post('area', '86'));
$verifyCode = $this->post('verifyCode', '');
if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if ($data ['code'] == 200) {
$this->setSession('email', $email);
$this->redirect ('sendemail');
} else {
$this->redirect ('index');
}
} else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile, $area);
if ($data['code'] == 200) {
$this->setSession ('mobile', $mobile );
$this->setSession ('area', $area );
$this->setSession ('verifyCode', $verifyCode );
$this->redirect ('verification');
} else {
$this->redirect ('index');
}
}
}
/**
* 发送邮件页面
*/
public function sendemailAction() {
$email = $this->getSession ('email');
if (empty ( $email )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'sendEmail' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码页面
*/
public function backcodeAction() {
$code = $this->get('code');
$info = $this->checkCode($code);
if (empty ( $info )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetPage' => true,
'resetPwd' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array(),
'code' => $code
)
);
$this->_view->display('reset-pwd', $data);
}
/**
* 更新密码接口
*/
public function updateAction() {
$code = $this->post('code');
$password = $this->post('pwd');
$info = $this->checkCode($code);
if (Helpers::verifyPassword ($password) && ! empty ($info)) {
// 修改密码
if (isset ( $info ['mobile'] )) { // 手机号修改密码
$mobile = $info ['mobile'];
$token = $info ['token'];
$area = $info ['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if ($data ['code'] == 200) {
$this->redirect ( 'resetSuccess' );
}
} else if (isset ($info ['uid'])) { // 其他方式修改密码
$uid = $info ['uid'];
$this->redirect ( 'resetSuccess' );
}
}
// 跳转错误页面
// $this->redirect('/error/index');
}
/**
* 重置密码成功
*/
public function resetSuccessAction() {
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'resetSuccess' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display ( 'reset-success', $data );
}
/**
* 手机验证页面
*/
public function verificationAction() {
$mobile = $this->getSession ('mobile');
$area = $this->getSession ('area');
$verifyCode = $this->getSession ('verifyCode');
if (empty ($mobile)) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'vertificationPage' => true,
'verification' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'mobile' => $mobile,
'area' => $area,
'verifyCode' => $verifyCode,
'countrys' => array ()
)
);
$this->_view->display ('verification', $data);
}
/**
* 手机找回密码验证
*/
public function backmobileAction() {
$mobile = $this->post ( 'mobile' );
$area = $this->post ( 'area' );
$verifyCode = $this->post ( 'verifyCode' );
$code = $this->post ( 'code' ); // code
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
$result = BackData::validateMobileCode ( $mobile, $code, $area );
if ($result ['code'] == 200) {
$str = json_encode ( array (
'mobile' => $mobile,
'area' => $area,
'token' => $result ['data'] ['token'],
'create_time' => time ()
) );
$code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
$url = '/passport/back/backcode?code=' . base64_encode ( $code );
$this->redirect ( SITE_MAIN . $url );
}
}
//出错直接跳到找回密码页
$this->redirect ('/passport/back/index');
}
/**
* 检查code
*
* @param string $code
* @return boolean
*/
private function checkCode($code) {
$code = base64_decode ( $code );
$info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );
if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {
return array ();
}
return $info;
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,10 @@
use Action\WebAction;
use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\HotrankData;
use product\HotrankModel;
use LibModels\Web\Home\IndexData;
class IndexController extends WebAction
{
/**
... ... @@ -47,5 +51,240 @@ class IndexController extends WebAction
//渲染模板
$this->_view->display('list',$data);
}
public function hotrankAction() {
$this->setWebNavHeader(\Index\HomeModel::COOKIE_NAME_LIFESTYLE);
$data = array(
'hotrankPage' => true,
'hotrank' => array(
array(
'slide' => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
)
)
)
),
array(
'popular' => array(
'name' => '人气单品',
'list' => array(
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '1'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '2'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '3'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '4'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '5'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '6'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '7'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '8'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '9'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '10'
)
)
)
),
array(
'hotBrands' => array(
'name' => '热门品牌',
)
),
array(
'hotWeek' => array(
'name' => '一周热卖',
'nav' => array(
array(
'textCn' => 'TOP100',
'url' => '',
'sid' => 1
),
array(
'textCn' => '上装',
'url' => '',
'sid' => 2
),
array(
'textCn' => '男生测试',
'url' => '',
'sid' => 3
),
array(
'textCn' => '配饰',
'url' => '',
'sid' => 4
)
),
'list' => array(
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
)
)
)
)
);
$data = array( 'hotrankPage' => true,
'footerTop'=> true,
'hotrank' => array()
);
//焦点图 热门品牌
$focus = \Index\HomeModel::getChannelResource('lifestyle', 'd131aba83a84a6977eee3a7403a713de');
//print_r($focus);
$data['hotrank']['slide'] = $focus[0]['slide'];
$data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
//人气单品 一周热卖
$page = 1;
$param = array('order'=>'s_n_desc','viewNum'=>60,'page'=>1,'stocknumber'=>1,'status'=>1,'gender'=>'','attribute_not'=>2);
$publiclist = \product\HotrankModel::getSearchData($param,$page);
$data['hotrank']['popular'] = $publiclist['popular'];
$data['hotrank']['hotWeek'] = $publiclist['hotWeek'];
//print_r($publiclist);
//分类标签
$classes = array('gender' => 2);
$nav = \product\HotrankModel::getHotranktag($classes);
$data['hotrank']['hotWeek']['nav'] = $nav;
//print_r($data);
$this->_view->display('hotrank', $data);
}
}
?>
\ No newline at end of file
... ...
... ... @@ -5,11 +5,29 @@ class ListController extends WebAction
{
public function indexAction()
{
}
/**
* list列表new(模板new-sale)
*/
public function newAction(){
$condition = array(
'order' => 's_t_desc'
);
$options = array(
'specialsale_id' => 'Y',
'needDay' => 'Y'
);
$newData = Product\NewModel::getNewSearchData($condition, $options);
$data = array(
'productListPage' => true,
'newSale' => $newData
);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('new-sale', $data);
}
/**
... ...
<?php
use Action\WebAction;
/**
* new页
*
*/
class NewController extends WebAction
{
public function indexAction()
{
$condition = array(
'order' => 's_t_desc'
);
$options = array(
'specialsale_id' => 'Y',
'needDay' => 'Y'
);
$newData = Product\NewModel::getNewSearchData($condition, $options);
$data = array(
'productListPage' => true,
'newSale' => $newData
);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('new-sale', $data);
}
}