Authored by Rock Zhang

修复热销排行榜返回数据中goods_list的数据键值是从1开始,导致数据处理不正常的bug

Code Review By Rock Zhang
@@ -83,6 +83,13 @@ class NewSaleProcess @@ -83,6 +83,13 @@ class NewSaleProcess
83 $count = count($products['product_list']); 83 $count = count($products['product_list']);
84 $one = array(); 84 $one = array();
85 foreach ($products['product_list'] as $key => $single) { 85 foreach ($products['product_list'] as $key => $single) {
  86 + if (!isset($single['goods_list'])) {
  87 + continue;
  88 + }
  89 +
  90 + // 重置键值
  91 + $single['goods_list'] = array_values($single['goods_list']);
  92 +
86 $one = Helpers::formatProduct($single, true, false, false, 75, 114); 93 $one = Helpers::formatProduct($single, true, false, false, 75, 114);
87 $one['rank'] = $limit * ($page -1) + $key + 1; 94 $one['rank'] = $limit * ($page -1) + $key + 1;
88 !empty($single['sales_phrase']) && $one['sales_phrase'] = $single['sales_phrase']; 95 !empty($single['sales_phrase']) && $one['sales_phrase'] = $single['sales_phrase'];