Authored by yangyang

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -298,7 +298,12 @@ class FloorProcess @@ -298,7 +298,12 @@ class FloorProcess
298 $one['img'] = Helpers::getImageUrl($one['src'], 640, 403); 298 $one['img'] = Helpers::getImageUrl($one['src'], 640, 403);
299 unset($one['src']); 299 unset($one['src']);
300 } 300 }
301 - $result['big_image']['list'] = $data['big_image']; 301 +
  302 + // 区别多张图与一张图
  303 + if (count($data['big_image']) > 1) {
  304 + $result['big_image']['list'] = $data['big_image'];
  305 + unset($data['big_image']);
  306 + }
302 307
303 foreach ($data['list'] as $kk => &$one) { 308 foreach ($data['list'] as $kk => &$one) {
304 if ($kk == 0) { 309 if ($kk == 0) {
@@ -318,8 +323,6 @@ class FloorProcess @@ -318,8 +323,6 @@ class FloorProcess
318 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); 323 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']);
319 } 324 }
320 325
321 - unset($data['big_image']);  
322 -  
323 $result['goodsCategory'] = $data; 326 $result['goodsCategory'] = $data;
324 327
325 return $result; 328 return $result;
@@ -50,4 +50,47 @@ class NewSaleProcess @@ -50,4 +50,47 @@ class NewSaleProcess
50 return $result; 50 return $result;
51 } 51 }
52 52
  53 + /**
  54 + * 处理热销排行榜数据
  55 + *
  56 + * @param array $products 接口传回的数据
  57 + * @param boolean $notab 是否传回tab数据
  58 + * @param int $limit 查询返回的最大限制数
  59 + * @param int $page 分页第几页
  60 + * @return array 处理之后的数据
  61 + */
  62 + public static function topData($products, $notab, $limit, $page)
  63 + {
  64 + $result = array();
  65 +
  66 + // 处理Tabs
  67 + if (!$notab && isset($products['tabs'])) {
  68 + $result['tabs'] = array();
  69 + foreach ($products['tabs'] as $key => $one) {
  70 + $tabItem = array();
  71 + $tabItem['title'] = $one;
  72 + $tabItem['dataId'] = $key;
  73 + if ($key === 1) {
  74 + $tabItem['focus'] = true;
  75 + }
  76 + $result['tabs'][] = $tabItem;
  77 + }
  78 + }
  79 +
  80 + // 处理商品
  81 + if (isset($products['product_list'])) {
  82 +
  83 + $count = count($products['product_list']);
  84 + $one = array();
  85 + foreach ($products['product_list'] as $key => $single) {
  86 + $one = Helpers::formatProduct($single, true, false, false, 75, 114);
  87 + $one['rank'] = $limit * ($page -1) + $key + 1;
  88 +
  89 + $result['goods'][] = $one;
  90 + }
  91 + }
  92 +
  93 + return $result;
  94 + }
  95 +
53 } 96 }
@@ -25,10 +25,10 @@ class HomeController extends AbstractAction @@ -25,10 +25,10 @@ class HomeController extends AbstractAction
25 $this->setTitle('个人中心'); 25 $this->setTitle('个人中心');
26 $this->setNavHeader('个人中心', true, SITE_MAIN); 26 $this->setNavHeader('个人中心', true, SITE_MAIN);
27 27
28 - // $uid = $this->getUid();  
29 - $uid = 967016;  
30 - $data = \Index\UserModel::getUserProfileData($uid);  
31 - $data += \Index\UserModel::getInfoNumData($uid); 28 + // $uid = $this->getUid();
  29 + $uid = 8826435;
  30 + $data = \Index\UserModel::getUserProfileData($uid);
  31 + $data += \Index\UserModel::getInfoNumData($uid);
32 32
33 // 优选新品数据 33 // 优选新品数据
34 $channel = Helpers::getChannelByCookie(); 34 $channel = Helpers::getChannelByCookie();
@@ -41,50 +41,56 @@ class HomeController extends AbstractAction @@ -41,50 +41,56 @@ class HomeController extends AbstractAction
41 $this->_view->display('index', $data); 41 $this->_view->display('index', $data);
42 } 42 }
43 43
44 - /**  
45 - * 用户订单  
46 - */  
47 - public function ordersAction() {  
48 - // $uid = $this->getUid();  
49 - // $type = $this->get('type', 1);  
50 - // $orders = \Index\UserModel::getUserOrderData(967016, $type);  
51 -  
52 - $order = array(  
53 - 'orders' => array(  
54 - array(  
55 - 'orderNum' => '408539077',  
56 - 'tradingStatus' => '交易成功',  
57 - 'goods' => array(  
58 - array(  
59 - 'id' => 1,  
60 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
61 - 'name' => 'Adidas Originals ZX FLUXM22508',  
62 - 'color' => '黄',  
63 - 'size' => '43',  
64 - 'price' => '699.00',  
65 - 'count' => '2'  
66 - ),  
67 - array(  
68 - 'id' => 1,  
69 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
70 - 'name' => 'B.Duck浴室玩伴mini浮水鸭',  
71 - 'gift' => true,  
72 - 'color' => '黄',  
73 - 'size' => '43',  
74 - 'price' => '0.00',  
75 - 'count' => '1'  
76 - )  
77 - ),  
78 - 'count' => 2,  
79 - 'sumCost' => '699.00',  
80 - 'unpaid' => true,  
81 - )  
82 - )  
83 - ); 44 + /**
  45 + * 用户订单
  46 + */
  47 + public function ordersAction()
  48 + {
  49 + // 设置网站标题
  50 + $this->setTitle('我的订单');
  51 + $this->setNavHeader('我的订单', true, SITE_MAIN);
  52 +
  53 + $uid = $this->getUid();
  54 + $uid = 8826435;
  55 + $type = $this->get('type', 1);
  56 +
  57 + $order = \Index\UserModel::getUserOrderData($uid, $type);
  58 +
  59 + $order = array(
  60 + 'orders' => array(
  61 + array(
  62 + 'orderNum' => '408539077',
  63 + 'tradingStatus' => '交易成功',
  64 + 'goods' => array(
  65 + array(
  66 + 'id' => 1,
  67 + 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
  68 + 'name' => 'Adidas Originals ZX FLUXM22508',
  69 + 'color' => '黄',
  70 + 'size' => '43',
  71 + 'price' => '699.00',
  72 + 'count' => '2'
  73 + ),
  74 + array(
  75 + 'id' => 1,
  76 + 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
  77 + 'name' => 'B.Duck浴室玩伴mini浮水鸭',
  78 + 'gift' => true,
  79 + 'color' => '黄',
  80 + 'size' => '43',
  81 + 'price' => '0.00',
  82 + 'count' => '1'
  83 + )
  84 + ),
  85 + 'count' => 2,
  86 + 'sumCost' => '699.00',
  87 + 'unpaid' => true,
  88 + )
  89 + )
  90 + );
84 91
85 - $this->_view->display('order', array('order' => $order, 'orderPage' => true));  
86 - // print_r($orders);  
87 - } 92 + $this->_view->display('order', array('order' => $order, 'orderPage' => true));
  93 + }
88 94
89 /** 95 /**
90 * 用户收藏的商品 96 * 用户收藏的商品
@@ -380,7 +386,6 @@ class HomeController extends AbstractAction @@ -380,7 +386,6 @@ class HomeController extends AbstractAction
380 /* 386 /*
381 * 会员特权查看页 387 * 会员特权查看页
382 */ 388 */
383 -  
384 public function preferentialAction() { 389 public function preferentialAction() {
385 //设置网站seo信息 390 //设置网站seo信息
386 $this->setTitle('会员等级'); 391 $this->setTitle('会员等级');
@@ -397,7 +402,6 @@ class HomeController extends AbstractAction @@ -397,7 +402,6 @@ class HomeController extends AbstractAction
397 /* 402 /*
398 * 我的订单页面 403 * 我的订单页面
399 */ 404 */
400 -  
401 public function orderAction() { 405 public function orderAction() {
402 //获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论 406 //获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
403 $type = $this->get('type', 1); 407 $type = $this->get('type', 1);
@@ -426,7 +430,6 @@ class HomeController extends AbstractAction @@ -426,7 +430,6 @@ class HomeController extends AbstractAction
426 /* 430 /*
427 * 我的订单-处理ajax请求页面(切换订单状态) 431 * 我的订单-处理ajax请求页面(切换订单状态)
428 */ 432 */
429 -  
430 public function orderAjaxAction() { 433 public function orderAjaxAction() {
431 434
432 //判断是不是ajax请求 435 //判断是不是ajax请求
@@ -103,8 +103,6 @@ class UserModel @@ -103,8 +103,6 @@ class UserModel
103 103
104 // 处理用户订单数据 104 // 处理用户订单数据
105 if (isset($orderData['data']) && !empty($orderData['data'])) { 105 if (isset($orderData['data']) && !empty($orderData['data'])) {
106 - $result = $orderData['data'];  
107 -  
108 $oneOrder = array(); 106 $oneOrder = array();
109 foreach ($orderData['data']['order_list'] as $val) { 107 foreach ($orderData['data']['order_list'] as $val) {
110 $oneOrder = array(); 108 $oneOrder = array();
@@ -120,21 +118,18 @@ class UserModel @@ -120,21 +118,18 @@ class UserModel
120 $oneGoods = array(); 118 $oneGoods = array();
121 $oneGoods['id'] = 1; 119 $oneGoods['id'] = 1;
122 $oneGoods['thumb'] = Helpers::getImageUrl($goods['goods_image'], 60, 80); 120 $oneGoods['thumb'] = Helpers::getImageUrl($goods['goods_image'], 60, 80);
123 - $oneGoods['name'] = $val['product_name'];  
124 - $oneGoods['color'] = $val['color_name'];  
125 - $oneGoods['size'] = $val['size_name'];  
126 - $oneGoods['size_name'] = $val['size_name'];  
127 - $oneGoods['price'] = $val['goods_price'];  
128 - $oneGoods['count'] = $val['buy_number'];  
129 -  
130 - $result['goods'][] = $oneGoods; 121 + $oneGoods['name'] = $goods['product_name'];
  122 + $oneGoods['color'] = $goods['color_name'];
  123 + $oneGoods['size'] = $goods['size_name'];
  124 + $oneGoods['price'] = $goods['goods_price'];
  125 + $oneGoods['count'] = $goods['buy_number'];
  126 +
  127 + $oneOrder[] = $oneGoods;
131 } 128 }
132 129
133 $result['orders'][] = $oneOrder; 130 $result['orders'][] = $oneOrder;
134 } 131 }
135 -  
136 } 132 }
137 - print_r($result);  
138 133
139 return $result; 134 return $result;
140 } 135 }
@@ -234,8 +234,8 @@ class NewsaleModel @@ -234,8 +234,8 @@ class NewsaleModel
234 * @param string|null $sort 品类ID查询参数 234 * @param string|null $sort 品类ID查询参数
235 * @param integer|null $tab_id Tab的ID 235 * @param integer|null $tab_id Tab的ID
236 * @param boolean $notab 时候返回顶部tab的数据,默认返回 236 * @param boolean $notab 时候返回顶部tab的数据,默认返回
237 - * @param integer $limit 查询返回的最大限制数, 默认为50  
238 - * @param integer $page 分页第几页, 默认第1页 237 + * @param integer $limit 查询返回的最大限制数
  238 + * @param integer $page 分页第几页
239 * @return array 处理之后的数据 239 * @return array 处理之后的数据
240 */ 240 */
241 public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page) 241 public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
@@ -245,12 +245,7 @@ class NewsaleModel @@ -245,12 +245,7 @@ class NewsaleModel
245 $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page); 245 $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
246 246
247 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { 247 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
248 - $result = NewSaleProcess::newSaleData($data['data']);  
249 - unset($result['filter']);  
250 -  
251 - if ($notab) {  
252 - unset($result['tabs']);  
253 - } 248 + $result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
254 } 249 }
255 250
256 return $result; 251 return $result;