|
@@ -172,29 +172,25 @@ class UserModel |
|
@@ -172,29 +172,25 @@ class UserModel |
172
|
|
172
|
|
173
|
// 处理用户收藏的商品数据
|
173
|
// 处理用户收藏的商品数据
|
174
|
if (isset($favProduct['data']) && !empty($favProduct['data']['product_list'])) {
|
174
|
if (isset($favProduct['data']) && !empty($favProduct['data']['product_list'])) {
|
175
|
- if ($page > $favProduct['data']['page_total']) {
|
|
|
176
|
- $result['end'] = true;
|
|
|
177
|
-
|
|
|
178
|
- return $result;
|
|
|
179
|
- }
|
|
|
180
|
-
|
|
|
181
|
$datas = array();
|
175
|
$datas = array();
|
182
|
$product = array();
|
176
|
$product = array();
|
183
|
-
|
|
|
184
|
foreach ($favProduct['data']['product_list'] as $val) {
|
177
|
foreach ($favProduct['data']['product_list'] as $val) {
|
185
|
$product = array();
|
178
|
$product = array();
|
186
|
$product['fav_id'] = $val['product_id'];
|
179
|
$product['fav_id'] = $val['product_id'];
|
187
|
- $product['imgUrl'] = $val['image'];
|
180
|
+ $product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
|
|
|
181
|
+ $product['imgUrl'] = Helpers::getImageUrl($val['image'], 447, 596);;
|
188
|
$product['title'] = $val['product_name'];
|
182
|
$product['title'] = $val['product_name'];
|
189
|
$product['price'] = !empty($val['market_price']) ? '¥'.$val['market_price'] . '.00' : 0;
|
183
|
$product['price'] = !empty($val['market_price']) ? '¥'.$val['market_price'] . '.00' : 0;
|
190
|
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . $val['sales_price'] . '.00' : false;
|
184
|
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . $val['sales_price'] . '.00' : false;
|
191
|
- $product['savePrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) . '.00' : false;
|
|
|
192
|
- $product['sellOut'] = (bool)($val['price_down']);
|
185
|
+ $product['savePrice'] = !empty($val['price_down'] > 0) ? '¥'.$val['price_down'] . '.00' : false;
|
|
|
186
|
+ $product['sellOut'] = ($val['storage'] <= 0);
|
193
|
|
187
|
|
194
|
$datas[] = $product;
|
188
|
$datas[] = $product;
|
195
|
}
|
189
|
}
|
196
|
|
190
|
|
197
|
!empty($datas) && $result['hasFavProduct'] = $datas;
|
191
|
!empty($datas) && $result['hasFavProduct'] = $datas;
|
|
|
192
|
+ } else if ($page > 1 && isset($favProduct['code']) && $favProduct['code'] === 500){
|
|
|
193
|
+ $result['end'] = true;
|
198
|
}
|
194
|
}
|
199
|
|
195
|
|
200
|
return $result;
|
196
|
return $result;
|
|
@@ -230,19 +226,19 @@ class UserModel |
|
@@ -230,19 +226,19 @@ class UserModel |
230
|
foreach ($favBrand['data']['brand_list'] as $val) {
|
226
|
foreach ($favBrand['data']['brand_list'] as $val) {
|
231
|
$brand = array();
|
227
|
$brand = array();
|
232
|
$brand['id'] = $val['brand_id'];
|
228
|
$brand['id'] = $val['brand_id'];
|
233
|
- $brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314);
|
229
|
+ $brand['brandImg'] = !empty($val['brand_ico']) ? Images::getImageUrl($val['brand_ico'], 47, 47) : '';
|
234
|
$brand['brandName'] = $val['brand_name'];
|
230
|
$brand['brandName'] = $val['brand_name'];
|
235
|
$brand['update'] = $val['new_product_num'];
|
231
|
$brand['update'] = $val['new_product_num'];
|
236
|
$brand['discount'] = $val['product_discount_num'];
|
232
|
$brand['discount'] = $val['product_discount_num'];
|
237
|
- $brand['link'] = '#';
|
233
|
+ $brand['link'] = Helpers::url('', array('query' => $val['brand_name']), 'search');
|
238
|
|
234
|
|
239
|
// 处理品牌产品
|
235
|
// 处理品牌产品
|
240
|
$product = array();
|
236
|
$product = array();
|
241
|
foreach ($val['new_product'] as $one) {
|
237
|
foreach ($val['new_product'] as $one) {
|
242
|
$product = array();
|
238
|
$product = array();
|
243
|
$product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
|
239
|
$product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
|
244
|
- $product['price'] = '¥'.$one['market_price'];
|
|
|
245
|
- $product['discount'] = '¥'.$one['sales_price'];
|
240
|
+ $product['price'] = !empty($one['market_price']) ? '¥'.$one['market_price'] . '.00' : 0;
|
|
|
241
|
+ $product['discount'] = !empty($one['sales_price']) ? '¥'.$one['sales_price'] . '.00' : 0;
|
246
|
|
242
|
|
247
|
$brand['productList'][] = $product;
|
243
|
$brand['productList'][] = $product;
|
248
|
}
|
244
|
}
|
|
@@ -277,7 +273,7 @@ class UserModel |
|
@@ -277,7 +273,7 @@ class UserModel |
277
|
* @param int $udid 客户端唯一标识
|
273
|
* @param int $udid 客户端唯一标识
|
278
|
* @param int $page 第几页,默认为1
|
274
|
* @param int $page 第几页,默认为1
|
279
|
* @param int $limit 限制多少条,默认100
|
275
|
* @param int $limit 限制多少条,默认100
|
280
|
- * @return array处理之后的数据
|
276
|
+ * @return array 处理之后的数据
|
281
|
*/
|
277
|
*/
|
282
|
public static function browserRecord($uid, $udid, $page, $limit)
|
278
|
public static function browserRecord($uid, $udid, $page, $limit)
|
283
|
{
|
279
|
{
|
|
@@ -285,9 +281,30 @@ class UserModel |
|
@@ -285,9 +281,30 @@ class UserModel |
285
|
|
281
|
|
286
|
$records = UserData::browseRecord($uid, $udid, $page, $limit);
|
282
|
$records = UserData::browseRecord($uid, $udid, $page, $limit);
|
287
|
|
283
|
|
|
|
284
|
+ if (!$records) {
|
|
|
285
|
+ $result['walkwayUrl'] = '/product/new';
|
|
|
286
|
+ $result['noRecord'] = true;
|
|
|
287
|
+
|
|
|
288
|
+ return $result;
|
|
|
289
|
+ }
|
|
|
290
|
+
|
288
|
// 处理数据
|
291
|
// 处理数据
|
289
|
- if (isset($records['data']['product_list']) && !empty($records['data']['product_list'])) {
|
|
|
290
|
- $result = $records['data']['product_list'];
|
292
|
+ if (isset($records['data']['product_list'])) {
|
|
|
293
|
+
|
|
|
294
|
+ // 不能再查到结果了
|
|
|
295
|
+ if ($page == 1 && $records['data']['total'] === 0) {
|
|
|
296
|
+ $result['walkwayUrl'] = '/product/new';
|
|
|
297
|
+ $result['noRecord'] = true;
|
|
|
298
|
+ } else {
|
|
|
299
|
+ $data = $records['data']['product_list'];
|
|
|
300
|
+ foreach ($data as &$val) {
|
|
|
301
|
+ $val['image'] = Helpers::getImageUrl($val['image'], 140, 140);
|
|
|
302
|
+ $val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0;
|
|
|
303
|
+ $val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0;
|
|
|
304
|
+ }
|
|
|
305
|
+
|
|
|
306
|
+ !empty($data) && $result['browseRecord'] = $data;
|
|
|
307
|
+ }
|
291
|
}
|
308
|
}
|
292
|
|
309
|
|
293
|
return $result;
|
310
|
return $result;
|
|
@@ -566,7 +583,7 @@ class UserModel |
|
@@ -566,7 +583,7 @@ class UserModel |
566
|
foreach ($suggest['data']['list'] as $val) {
|
583
|
foreach ($suggest['data']['list'] as $val) {
|
567
|
$one = array();
|
584
|
$one = array();
|
568
|
$one['suggest_id'] = $val['id'];
|
585
|
$one['suggest_id'] = $val['id'];
|
569
|
- $one['imgUrl'] = !empty($val['cover_image']) ? Images::getSourceUrl($val['cover_image'], 'suggest') . '?imageMogr2/thumbnail/320x155/extent/240x155/background/d2hpdGU=/position/center/quality/90' : '';
|
586
|
+ $one['imgUrl'] = !empty($val['cover_image']) ? Images::getSourceUrl($val['cover_image'], 'suggest') : '';
|
570
|
$one['title'] = $val['filter_content'];
|
587
|
$one['title'] = $val['filter_content'];
|
571
|
$one['content'] = $val['reply_content'];
|
588
|
$one['content'] = $val['reply_content'];
|
572
|
$one['good'] = ($val['is_reliable'] == 1);
|
589
|
$one['good'] = ($val['is_reliable'] == 1);
|