|
|
<?php
|
|
|
use Action\WebAction;
|
|
|
use Product\SearchModel;
|
|
|
use LibModels\Web\Product\FavoriteData;
|
|
|
|
|
|
class ListController extends WebAction
|
|
|
{
|
|
|
public function indexAction()
|
...
|
...
|
@@ -12,6 +14,7 @@ class ListController extends WebAction |
|
|
'positionId' => $positionId,
|
|
|
'reviewNum' => 6
|
|
|
);
|
|
|
|
|
|
$indexData = Product\IndexModel::getIndexData($condition, $options);
|
|
|
|
|
|
$data = array(
|
...
|
...
|
@@ -31,8 +34,6 @@ class ListController extends WebAction |
|
|
'order' => 's_t_desc'
|
|
|
);
|
|
|
$options = array(
|
|
|
'specialsale_id' => 'Y',
|
|
|
'needDay' => 'Y',
|
|
|
'reviewNum' => 6
|
|
|
);
|
|
|
|
...
|
...
|
@@ -69,7 +70,12 @@ class ListController extends WebAction |
|
|
*/
|
|
|
public function getProductPicAction()
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
return;
|
|
|
}
|
|
|
$product_skn = $this->post('skn');
|
|
|
$uid = $this->getUid();
|
|
|
|
|
|
if (!$product_skn) {
|
|
|
return ;
|
|
|
}
|
...
|
...
|
@@ -90,6 +96,46 @@ class ListController extends WebAction |
|
|
'imgSize' => $imgSize,
|
|
|
'minImgSize' => $minImgSize,
|
|
|
);
|
|
|
|
|
|
$isFavorite = false;
|
|
|
if ($uid) {
|
|
|
$favorite = FavoriteData::getUidProductFav($uid, $product_skn);
|
|
|
if (isset($favorite['code']) && $favorite['code'] == 200) {
|
|
|
$isFavorite = true;
|
|
|
}
|
|
|
}
|
|
|
$options['isFavorite'] = $isFavorite;
|
|
|
SearchModel::getProductPic($product_skn, $options);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据product_skn收藏
|
|
|
* @author
|
|
|
* @return json
|
|
|
*/
|
|
|
public static function changeFavoriteAction()
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
return;
|
|
|
}
|
|
|
$product_skn = $this->post('skn');
|
|
|
$isFavorite = $this->post('isFavorite');
|
|
|
$uid = $this->getUid();
|
|
|
|
|
|
do {
|
|
|
if (!$product_skn && !$uid) {
|
|
|
break;
|
|
|
}
|
|
|
if ($isFavorite) {
|
|
|
$result = FavoriteData::delUidProductFav($uid, $product_skn);
|
|
|
$this->echoJson($result);
|
|
|
break;
|
|
|
}else{
|
|
|
$result = FavoriteData::addUidProductFav($uid, $product_skn);
|
|
|
$this->echoJson($result);
|
|
|
break;
|
|
|
}
|
|
|
} while(false);
|
|
|
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|