Authored by 周少峰

Merge branch 'feature/shopCategory'

... ... @@ -24,7 +24,7 @@
<ul>
{{#largeSlideImg}}
<li>
<a href="{{url}}"><img src="{{img}}"></a>
<a target="_blank" href="{{url}}"><img src="{{img}}"></a>
</li>
{{/largeSlideImg}}
</ul>
... ... @@ -32,7 +32,7 @@
</div>
<div class="slider-right pull-right">
{{#oneRowTwoColImages}}
<a class="slider-item" href="{{url}}"><img src="{{img}}"></a>
<a class="slider-item" target="_blank" href="{{url}}"><img src="{{img}}"></a>
{{/oneRowTwoColImages}}
</div>
</div>
... ...
... ... @@ -73,7 +73,8 @@ class SearchModel
'series' => FILTER_VALIDATE_INT,
'folder_id' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT,
'ageLevel' => FILTER_VALIDATE_INT), false);
'ageLevel' => FILTER_VALIDATE_INT,
'filter_poolId' => FILTER_VALIDATE_INT), false);
//接收高级选项
foreach ($_GET as $key =>$val) {
if (strpos($key, 'parameter_') !== false) {
... ...
<?php
namespace Product;
use LibModels\Wap\Guang\OptData;
use Product\SearchModel;
use LibModels\Web\Product\SearchData;
use LibModels\Web\Product\ShopData;
... ... @@ -29,7 +30,7 @@ class ShopModel
foreach ($shopList['data']['list'] as $list) {
$fun = $list['resource_name'];
if (is_callable("self::$fun")) {
$list = self::$fun(self::getResourceData($list), $parameters);
$list = self::$fun(self::getResourceData($list, $shopId), $parameters);
switch ($fun) {
case 'signboard':
//过滤不合法的数据
... ... @@ -122,7 +123,7 @@ class ShopModel
foreach ($shopList['data']['list'] as $list) {
$fun = $list['resource_name'];
if (is_callable("self::$fun")) {
$list = self::$fun(self::getResourceData($list), $parameters);
$list = self::$fun(self::getResourceData($list, $shopId), $parameters);
switch ($fun) {
case 'newProducts':
case 'hotProducts':
... ... @@ -374,7 +375,7 @@ class ShopModel
foreach ($resource['data'] as $val) {
$result[] = array(
'img' => self::imageView2($val['src'], 660, 360),
'url' => Helpers::getUrlSafe($val['url']),
'url' => Helpers::getUrlSafe($val['url']),
);
}
}
... ... @@ -397,9 +398,9 @@ class ShopModel
Helpers::substrEllipsis($resource['enName'], 5) : Helpers::substrEllipsis($resource['enName'], 10),
'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'=> Helpers::getUrlSafe($resource['url']),
'img' => self::imageView2($resource['src'], 50, 50),
'title' => $resource['title'],
'url' => Helpers::getUrlSafe($resource['url']),
);
}
if (empty($result)) {
... ... @@ -423,9 +424,9 @@ class ShopModel
foreach ($data['resource_data'] as $resource) {
$result[] = array(
'img'=> self::imageView2($resource['src'], 160, 240),
'title'=> $resource['title'],
'url'=> Helpers::getUrlSafe($resource['url']),
'img' => self::imageView2($resource['src'], 160, 240),
'title' => $resource['title'],
'url' => Helpers::getUrlSafe($resource['url']),
);
}
if (empty($result)) {
... ... @@ -453,8 +454,8 @@ class ShopModel
foreach ($resource['data'] as $val) {
$result[] = array(
'img'=> self::imageView2($val['src'], 160, 240),
'url'=> Helpers::getUrlSafe($val['url']),
'img' => self::imageView2($val['src'], 160, 240),
'url' => Helpers::getUrlSafe($val['url']),
);
}
}
... ... @@ -518,7 +519,7 @@ class ShopModel
if (isset($data['resource_data']['hot'])) {
foreach ($data['resource_data']['hot'] as $val) {
if (empty($val['url'])) {
if (empty($val['url']) || empty($val['position'])) {
continue;
}
$result['hot'][] = array(
... ... @@ -530,7 +531,7 @@ class ShopModel
if (isset($data['resource_data']['new'])) {
foreach ($data['resource_data']['new'] as $val) {
if (empty($val['url'])) {
if (empty($val['url']) || empty($val['position'])) {
continue;
}
$result['new'][] = array(
... ... @@ -550,7 +551,7 @@ class ShopModel
* @param type $data
* @return type []
*/
public static function newProducts($data)
public static function newProducts($data, $opts)
{
$result = array();
... ... @@ -572,7 +573,7 @@ class ShopModel
* @param type $data
* @return type []
*/
public static function hotProducts($data)
public static function hotProducts($data, $opts)
{
$result = array();
... ... @@ -605,7 +606,7 @@ class ShopModel
foreach ($shopList['data']['list'] as $list) {
$fun = $list['resource_name'];
if (is_callable("self::$fun")) {
$list = self::$fun(self::getResourceData($list), $parameters);
$list = self::$fun(self::getResourceData($list, $shopId), $parameters);
switch ($fun) {
case 'shopTopBanner_base':
case 'signboard':
... ... @@ -681,15 +682,47 @@ class ShopModel
return Helpers::getUrlSafe("{$src}imageView2/1/w/{$width}/h/{$heigh}");
}
private static function modifyUrl($val, $shopId)
{
if (isset($val['linkType']) && $val['linkType'] == 1) {
return Helpers::url('/product/index/shoplist', array('filter_poolId' => $val['categoryId'], 'shopId' => $shopId), '');
} else {
return $val['url'];
}
}
/**
* 解析resource_data 参数
* @param type $data
* @return type []
*/
public static function getResourceData($data)
public static function getResourceData($data, $shopId)
{
$data['resource_data'] = isset($data['resource_data']) ? json_decode($data['resource_data'], true) : array();
$result = isset($data['resource_data']) ? json_decode($data['resource_data'], true) : array();
foreach ($result as $key => &$val) {
$val['url'] = self::modifyUrl($val, $shopId);
if (isset($val['data']) && is_array($val['data'])) {
foreach ($val['data'] as $k => &$v) {
$url = self::modifyUrl($v, $shopId);
if (!empty($url)) {
$v['url'] = $url;
}
}
}
if (!isset($val['data']) && is_array($val)) {
foreach ($val as $k1 => &$v1) {
$url = self::modifyUrl($v1, $shopId);
if (!empty($url)) {
$v1['url'] = $url;
}
}
}
}
$data['resource_data'] = $result;
return $data;
}
... ...
... ... @@ -504,7 +504,9 @@ class IndexController extends WebAction
public function shopListAction()
{
$shopId = $this->get('shopId', 0);
if (empty($shopId)) {
$poolId = $this->get('filter_poolId', 0);
if (empty($shopId) && empty($poolId)) {
$this->go(SITE_MAIN);
}
... ... @@ -514,10 +516,17 @@ class IndexController extends WebAction
// 设置头部数据
$this->setWebNavHeader();
// condition
$condition = array();
if (!empty($poolId)) {
$condition['filter_poolId'] = $poolId;
} else {
$condition['shop'] = $shopId;
}
$parameters = array(
'condition' => array(
'shop' => $shopId
),
'condition' => $condition,
'options' => array(
'controller' => 'Index',
'action' => 'index',
... ...
... ... @@ -16,16 +16,16 @@ define('USE_INTER_FACE_SHUNT', false);//分流开关
#test环境
define('API_URL', 'http://testapi.yoho.cn:28078/');
define('SERVICE_URL', 'http://testservice.yoho.cn:28077/');
define('YOHOBUY_URL', 'http://www.yohobuy.com/');
define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
define('API_OLD', 'http://test2.open.yohobuy.com/');
//define('YOHOBUY_URL', 'http://www.yohobuy.com/');
//define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
//define('API_OLD', 'http://test2.open.yohobuy.com/');
#dev环境
// define('API_URL', 'http://devapi.yoho.cn:58078/');
// define('SERVICE_URL', 'http://devservice.yoho.cn:58077/');
// define('YOHOBUY_URL', 'http://www.yohobuy.com/');
// define('SERVICE_NOTIFY', 'http://test2.open.yohobuy.com/');
// define('API_OLD', 'http://devservice.yoho.cn:58077/');
// define('API_URL', 'http://dev-api.yohops.com:9999/');
// define('SERVICE_URL', 'http://dev-service.yohops.com:9999/');
define('YOHOBUY_URL', 'http://www.yohobuy.com/');
define('SERVICE_NOTIFY', 'http://test2.open.yohobuy.com/');
define('API_OLD', 'http://devservice.yoho.cn:58077/');
$application = new Application(APPLICATION_PATH . '/configs/application.developer.ini');
$application->bootstrap()->run();
\ No newline at end of file
... ...