Authored by hf

merge release code to fixes bugs

... ... @@ -65,8 +65,8 @@ class ListData
$param['author_id'] = $authorId;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_ARTICLELIST, $param);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_ARTICLELIST, $param, 300); // 缓存5分钟
}
/**
... ...
... ... @@ -35,13 +35,14 @@ class SearchController extends AbstractAction
// 过滤请求参数
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_DEFAULT,
'brand' => FILTER_VALIDATE_INT,
'brand' => FILTER_DEFAULT,
'sort' => FILTER_DEFAULT,
'msort' => FILTER_DEFAULT,
'misort' => FILTER_DEFAULT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'price' => FILTER_VALIDATE_INT,
'color' => FILTER_DEFAULT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
... ... @@ -49,7 +50,11 @@ class SearchController extends AbstractAction
$query = empty($condition['query']) ? null : strtolower(trim($condition['query']));
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
unset($condition['discount']);
// unset($condition['discount']); 为了兼容js中传参的discount
}
// 为了兼容现在运营在用的p_d
if (isset($condition['p_d'])) {
$condition['discount'] = rawurldecode($condition['p_d']);
}
if (isset($condition['query'])) {
$condition['query'] = rawurlencode($condition['query']);
... ... @@ -200,13 +205,14 @@ class SearchController extends AbstractAction
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_DEFAULT,
'brand' => FILTER_VALIDATE_INT,
'brand' => FILTER_DEFAULT,
'sort' => FILTER_DEFAULT,
'msort' => FILTER_DEFAULT,
'misort' => FILTER_DEFAULT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'price' => FILTER_VALIDATE_INT,
'color' => FILTER_DEFAULT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
... ... @@ -215,12 +221,22 @@ class SearchController extends AbstractAction
if (isset($condition['sort'])) {
$condition['sort'] = rawurldecode($condition['sort']);
}
// 转义分类
if (isset($condition['msort'])) {
$condition['msort'] = rawurldecode($condition['msort']);
}
// 转义分类
if (isset($condition['misort'])) {
$condition['misort'] = rawurldecode($condition['misort']);
}
// 转义价格
if (isset($condition['price'])) {
$condition['price'] = rawurldecode($condition['price']);
}
// 转义风格
if (isset($condition['style'])) {
$condition['style'] = rawurldecode($condition['style']);
}
// 转换折扣
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
... ... @@ -259,7 +275,6 @@ class SearchController extends AbstractAction
// $data = Product\ListModel::getClassData($condition);
$data = Product\SearchModel::getSearchData($condition);
} while (false);
if (empty($data['new'])) {
... ... @@ -281,13 +296,14 @@ class SearchController extends AbstractAction
// 过滤请求参数
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_DEFAULT,
'brand' => FILTER_VALIDATE_INT,
'brand' => FILTER_DEFAULT,
'sort' => FILTER_DEFAULT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'price' => FILTER_VALIDATE_INT,
'msort' => FILTER_DEFAULT,
'misort' => FILTER_DEFAULT,
'color' => FILTER_DEFAULT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
... ... @@ -305,6 +321,14 @@ class SearchController extends AbstractAction
if (isset($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
}
// 转义价格
if (isset($condition['price'])) {
$condition['price'] = rawurldecode($condition['price']);
}
// 转义风格
if (isset($condition['style'])) {
$condition['style'] = rawurldecode($condition['style']);
}
// 区别各种列表页面的筛选数据
$data = Product\SearchModel::getFilterData($condition);
... ...
... ... @@ -25,17 +25,58 @@ class IndexController extends AbstractAction
{
// 过滤请求参数
$condition = filter_input_array(INPUT_GET, array(
'brand' => FILTER_VALIDATE_INT,
'brand' => FILTER_DEFAULT,
'sort' => FILTER_DEFAULT,
'msort' => FILTER_DEFAULT,
'misort' => FILTER_DEFAULT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'price' => FILTER_VALIDATE_INT,
'discount' => FILTER_VALIDATE_INT,
'color' => FILTER_DEFAULT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
// 转义品牌
if (isset($condition['brand'])) {
$condition['brand'] = rawurldecode($condition['brand']);
}
// 转义分类
if (isset($condition['sort'])) {
$condition['sort'] = rawurldecode($condition['sort']);
}
// 转义一级分类
if (isset($condition['msort'])) {
$condition['msort'] = rawurldecode($condition['msort']);
}
// 转义二级分类
if (isset($condition['misort'])) {
$condition['misort'] = rawurldecode($condition['misort']);
}
// 转义颜色
if (isset($condition['color'])) {
$condition['color'] = rawurldecode($condition['color']);
}
// 转义尺码
if (isset($condition['size'])) {
$condition['size'] = rawurldecode($condition['size']);
}
// 转义风格
if (isset($condition['style'])) {
$condition['style'] = rawurldecode($condition['style']);
}
// 转义价格
if (isset($condition['price'])) {
$condition['price'] = rawurldecode($condition['price']);
}
// 转换折扣
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
}
// 为了兼容现在运营在用的p_d
if (isset($condition['p_d'])) {
$condition['discount'] = rawurldecode($condition['p_d']);
}
// 性别参数,不传则从COOKIE获取
if (!isset($condition['gender'])) {
$condition['gender'] = Helpers::getGenderByCookie();
... ... @@ -94,7 +135,7 @@ class IndexController extends AbstractAction
if ($brandLogo && isset($brandLogo['id'])) {
$brandId = $brandLogo['id'];
}
/* 通过品牌域名找到对应的品牌ID */
// $domainList = Product\ListModel::getAllBrandDomains();
// $brandIds = array_keys($domainList, $domain);
... ... @@ -112,16 +153,53 @@ class IndexController extends AbstractAction
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'sort' => FILTER_DEFAULT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'price' => FILTER_VALIDATE_INT,
'discount' => FILTER_VALIDATE_INT,
'msort' => FILTER_DEFAULT,
'misort' => FILTER_DEFAULT,
'color' => FILTER_DEFAULT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
$condition['brand'] = $brandId;
// 转义分类
if (isset($condition['sort'])) {
$condition['sort'] = rawurldecode($condition['sort']);
}
// 转义一级分类
if (isset($condition['msort'])) {
$condition['msort'] = rawurldecode($condition['msort']);
}
// 转义二级分类
if (isset($condition['misort'])) {
$condition['misort'] = rawurldecode($condition['misort']);
}
// 转义颜色
if (isset($condition['color'])) {
$condition['color'] = rawurldecode($condition['color']);
}
// 转义尺码
if (isset($condition['size'])) {
$condition['size'] = rawurldecode($condition['size']);
}
// 转义风格
if (isset($condition['style'])) {
$condition['style'] = rawurldecode($condition['style']);
}
// 转义价格
if (isset($condition['price'])) {
$condition['price'] = rawurldecode($condition['price']);
}
// 转换折扣
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
}
// 为了兼容现在运营在用的p_d
if (isset($condition['p_d'])) {
$condition['discount'] = rawurldecode($condition['p_d']);
}
if ($brandId === 0) {
$condition['query'] = $domain;
}
... ...