Authored by yangyang

ajax请求商品图片修改

... ... @@ -133,7 +133,7 @@ class BrandsModel
$urlList['brand'] = SearchData::getBrandUrl($customOptions);
//批量调接口
$result = Yohobuy::getMulti($urlList, array(), true);
$result = Yohobuy::getMulti($urlList);
//组织模板数据格式
$data = HelperSearch::getList($result, $searchCondition['options']);
... ...
... ... @@ -26,7 +26,7 @@ class IndexModel
$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
//批量调接口获取数据
$result = Yohobuy::getMulti($urlList, array(), true);
$result = Yohobuy::getMulti($urlList);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
... ...
... ... @@ -25,7 +25,7 @@ class NewModel
// 组合搜索最新上架url
$urlList['recent'] = SearchData::getRecentShelveUrl($searchCondition['condition']);
$result = Yohobuy::getMulti($urlList, array(), true);
$result = Yohobuy::getMulti($urlList);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
... ...
... ... @@ -27,7 +27,7 @@ class SaleModel
$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
//批量调接口
$result = Yohobuy::getMulti($urlList, array(), true);
$result = Yohobuy::getMulti($urlList);
//组织模板数据格式
$data = HelperSearch::getList($result, $searchCondition['options']);
... ...
... ... @@ -33,8 +33,8 @@ class SearchModel
'query' => FILTER_SANITIZE_STRING,
'brand' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'msort' => FILTER_SANITIZE_STRING,
'misort' => FILTER_SANITIZE_STRING,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
... ... @@ -156,7 +156,7 @@ class SearchModel
// 组合搜索折扣区间url
$urlList['discount'] = SearchData::getDiscountUrl($searchCondition['condition']);
$result = Yohobuy::getMulti($urlList, array(), true);
$result = Yohobuy::getMulti($urlList);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
return $data;
... ... @@ -238,7 +238,7 @@ class SearchModel
'pics'=>$data,
'isFavorite'=>$options['isFavorite']
);
echo json_encode($res);
return $res;
}
/**
... ...
... ... @@ -45,7 +45,10 @@ class ListController extends WebAction
$newData = NewModel::getNewSearchData($condition, $options);
$data = array(
'productListPage' => true,
'newSale' => $newData
'newSale' => $newData,
'title' => '潮流商品搜索 | YOHO!有货',
'keywords' => 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',
'description' => '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'
);
$this->setWebNavHeader();
//渲染模板
... ... @@ -72,7 +75,10 @@ class ListController extends WebAction
$data = array(
//初始化js
'productListPage' => true,
'list' => $list
'list' => $list,
'title' => '潮流商品搜索 | YOHO!有货',
'keywords' => 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',
'description' => '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'
);
$this->setWebNavHeader();
$this->_view->display('list', $data);
... ... @@ -85,13 +91,18 @@ class ListController extends WebAction
*/
public function getProductPicAction()
{
$res = array(
'code' => 400
);
if (!$this->isAjax()) {
$this ->echoJson($res);
return;
}
$product_skn = $this->post('skn');//TODO
$productSkn = $this->post('skn');
$uid = $this->getUid();
if (!$product_skn) {
if (!$productSkn) {
$this ->echoJson($res);
return ;
}
//大图
... ... @@ -114,43 +125,46 @@ class ListController extends WebAction
$isFavorite = false;
if ($uid) {
$favorite = FavoriteData::getUidProductFav($uid, $product_skn);
$favorite = FavoriteData::getUidProductFav($uid, $productSkn);
if (isset($favorite['code']) && $favorite['code'] == 200) {
$isFavorite = true;
}
}
$options['isFavorite'] = $isFavorite;
SearchModel::getProductPic($product_skn, $options);//TODO
$res = SearchModel::getProductPic($productSkn, $options);
$this ->echoJson($res);
}
/**
* 根据product_skn收藏
* 根据productSkn收藏
* @author
* @return json
*/
public function changeFavoriteAction()
{
$result = array(
'code'=>400
);
if (!$this->isAjax()) {
$this->echoJson($resut);
return;
}
$product_skn = $this->post('skn');
$productSkn = $this->post('skn');
$isFavorite = $this->post('isFavorite');
$uid = $this->getUid();
do {
if (!$product_skn && !$uid) {
break;//TODO
if (!$productSkn && !$uid) {
break;
}
if ($isFavorite) {
$result = FavoriteData::delUidProductFav($uid, $product_skn);
$this->echoJson($result);
$result = FavoriteData::delUidProductFav($uid, $productSkn);
break;
}else{
$result = FavoriteData::addUidProductFav($uid, $product_skn);
$this->echoJson($result);
$result = FavoriteData::addUidProductFav($uid, $productSkn);
break;
}
} while(false);
$this->echoJson($result);
}
}
\ No newline at end of file
... ...