1
|
<?php
|
1
|
<?php
|
2
|
use Action\WebAction;
|
2
|
use Action\WebAction;
|
3
|
use Product\SearchModel;
|
3
|
use Product\SearchModel;
|
|
|
4
|
+use LibModels\Web\Product\FavoriteData;
|
|
|
5
|
+
|
4
|
class ListController extends WebAction
|
6
|
class ListController extends WebAction
|
5
|
{
|
7
|
{
|
6
|
public function indexAction()
|
8
|
public function indexAction()
|
|
@@ -12,6 +14,7 @@ class ListController extends WebAction |
|
@@ -12,6 +14,7 @@ class ListController extends WebAction |
12
|
'positionId' => $positionId,
|
14
|
'positionId' => $positionId,
|
13
|
'reviewNum' => 6
|
15
|
'reviewNum' => 6
|
14
|
);
|
16
|
);
|
|
|
17
|
+
|
15
|
$indexData = Product\IndexModel::getIndexData($condition, $options);
|
18
|
$indexData = Product\IndexModel::getIndexData($condition, $options);
|
16
|
|
19
|
|
17
|
$data = array(
|
20
|
$data = array(
|
|
@@ -31,8 +34,6 @@ class ListController extends WebAction |
|
@@ -31,8 +34,6 @@ class ListController extends WebAction |
31
|
'order' => 's_t_desc'
|
34
|
'order' => 's_t_desc'
|
32
|
);
|
35
|
);
|
33
|
$options = array(
|
36
|
$options = array(
|
34
|
- 'specialsale_id' => 'Y',
|
|
|
35
|
- 'needDay' => 'Y',
|
|
|
36
|
'reviewNum' => 6
|
37
|
'reviewNum' => 6
|
37
|
);
|
38
|
);
|
38
|
|
39
|
|
|
@@ -69,7 +70,12 @@ class ListController extends WebAction |
|
@@ -69,7 +70,12 @@ class ListController extends WebAction |
69
|
*/
|
70
|
*/
|
70
|
public function getProductPicAction()
|
71
|
public function getProductPicAction()
|
71
|
{
|
72
|
{
|
|
|
73
|
+ if (!$this->isAjax()) {
|
|
|
74
|
+ return;
|
|
|
75
|
+ }
|
72
|
$product_skn = $this->post('skn');
|
76
|
$product_skn = $this->post('skn');
|
|
|
77
|
+ $uid = $this->getUid();
|
|
|
78
|
+
|
73
|
if (!$product_skn) {
|
79
|
if (!$product_skn) {
|
74
|
return ;
|
80
|
return ;
|
75
|
}
|
81
|
}
|
|
@@ -90,6 +96,46 @@ class ListController extends WebAction |
|
@@ -90,6 +96,46 @@ class ListController extends WebAction |
90
|
'imgSize' => $imgSize,
|
96
|
'imgSize' => $imgSize,
|
91
|
'minImgSize' => $minImgSize,
|
97
|
'minImgSize' => $minImgSize,
|
92
|
);
|
98
|
);
|
|
|
99
|
+
|
|
|
100
|
+ $isFavorite = false;
|
|
|
101
|
+ if ($uid) {
|
|
|
102
|
+ $favorite = FavoriteData::getUidProductFav($uid, $product_skn);
|
|
|
103
|
+ if (isset($favorite['code']) && $favorite['code'] == 200) {
|
|
|
104
|
+ $isFavorite = true;
|
|
|
105
|
+ }
|
|
|
106
|
+ }
|
|
|
107
|
+ $options['isFavorite'] = $isFavorite;
|
93
|
SearchModel::getProductPic($product_skn, $options);
|
108
|
SearchModel::getProductPic($product_skn, $options);
|
94
|
}
|
109
|
}
|
|
|
110
|
+
|
|
|
111
|
+ /**
|
|
|
112
|
+ * 根据product_skn收藏
|
|
|
113
|
+ * @author
|
|
|
114
|
+ * @return json
|
|
|
115
|
+ */
|
|
|
116
|
+ public static function changeFavoriteAction()
|
|
|
117
|
+ {
|
|
|
118
|
+ if (!$this->isAjax()) {
|
|
|
119
|
+ return;
|
|
|
120
|
+ }
|
|
|
121
|
+ $product_skn = $this->post('skn');
|
|
|
122
|
+ $isFavorite = $this->post('isFavorite');
|
|
|
123
|
+ $uid = $this->getUid();
|
|
|
124
|
+
|
|
|
125
|
+ do {
|
|
|
126
|
+ if (!$product_skn && !$uid) {
|
|
|
127
|
+ break;
|
|
|
128
|
+ }
|
|
|
129
|
+ if ($isFavorite) {
|
|
|
130
|
+ $result = FavoriteData::delUidProductFav($uid, $product_skn);
|
|
|
131
|
+ $this->echoJson($result);
|
|
|
132
|
+ break;
|
|
|
133
|
+ }else{
|
|
|
134
|
+ $result = FavoriteData::addUidProductFav($uid, $product_skn);
|
|
|
135
|
+ $this->echoJson($result);
|
|
|
136
|
+ break;
|
|
|
137
|
+ }
|
|
|
138
|
+ } while(false);
|
|
|
139
|
+
|
|
|
140
|
+ }
|
95
|
} |
141
|
} |