Authored by 周少峰

修改接口地址

... ... @@ -39,26 +39,26 @@ class SearchData extends \LibModels\Wap\Product\SearchData
default:
if ($type == 'sort') {
//return 'http://101.200.31.165/yohosearch/sortgroup.json';
return 'http://192.168.10.64:8080/yohosearch/sortgroup.json';
return 'http://182.92.99.119:8080/yohosearch/sortgroup.json';
}
elseif ($type == 'discount') {
//return 'http://101.200.31.165/yohosearch/discount.json';
return 'http://192.168.10.64:8080/yohosearch/discount.json';
return 'http://182.92.99.119:8080/yohosearch/discount.json';
}
elseif ($type == 'recent') {
//return 'http://101.200.31.165/yohosearch/recent.json';
return 'http://192.168.10.64:8080/yohosearch/recent.json';
return 'http://182.92.99.119:8080/yohosearch/recent.json';
}
elseif ($type == 'suggest') {
// return 'http://101.200.31.165/yohosearch/suggest.json';
return 'http://192.168.10.64:8080/yohosearch/suggest.json';
return 'http://182.92.99.119:8080/yohosearch/suggest.json';
}
elseif ($type == 'shop') {
//return 'http://101.200.31.165/yohosearch/shops.json';
return 'http://192.168.10.64:8080/yohosearch/shops.json';
return 'http://182.92.99.119:8080/yohosearch/shops.json';
}
// return 'http://101.200.31.165/yohosearch/search.json';
return 'http://192.168.10.64:8080/yohosearch/search-once.json';
return 'http://182.92.99.119:8080/yohosearch/search-once.json';
}
}
... ...
... ... @@ -77,23 +77,31 @@ class HelperSearch
$result['hasNextPage'] = self::next($data['product']['page_total']);
}
//全部折扣
if ($data['discount']['discount'] && !empty($data['discount']['discount'])) {
if (isset($data['discount']['discount']) && !empty($data['discount']['discount'])) {
$result['leftContent'][]['allDiscount'] = self::getDiscount($data['discount']['discount']);
}
//分类条件(搜索页面)
if (isset($data['sort']) && isset($options['controller']) && $options['controller'] != 'Search') {
if (isset($data['sort']['sort'])) {
//分类条件(搜索页面)
if (isset($options['controller']) && $options['controller'] != 'Search') {
$result['filters']['sort'] = self::searchSort($data['sort']['sort']);
}
}else{
//左侧分类分类
$result['leftContent'][]['allSort'] = isset($data['sort']) ? self::groupSort($data['sort']['sort']) : array();
$result['leftContent'][]['allSort'] = self::groupSort($data['sort']['sort']);
}
}
//一周新品上架
$result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array();
if (isset($data['recent']['recent']) && !empty($data['recent']['recent'])) {
$result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
}
//品牌banner
$result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
//总记录数
$result['totalCount'] = $data['product']['total'];
//品牌店铺信息
$result['shopEntry'] = isset($data['shop']) && !empty($data['shop']) ? self::shop($data['shop'], $data['sort']['sort']) : array();
if (isset($data['shop']) && !empty($data['shop'])) {
$result['shopEntry'] = self::shop($data['shop'], $data['sort']['sort']);
}
//分页
$result['pager'] = self::pager($result['totalCount'],$options['viewNum']-1);
//浏览记录
... ...
... ... @@ -2,10 +2,11 @@
namespace Product;
use Api\Yohobuy;
use Plugin\Helpers;
use Plugin\HelperSearch;
use WebPlugin\Helpers;
use WebPlugin\HelperSearch;
use \LibModels\Web\Product\SearchData;
use Configs\CacheConfig;
use WebPlugin\Cache;
/**
* sale首页模板数据模型
... ... @@ -166,17 +167,17 @@ class SearchModel
{
$urlList = array();
$searchCondition = self::searchCondition($customCondition, $customOptions);
if (USE_CACHE) {
$key = CacheConfig::KEY_WEB_PRODUCT_SEARCH_DATA;
if (!empty($condition)) {
$key .= http_build_query($searchCondition['condition'], null, '&');
}
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
// if (USE_CACHE) {
// $key = CacheConfig::KEY_WEB_PRODUCT_SEARCH_DATA;
// if (!empty($condition)) {
// $key .= http_build_query($searchCondition['condition'], null, '&');
// }
// // 先尝试获取一级缓存(master), 有数据则直接返回.
// $result = Cache::get($key, 'master');
// if (!empty($result)) {
// return $result;
// }
// }
// 组合搜索商品url
$urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
... ... @@ -190,16 +191,16 @@ class SearchModel
// 组织模板数据
$result = HelperSearch::getList($data, $searchCondition['options']);
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set($key, $result, 1800); // 缓存30分钟
}
}
// if (USE_CACHE) {
// // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
// if (empty($result)) {
// $result = Cache::get($key, 'slave');
// }
// // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
// else {
// Cache::set($key, $result, 1800); // 缓存30分钟
// }
// }
return $result;
}
/**
... ...