Authored by htoooth

新增销售类目

... ... @@ -19,6 +19,28 @@ class ShopProcess
private static $single = false;
/**
* 修改资源位的链接
* @param $val
* @param $shopId
* @return string
*/
private static function modifyUrl($val, $shopId)
{
if (isset($val['linkType']) && $val['linkType'] == 1) {
return Helpers::url('/search/list', array('poolId' => $val['categoryId'],
'title' => $val['categoryName']));
} else {
if (isset($val['url'])) {
return $val['url'];
} else {
return '';
}
}
}
/**
* 组织店铺页面数据
* @param array $data 接口返回的店铺页所需数据
* @param int $shopId 店铺id
... ... @@ -34,7 +56,7 @@ class ShopProcess
if (empty($val) || !is_callable("self::$key")) {
continue;
}
self::$key($val);
self::$key($val, $shopId);
}
if (self::$single) {
self::$shopData['favId'] = self::$shopData['shopId'];
... ... @@ -87,16 +109,37 @@ class ShopProcess
* @param array $data
* @author sefon 2016-4-26 22:04:04
*/
private static function decorator($data)
private static function decorator($data, $shopId)
{
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));
$json = json_decode($val['resource_data'], true);
foreach ($json as &$val2) {
$url = self::modifyUrl($val2, $shopId);
if (!empty($url)) {
$val2['url'] = $url;
}
if (isset($val2['data']) && is_array($val2['data'])) {
foreach ($val2['data'] as &$v) {
$url2 = self::modifyUrl($v, $shopId);
if (!empty($url2)) {
$v['url'] = $url2;
}
}
}
}
self::$val['resource_name']($json);
}
}
... ...
... ... @@ -62,7 +62,8 @@ class SearchController extends AbstractAction
'channel' => FILTER_DEFAULT,
'outlets' => FILTER_DEFAULT,
'ageLevel' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
'p_d' => FILTER_DEFAULT,
'poolId' => FILTER_DEFAULT), false);
if (isset($condition['shop_id'])) {
$condition['shopId'] = $condition['shop_id'];
}
... ... @@ -79,6 +80,11 @@ class SearchController extends AbstractAction
$condition['query'] = rawurlencode($condition['query']);
}
// 用户自定义商品类目
if(isset($condition['filter_poolId'])){
$condition['filter_poolId'] = rawurldecode($condition['poolId']);
}
// 标识用户是否有输入搜索内容
$haveQuery = $query !== '';
// 标识用户搜的是不是一级品类
... ...
... ... @@ -12,10 +12,17 @@ define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
//define('API_URL', 'http://testapi.yoho.cn:28078/');
define('API_URL', 'http://devapi.yoho.cn:58078');
define('SERVICE_URL', 'http://testservice.yoho.cn:28077/');
//define('API_URL', 'http://devapi.yoho.cn:58078');
//define('SERVICE_URL', 'http://testservice.yoho.cn:28077/');
//define('YOHOBUY_URL', 'http://www.yohobuy.com/');
//define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
#dev环境
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://testservice.yoho.cn:28077/');
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();
... ...