...
|
...
|
@@ -172,29 +172,25 @@ class UserModel |
|
|
|
|
|
// 处理用户收藏的商品数据
|
|
|
if (isset($favProduct['data']) && !empty($favProduct['data']['product_list'])) {
|
|
|
if ($page > $favProduct['data']['page_total']) {
|
|
|
$result['end'] = true;
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
$datas = array();
|
|
|
$product = array();
|
|
|
|
|
|
foreach ($favProduct['data']['product_list'] as $val) {
|
|
|
$product = array();
|
|
|
$product['fav_id'] = $val['product_id'];
|
|
|
$product['imgUrl'] = $val['image'];
|
|
|
$product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
|
|
|
$product['imgUrl'] = Helpers::getImageUrl($val['image'], 447, 596);;
|
|
|
$product['title'] = $val['product_name'];
|
|
|
$product['price'] = !empty($val['market_price']) ? '¥'.$val['market_price'] . '.00' : 0;
|
|
|
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . $val['sales_price'] . '.00' : false;
|
|
|
$product['savePrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) . '.00' : false;
|
|
|
$product['sellOut'] = (bool)($val['price_down']);
|
|
|
$product['savePrice'] = !empty($val['price_down'] > 0) ? '¥'.$val['price_down'] . '.00' : false;
|
|
|
$product['sellOut'] = ($val['storage'] <= 0);
|
|
|
|
|
|
$datas[] = $product;
|
|
|
}
|
|
|
|
|
|
!empty($datas) && $result['hasFavProduct'] = $datas;
|
|
|
} else if ($page > 1 && isset($favProduct['code']) && $favProduct['code'] === 500){
|
|
|
$result['end'] = true;
|
|
|
}
|
|
|
|
|
|
return $result;
|
...
|
...
|
@@ -230,19 +226,19 @@ class UserModel |
|
|
foreach ($favBrand['data']['brand_list'] as $val) {
|
|
|
$brand = array();
|
|
|
$brand['id'] = $val['brand_id'];
|
|
|
$brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314);
|
|
|
$brand['brandImg'] = !empty($val['brand_ico']) ? Images::getImageUrl($val['brand_ico'], 47, 47) : '';
|
|
|
$brand['brandName'] = $val['brand_name'];
|
|
|
$brand['update'] = $val['new_product_num'];
|
|
|
$brand['discount'] = $val['product_discount_num'];
|
|
|
$brand['link'] = '#';
|
|
|
$brand['link'] = Helpers::url('', array('query' => $val['brand_name']), 'search');
|
|
|
|
|
|
// 处理品牌产品
|
|
|
$product = array();
|
|
|
foreach ($val['new_product'] as $one) {
|
|
|
$product = array();
|
|
|
$product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
|
|
|
$product['price'] = '¥'.$one['market_price'];
|
|
|
$product['discount'] = '¥'.$one['sales_price'];
|
|
|
$product['price'] = !empty($one['market_price']) ? '¥'.$one['market_price'] . '.00' : 0;
|
|
|
$product['discount'] = !empty($one['sales_price']) ? '¥'.$one['sales_price'] . '.00' : 0;
|
|
|
|
|
|
$brand['productList'][] = $product;
|
|
|
}
|
...
|
...
|
@@ -277,7 +273,7 @@ class UserModel |
|
|
* @param int $udid 客户端唯一标识
|
|
|
* @param int $page 第几页,默认为1
|
|
|
* @param int $limit 限制多少条,默认100
|
|
|
* @return array处理之后的数据
|
|
|
* @return array 处理之后的数据
|
|
|
*/
|
|
|
public static function browserRecord($uid, $udid, $page, $limit)
|
|
|
{
|
...
|
...
|
@@ -285,9 +281,30 @@ class UserModel |
|
|
|
|
|
$records = UserData::browseRecord($uid, $udid, $page, $limit);
|
|
|
|
|
|
if (!$records) {
|
|
|
$result['walkwayUrl'] = '/product/new';
|
|
|
$result['noRecord'] = true;
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
// 处理数据
|
|
|
if (isset($records['data']['product_list']) && !empty($records['data']['product_list'])) {
|
|
|
$result = $records['data']['product_list'];
|
|
|
if (isset($records['data']['product_list'])) {
|
|
|
|
|
|
// 不能再查到结果了
|
|
|
if ($page == 1 && $records['data']['total'] === 0) {
|
|
|
$result['walkwayUrl'] = '/product/new';
|
|
|
$result['noRecord'] = true;
|
|
|
} else {
|
|
|
$data = $records['data']['product_list'];
|
|
|
foreach ($data as &$val) {
|
|
|
$val['image'] = Helpers::getImageUrl($val['image'], 140, 140);
|
|
|
$val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0;
|
|
|
$val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0;
|
|
|
}
|
|
|
|
|
|
!empty($data) && $result['browseRecord'] = $data;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $result;
|
...
|
...
|
@@ -566,7 +583,7 @@ class UserModel |
|
|
foreach ($suggest['data']['list'] as $val) {
|
|
|
$one = array();
|
|
|
$one['suggest_id'] = $val['id'];
|
|
|
$one['imgUrl'] = !empty($val['cover_image']) ? Images::getSourceUrl($val['cover_image'], 'suggest') . '?imageMogr2/thumbnail/320x155/extent/240x155/background/d2hpdGU=/position/center/quality/90' : '';
|
|
|
$one['imgUrl'] = !empty($val['cover_image']) ? Images::getSourceUrl($val['cover_image'], 'suggest') : '';
|
|
|
$one['title'] = $val['filter_content'];
|
|
|
$one['content'] = $val['reply_content'];
|
|
|
$one['good'] = ($val['is_reliable'] == 1);
|
...
|
...
|
|