Authored by 郭成尧

'店铺控制是否显示名称'

... ... @@ -27,6 +27,9 @@
<div class="banner-img" style="height: {{bannerHeight}}px;background: url({{banner}})"></div>
<div class="opt-wrap">
<p class="opt center-content">
{{#if showShopName}}
<span class="shop-name">{{shopName}}</span>
{{/if}}
<a href="{{shopHome}}">
<i class="iconfont">&#xe617;</i>
店铺首页
... ... @@ -35,9 +38,9 @@
<i class="iconfont">&#xe631;</i>
店铺介绍
</a>
<span id="shop-favor" class="brand-favor" data-id="{{shopId}}">
<i class="iconfont{{#if coled}} coled{{/if}}">&#xe616;</i>
</span>
<span id="shop-favor" class="brand-favor shop-favor" data-id="{{shopId}}">
<i class="iconfont{{#if coled}} coled{{/if}}">&#xe616;</i>
</span>
</p>
</div>
</div>
... ...
... ... @@ -61,10 +61,18 @@
height: 200px;
.opt {
span {
.shop-name {
margin-left: 60px;
font-size: 32px;
float: left;
border: none;
}
.shop-favor {
margin-right: 60px;
}
}
}
.brand-about {
... ...
<?php
namespace Product;
use Product\SearchModel;
use LibModels\Web\Product\SearchData;
use LibModels\Web\Product\ShopData;
... ... @@ -7,19 +8,20 @@ use Api\Yohobuy;
use WebPlugin\HelperSearch;
use LibModels\Web\Guang\ListData as GuangListData;
use WebPlugin\Helpers;
/**
* 品牌店铺的模型
*
*
* @copyright yoho.inc
* @author xiaoxiao.hao <xiaoxiao.hao@yoho.cn>
*/
class ShopModel
{
private static $shopListUrl = '/shoplist';
public static function getData($shopId, $parameters)
{
$data = array('shopTopBanner' => array(), 'hotSingle'=> array());
$data = array('shopTopBanner' => array(), 'hotSingle' => array());
$parameters['shopId'] = $shopId;
$shopList = ShopData::shopsDecoratorList($shopId);
... ... @@ -69,7 +71,7 @@ class ShopModel
// 组合搜索分类url
$sortCondition = array();
$sortCondition['brand'] = self::getShopsBrandIds($shopId);
if (isset($searchCondition['condition']['misort']) && !empty($searchCondition['condition']['misort'])) {
$sortCondition['needSmallSort'] = 1;
}
... ... @@ -77,18 +79,18 @@ class ShopModel
//批量调接口获取数据
$res = Yohobuy::getMulti($urlList);
//新品上架
if (isset($parameters['navBar']) && $parameters['navBar'] * 1 === 3) {
$searchCondition['options']['isNew'] = true;
}
// 组织模板数据
$result = HelperSearch::getList($res, $searchCondition['options'], $searchCondition['userInput']);
$data['pathNav'] = array_merge(
HelperSearch::$listNav,
array(
array('href'=> '', 'name' => $data['brandIntro']['brandName'], 'title' => $data['brandIntro']['brandName'])
array('href' => '', 'name' => $data['brandIntro']['brandName'], 'title' => $data['brandIntro']['brandName'])
)
);
$sort = self::getSort($res['sort'], $parameters['options']['misort'], $shopId);
... ... @@ -99,8 +101,8 @@ class ShopModel
$data['allGoods']['opts'] = $result['opts'];
$data['leftContent'] = isset($result['leftContent']) ? $result['leftContent'] : '';
$data['allGoods']['goodsMenu']['menuList'] = $sort;
$data['allGoods']['goodsMenu']['url'] = self::$shopListUrl . '?'.http_build_query($param);
$data['allGoods']['href'] = self::$shopListUrl . '?'.http_build_query($param);
$data['allGoods']['goodsMenu']['url'] = self::$shopListUrl . '?' . http_build_query($param);
$data['allGoods']['href'] = self::$shopListUrl . '?' . http_build_query($param);
return $data;
}
... ... @@ -111,9 +113,9 @@ class ShopModel
*/
public static function getShopListData($shopId, $parameters)
{
$data = array('shopTopBanner' => array(), 'hotSingle'=> array());
$data = array('shopTopBanner' => array(), 'hotSingle' => array());
$parameters['shopId'] = $shopId;
$shopList = ShopData::shopsDecoratorList($shopId);
if (isset($shopList['data']['list']) && $shopList['code'] === 200) {
... ... @@ -159,12 +161,12 @@ class ShopModel
//批量调接口获取数据
$res = Yohobuy::getMulti($urlList);
//新品上架
if (isset($parameters['navBar']) && $parameters['navBar'] * 1 === 3) {
$searchCondition['options']['isNew'] = true;
}
// 组织模板数据
$result = HelperSearch::getList($res, $searchCondition['options'], $searchCondition['userInput']);
... ... @@ -176,7 +178,7 @@ class ShopModel
$data['pathNav'] = array_merge(
$result['pathNav'],
array(
array('href'=> '', 'name' => $data['brandIntro']['brandName'], 'title' => $data['brandIntro']['brandName'])
array('href' => '', 'name' => $data['brandIntro']['brandName'], 'title' => $data['brandIntro']['brandName'])
)
);
// $data['name'] = '全部商品 ALL';
... ... @@ -240,11 +242,12 @@ class ShopModel
}
if (!empty($data['resource_data'][0]['isShowShopName'])) {
$result['isShowShopName'] = $data['resource_data'][0]['isShowShopName'] === 'Y';
$result['isShowShopName'] = $data['resource_data'][0]['isShowShopName'] === 'Y';
}
return $result;
}
/**
* 店铺-基础Banner 资源位
* @param type $data
... ... @@ -267,13 +270,13 @@ class ShopModel
}
if (!empty($data['resource_data'][0]['isShowShopName'])) {
$result['isShowShopName'] = $data['resource_data'][0]['isShowShopName'] === 'Y';
$result['isShowShopName'] = $data['resource_data'][0]['isShowShopName'] === 'Y';
}
return $result;
}
/**
* 导航栏 资源位
* @param type $data
... ... @@ -283,42 +286,43 @@ class ShopModel
{
$shopNav = array(
array(
'name' => '店铺首页',
'url' => '/?navBar=0&shopId=' . $parameters['shopId'],
),
array(
'name' => '全部商品',
'url' => self::$shopListUrl . '?navBar=1&shopId=' . $parameters['shopId'],
'arrow' => true,
),
array(
'name' => '人气单品',
'url' => self::$shopListUrl . '?navBar=2&order=s_n_desc&shopId=' . $parameters['shopId'],
),
array(
'name' => '新品上架',
'url' => self::$shopListUrl . '?navBar=3&order=s_t_desc&shopId=' . $parameters['shopId'],
),
'name' => '店铺首页',
'url' => '/?navBar=0&shopId=' . $parameters['shopId'],
),
array(
'name' => '全部商品',
'url' => self::$shopListUrl . '?navBar=1&shopId=' . $parameters['shopId'],
'arrow' => true,
),
array(
'name' => '人气单品',
'url' => self::$shopListUrl . '?navBar=2&order=s_n_desc&shopId=' . $parameters['shopId'],
),
array(
'name' => '新品上架',
'url' => self::$shopListUrl . '?navBar=3&order=s_t_desc&shopId=' . $parameters['shopId'],
),
);
if(isset($data['resource_data']) && is_array($data['resource_data'])) {
$shopNav = array_merge($shopNav, array_filter($data['resource_data'], function($v) {
if (isset($data['resource_data']) && is_array($data['resource_data'])) {
$shopNav = array_merge($shopNav, array_filter($data['resource_data'], function ($v) {
if (empty($v['url'])) {
return false;
}
return $v;
}));
}
//选中状态
//选中状态
if (isset($parameters['navBar']) && count($shopNav) >= $parameters['navBar'] && $parameters['navBar'] >= 0) {
$shopNav[$parameters['navBar']]['current'] = true;
} else {
$shopNav[0]['current'] = true;
}
return $shopNav;
}
/**
* 资源位小图
* @param type $data
... ... @@ -327,15 +331,15 @@ class ShopModel
{
$oneData = array();
$twoData = array();
foreach ($data['resource_data'] as $resource) {
if (empty($resource['data'])) {
continue;
}
foreach ($resource['data'] as $key => $val) {
$temp = array(
'img' => self::imageView2($val['src'], 300, 175),
'url' => $val['url'],
... ... @@ -348,10 +352,10 @@ class ShopModel
}
}
}
return array_slice(array_merge($oneData, $twoData), 0, 2);
}
/**
* 资源位大图
* @param type $data
... ... @@ -360,13 +364,13 @@ class ShopModel
public static function largeSlideImg($data)
{
$result = array();
foreach ($data['resource_data'] as $resource) {
if (empty($resource['data'])) {
continue;
}
foreach ($resource['data'] as $val) {
$result[] = array(
'img' => self::imageView2($val['src'], 660, 360),
... ... @@ -374,10 +378,10 @@ class ShopModel
);
}
}
return $result;
}
/**
* 经典推荐
* @param type $data
... ... @@ -386,16 +390,16 @@ class ShopModel
public static function recommend($data)
{
$result = array();
foreach ($data['resource_data'] as $resource) {
$result[] = array(
'enName'=> Helpers::isChinese($resource['enName']) ?
'enName' => Helpers::isChinese($resource['enName']) ?
Helpers::substrEllipsis($resource['enName'], 5) : Helpers::substrEllipsis($resource['enName'], 10),
'name'=> Helpers::isChinese($resource['name']) ?
'name' => Helpers::isChinese($resource['name']) ?
Helpers::substrEllipsis($resource['name'], 5) : Helpers::substrEllipsis($resource['name'], 6),
'img'=> self::imageView2($resource['src'], 50, 50),
'title'=> $resource['title'],
'url'=> $resource['url'],
'img' => self::imageView2($resource['src'], 50, 50),
'title' => $resource['title'],
'url' => $resource['url'],
);
}
if (empty($result)) {
... ... @@ -403,11 +407,11 @@ class ShopModel
}
return array(
'title' => isset($result[0]['title']) ? $result[0]['title'] : '经典推荐',
'list'=> $result
);
'title' => isset($result[0]['title']) ? $result[0]['title'] : '经典推荐',
'list' => $result
);
}
/**
* 热门推荐
* @param type $data
... ... @@ -416,22 +420,22 @@ class ShopModel
public static function hotRecommend($data)
{
$result = array();
foreach ($data['resource_data'] as $resource) {
$result[] = array(
'img'=> self::imageView2($resource['src'], 160, 240),
'title'=> $resource['title'],
'url'=> $resource['url'],
'img' => self::imageView2($resource['src'], 160, 240),
'title' => $resource['title'],
'url' => $resource['url'],
);
}
if (empty($result)) {
return $result;
return $result;
}
return array(
'title' => isset($result[0]['title']) ? $result[0]['title'] : '热销推荐',
'list'=> $result
);
'title' => isset($result[0]['title']) ? $result[0]['title'] : '热销推荐',
'list' => $result
);
}
/**
... ... @@ -449,20 +453,20 @@ class ShopModel
foreach ($resource['data'] as $val) {
$result[] = array(
'img'=> self::imageView2($val['src'], 160, 240),
'url'=> $val['url'],
'img' => self::imageView2($val['src'], 160, 240),
'url' => $val['url'],
);
}
}
return array(
'title' => empty($result[0]['title']) ? '' : $result[0]['title'],
'list'=> $result
'title' => empty($result[0]['title']) ? '' : $result[0]['title'],
'list' => $result
);
}
/**
* 品牌一览
* 品牌一览
* @param type $data
* @return type []
*/
... ... @@ -490,8 +494,9 @@ class ShopModel
);
}
return array('title' => '品牌集合', 'list'=> $result);
return array('title' => '品牌集合', 'list' => $result);
}
/**
* 商品标签栏
* @param type $data
... ... @@ -500,13 +505,13 @@ class ShopModel
public static function goodsTabBar($data, $parameters)
{
$more = array(
'name' => 'MORE',
'href' => self::$shopListUrl . '?shopId=' . $parameters['shopId']
);
'name' => 'MORE',
'href' => self::$shopListUrl . '?shopId=' . $parameters['shopId']
);
$result = array(
'hot' => array(),
'new' => array()
);
'hot' => array(),
'new' => array()
);
if (empty($data['resource_data'])) {
return $result;
}
... ... @@ -541,27 +546,27 @@ class ShopModel
}
/**
* 新品上架
* @param type $data
* @return type []
*/
* 新品上架
* @param type $data
* @return type []
*/
public static function newProducts($data)
{
$result = array();
foreach ($data['resource_data'] as $resource) {
$result[] = array(
'productId'=> $resource['productId'],
'title'=> $resource['productName'],
'productSkn'=> $resource['productSkn'],
'price'=> '¥' . number_format(trim($resource['salesPrice'], '¥'), 2, '.', ''),
'img'=> self::imageView2($resource['src'], 250, 340),
'url'=> Helpers::getProductUrl($resource['productId'], $resource['productSkn'], $resource['productName']),
'productId' => $resource['productId'],
'title' => $resource['productName'],
'productSkn' => $resource['productSkn'],
'price' => '¥' . number_format(trim($resource['salesPrice'], '¥'), 2, '.', ''),
'img' => self::imageView2($resource['src'], 250, 340),
'url' => Helpers::getProductUrl($resource['productId'], $resource['productSkn'], $resource['productName']),
);
}
return $result;
}
/**
* 人气单品
* @param type $data
... ... @@ -570,22 +575,22 @@ class ShopModel
public static function hotProducts($data)
{
$result = array();
foreach ($data['resource_data'] as $key => $resource) {
$result[] = array(
'productId'=> $resource['productId'],
'title'=> $resource['productName'],
'productSkn'=> $resource['productSkn'],
'price'=> '¥' . number_format(trim($resource['salesPrice'], '¥'), 2, '.', ''),
'img'=> self::imageView2($resource['src'], 250, 340),
'url'=> Helpers::getProductUrl($resource['productId'], $resource['productSkn'], $resource['productName']),
'index'=> $key + 1
'productId' => $resource['productId'],
'title' => $resource['productName'],
'productSkn' => $resource['productSkn'],
'price' => '¥' . number_format(trim($resource['salesPrice'], '¥'), 2, '.', ''),
'img' => self::imageView2($resource['src'], 250, 340),
'url' => Helpers::getProductUrl($resource['productId'], $resource['productSkn'], $resource['productName']),
'index' => $key + 1
);
}
return $result;
}
/**
* 基础模板
* @param type int $shopId 店铺id
... ... @@ -643,14 +648,14 @@ class ShopModel
foreach ($articleData as $key => $artList) {
if ($key >= 3) {
break;
break;
}
$result['trendList'][] = array(
'href' => $artList['url'],
'src' => self::imageView2(substr($artList['src'], 0, strpos($artList['src'], '?')), 264, 173),
'mainTitle' => $artList['title'],
'Subtitle' => $artList['intro']
);
$result['trendList'][] = array(
'href' => $artList['url'],
'src' => self::imageView2(substr($artList['src'], 0, strpos($artList['src'], '?')), 264, 173),
'mainTitle' => $artList['title'],
'Subtitle' => $artList['intro']
);
}
//等于3个才显示
if (count($result['trendList']) < 3) {
... ... @@ -687,35 +692,37 @@ class ShopModel
return $data;
}
public static function shopsDecoratorList($shopId)
{
return ShopData::shopsDecoratorList($shopId);
}
public static function getIntro($shopId, $uid)
{
$data = array(
'brandName' => '',
'brandCont' => '',
'domain'=> '',
'logo'=> '',
'is_favorite'=> false,
'multBrandShopType' => 0,
'shop_template_type' => 0
'domain' => '',
'logo' => '',
'isFavorite' => false,
'multBrandShopType' => 0,
'shopTemplateType' => 0,
'showShopName' => false
);
$intro = ShopData::getIntro($shopId, $uid);
if (!empty($intro['data'])) {
$data = array(
'brandName'=> $intro['data']['shop_name'],
'brandCont'=> $intro['data']['shop_intro'],
'domain'=> $intro['data']['shop_domain'],
'logo'=> $intro['data']['shop_logo'],
'isFavorite'=> ($intro['data']['is_favorite'] === 'Y'),
'shopTemplateType'=> intval($intro['data']['shop_template_type']),
'multBrandShopType'=> intval($intro['data']['mult_brand_shop_type'])
'brandName' => $intro['data']['shop_name'],
'brandCont' => $intro['data']['shop_intro'],
'domain' => $intro['data']['shop_domain'],
'logo' => $intro['data']['shop_logo'],
'isFavorite' => ($intro['data']['is_favorite'] === 'Y'),
'shopTemplateType' => intval($intro['data']['shop_template_type']),
'multBrandShopType' => intval($intro['data']['mult_brand_shop_type']),
'showShopName' => ($intro['data']['is_show_shop_name'] === 'Y')
);
}
... ... @@ -728,13 +735,13 @@ class ShopModel
public static function getSort($sort, $misort, $shopId)
{
$result = array();
$i=0;
$i = 0;
if (empty($sort['sort'])) {
return $result;
}
foreach($sort['sort'] as $key=>$value) {
foreach($value['sub'] as $k=>$v) {
$result[$i]['href'] = '/?msort='.$value['sort_id'].'&misort='.$v['sort_id'].'&shopId='.$shopId;
foreach ($sort['sort'] as $key => $value) {
foreach ($value['sub'] as $k => $v) {
$result[$i]['href'] = '/?msort=' . $value['sort_id'] . '&misort=' . $v['sort_id'] . '&shopId=' . $shopId;
$result[$i]['name'] = $v['sort_name'];
$result[$i]['count'] = $v['count'];
$result[$i]['orderBy'] = $v['order_by'];
... ... @@ -742,17 +749,17 @@ class ShopModel
$i++;
}
}
foreach($result as $key=>$value) {
foreach ($result as $key => $value) {
$count[$key] = $value['count'];
$sortName[$key] = $value['name'];
}
$arr=array();
array_multisort($count,SORT_DESC,$sortName,$result);
$result = array_slice($result,0,15);
$arr = array();
array_multisort($count, SORT_DESC, $sortName, $result);
$result = array_slice($result, 0, 15);
foreach($result as &$value) {
if($value['misort'] == $misort) {
foreach ($result as &$value) {
if ($value['misort'] == $misort) {
$value['curMenu'] = true;
}
}
... ... @@ -793,27 +800,27 @@ class ShopModel
{
return ShopData::getSearch($shopId);
}
public static function getSortInfo($shopId, $yhChannel = '', $gender = '')
{
return ShopData::getSortInfo($shopId, $yhChannel, $gender);
}
public static function setFavorite($shopId, $isfavorite, $uid, $type = 'shop')
{
return ShopData::setFavorite($shopId, $isfavorite, $uid, $type);
}
public static function byDomain($domain)
{
$data = array('shop_id' => '', 'type' => '');
$result = ShopData::byDomain($domain);
if (!empty($result['data'])) {
$data = $result['data'];
}
return ShopData::byDomain($domain);
}
}
\ No newline at end of file
... ...
... ... @@ -128,7 +128,9 @@ class IndexController extends WebAction
'shopHome' => Helpers::url('', array('shopId' => $result['shopId']), $domain),
'shopIntro' => Helpers::url('/aboutShop', array('shopId' => $result['shopId']), $domain),
'coled' => $shopIntro['isFavorite'],
'shopId' => $result['shopId']
'shopId' => $result['shopId'],
'shopName' => $shopIntro['brandName'],
'showShopName' => $shopIntro['showShopName']
);
$data['brandBanner'] = array(); // 刪除品牌banner
... ... @@ -278,7 +280,9 @@ class IndexController extends WebAction
'shopHome' => Helpers::url('/', array('shopId' => $shopId), $domain),
'shopIntro' => Helpers::url('/aboutShop', array('shopId' => $shopId), $domain),
'coled' => $shopIntro['isFavorite'],
'shopId' => $shopId
'shopId' => $shopId,
'shopName' => $shopIntro['brandName'],
'showShopName' => $shopIntro['showShopName']
),
'shopAbout' => empty($shopIntro['brandCont']) ? $shopIntro['brandName'] : $shopIntro['brandCont']
);
... ...