Authored by Rock Zhang

修复收藏的品牌以及商品会1限循环的bug(接口返回数据格式变化导致)

Code Review By Rock Zhang
... ... @@ -633,9 +633,16 @@ class CartModel
$data = array();
$data['name'] = $productData['product_name'];
if (isset($productData['special_price'])) { // 加价购或者赠品的销售价字段
$data['price'] = $productData['format_market_price'];
$data['salePrice'] = $productData['format_sales_price'];
} else { // 购物车商品的销售价字段
$data['price'] = $productData['market_price'] > $productData['sales_price'] ? $productData['format_market_price'] : false;
$data['salePrice'] = '¥' . Helpers::transPrice($productData['sales_price']);
}
if (isset($productData['storage_sum'])) {
$data['storage'] = $productData['storage_sum'];
}
... ...
... ... @@ -188,7 +188,7 @@ class UserModel
$favProduct = UserData::favoriteProductData($uid, $page, $limit);
// 处理用户收藏的商品数据
if (isset($favProduct['data']) && !empty($favProduct['data']['product_list'])) {
if (isset($favProduct['data']) && $page <= $favProduct['data']['page_total']) {
$datas = array();
$product = array();
foreach ($favProduct['data']['product_list'] as $val) {
... ... @@ -210,7 +210,7 @@ class UserModel
$datas[] = $product;
}
!empty($datas) && $result['hasFavProduct'] = $datas;
} else if ($page > 1 && !isset($favProduct['data']['product_list'])) {
} else if (($page > 1 && !$favProduct) || $page > $favProduct['data']['page_total']) {
$result['end'] = true;
}
... ... @@ -234,7 +234,7 @@ class UserModel
$favBrand = UserData::favoriteBrandData($uid, $gender, $page, $limit);
// 处理用户收藏的品牌数据
if (isset($favBrand['data']) && !empty($favBrand['data']['brand_list'])) {
if (isset($favBrand['data']) && $page <= $favBrand['data']['page_total']) {
$datas = array();
$brand = array();
foreach ($favBrand['data']['brand_list'] as $val) {
... ... @@ -265,7 +265,7 @@ class UserModel
$datas[] = $brand;
}
!empty($datas) && $result['hasFavBrand'] = $datas;
} else if ($page > 1 && !isset($favBrand['code']['brand_list'])) {
} else if (($page > 1 && !$favBrand) || $page > $favBrand['data']['page_total']) {
$result['end'] = true;
}
... ...