Authored by Rock Zhang

修改newsale数据处理逻辑

@@ -63,10 +63,10 @@ @@ -63,10 +63,10 @@
63 <div id="retrive-pwd-mask" class="mask"></div> 63 <div id="retrive-pwd-mask" class="mask"></div>
64 <ul id="retrive-pwd-ways" class="retrive-pwd-ways"> 64 <ul id="retrive-pwd-ways" class="retrive-pwd-ways">
65 <li> 65 <li>
66 - <a href=/phoneback.html>通过手机找回密码</a> 66 + <a href=/passport/back/mobile>通过手机找回密码</a>
67 </li> 67 </li>
68 <li> 68 <li>
69 - <a href=/emailback.html>通过邮箱找回密码</a> 69 + <a href=/passport/back/email>通过邮箱找回密码</a>
70 </li> 70 </li>
71 <li id="cancel-retrive"> 71 <li id="cancel-retrive">
72 取消 72 取消
@@ -62,7 +62,8 @@ class BackData @@ -62,7 +62,8 @@ class BackData
62 $param['re-input'] = $pwd; 62 $param['re-input'] = $pwd;
63 $param['code'] = $code; 63 $param['code'] = $code;
64 64
65 - return Yohobuy::post(Yohobuy::YOHOBUY_URL.'passport/back/update', $param); 65 + // 默认返回的不是json类型数据,是html
  66 + return Yohobuy::post(Yohobuy::YOHOBUY_URL.'passport/back/update', $param, true);
66 } 67 }
67 68
68 69
@@ -18,26 +18,59 @@ class NewSaleProcess @@ -18,26 +18,59 @@ class NewSaleProcess
18 public static function newSaleData($focus, $products) 18 public static function newSaleData($focus, $products)
19 { 19 {
20 $result = array( 20 $result = array(
21 - 'headerBanner' => self::bannerData($focus) 21 + 'headerBanner' => self::bannerData($focus),
  22 + 'goodsContainer' => array()
22 ); 23 );
23 24
24 - $list = array('list'=>array());  
25 foreach($products as $single) 25 foreach($products as $single)
26 { 26 {
  27 + // 处理Tabs
27 $noTab = true; 28 $noTab = true;
28 if(isset($single['tabs']) && $noTab) 29 if(isset($single['tabs']) && $noTab)
29 { 30 {
30 - $list['tabs'] = array();  
31 - foreach ($single['tabs'] as $one) 31 + $result['tabs'] = array();
  32 + foreach ($single['tabs'] as $key => $one)
32 { 33 {
33 - $list['tabs'][] = $one; 34 + $tabItem = array();
  35 + $tabItem['title'] = $one;
  36 + if($key === 1)
  37 + {
  38 + $tabItem['focus'] = true;
  39 + }
  40 + $result['tabs'][] = $tabItem;
34 } 41 }
35 $noTab = false; 42 $noTab = false;
36 } 43 }
37 44
38 - $list['list'][] = $single['product_list']; 45 + // 处理商品
  46 + $productsLi = array('goods'=>array());
  47 + if(isset($single['product_list']))
  48 + {
  49 + foreach ($single['product_list'] as $value)
  50 + {
  51 + $oneProduct = array();
  52 + $oneProduct['id'] = $value['product_skn'];
  53 + $oneProduct['thumb'] = Helpers::getImageUrl($value['default_images'], 290, 388, 1);
  54 + $oneProduct['name'] = $value['product_name'];
  55 + $oneProduct['price'] = $value['market_price'];
  56 + $oneProduct['salePrice'] = $value['sales_price'];
  57 + $oneProduct['isSale'] = ($value['is_discount'] === 'N' ? false : true);
  58 + $oneProduct['isFew'] = ($value['is_soon_sold_out'] === 'N' ? false : true);
  59 + $oneProduct['isNew'] = ($value['is_new'] === 'N' ? false : true);
  60 + $oneProduct['url'] = $value['product_skn'];
  61 +
  62 + $productsLi['goods'][] = $oneProduct;
  63 + }
  64 + }
  65 +
  66 + // 对于第一个productsLi添加show字段
  67 + if(count($result['goodsContainer']) === 0)
  68 + {
  69 + $productsLi['show'] = true;
  70 + }
  71 +
  72 + $result['goodsContainer'][] = $productsLi;
39 } 73 }
40 - $result['listNav'] = $list;  
41 74
42 return $result; 75 return $result;
43 } 76 }
@@ -50,7 +50,7 @@ $btnNext.on('touchstart', function() { @@ -50,7 +50,7 @@ $btnNext.on('touchstart', function() {
50 }, 50 },
51 success: function(data) { 51 success: function(data) {
52 if (data.code === 200) { 52 if (data.code === 200) {
53 - location.href = '/passport/back/code'; 53 + location.href = data.data;
54 } else { 54 } else {
55 showErrTip(data.message); 55 showErrTip(data.message);
56 } 56 }
@@ -62,8 +62,8 @@ class BackController extends AbstractAction @@ -62,8 +62,8 @@ class BackController extends AbstractAction
62 { 62 {
63 $email = $this->get('email', ''); 63 $email = $this->get('email', '');
64 // 获取到邮箱域名 64 // 获取到邮箱域名
65 - $pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";  
66 - $domain_name = 'http://mail.'.preg_replace( $pattern ,"$2", $email ); 65 + list($name, $domain) = explode('@', $email);
  66 + $domain_name = 'http://' . (($domain == 'gmail.com') ? 'mail.google.com' : 'mail.' . $domain);
67 67
68 $data = array( 68 $data = array(
69 'backUrl' => '/passport/back/email', 69 'backUrl' => '/passport/back/email',
@@ -92,7 +92,14 @@ class BackController extends AbstractAction @@ -92,7 +92,14 @@ class BackController extends AbstractAction
92 92
93 $data = BackData::modifyPasswordByEmail($pwd, $code); 93 $data = BackData::modifyPasswordByEmail($pwd, $code);
94 94
95 - $this->echoJson($data);// 前端不需要判断结果 95 + $result = array('code'=>200);
  96 + if(strpos($data, 'history.back') !== false)
  97 + {
  98 + $result['code'] = 400;
  99 + $result['message'] = '修改失败';
  100 + }
  101 +
  102 + $this->echoJson($result);// 前端不需要判断结果
96 } 103 }
97 } 104 }
98 105
@@ -131,7 +138,7 @@ class BackController extends AbstractAction @@ -131,7 +138,7 @@ class BackController extends AbstractAction
131 'isPassportPage' => true, 138 'isPassportPage' => true,
132 'backMobile' => true, 139 'backMobile' => true,
133 'countrys' => $areas, 140 'countrys' => $areas,
134 - 'countryCode' => '+86' 141 + 'areaCode' => '+86'
135 ); 142 );
136 143
137 $this->_view->assign('title', 'YOHO!有货'); 144 $this->_view->assign('title', 'YOHO!有货');
@@ -29,8 +29,8 @@ class LoginController extends AbstractAction @@ -29,8 +29,8 @@ class LoginController extends AbstractAction
29 'weiboLoginUrl' => '/passport/login/sina', // 注册的URL链接 29 'weiboLoginUrl' => '/passport/login/sina', // 注册的URL链接
30 'qqLoginUrl' => '/passport/login/qq', // 注册的URL链接 30 'qqLoginUrl' => '/passport/login/qq', // 注册的URL链接
31 'interationalUrl' => '/login.html', // 国际号登录的URL链接 31 'interationalUrl' => '/login.html', // 国际号登录的URL链接
32 - 'phoneRetriveUrl' => '/phoneback.html', // 通过手机号找回密码的URL链接  
33 - 'emailRetriveUrl' => '/emailback.html', // 通过邮箱找回密码的URL链接 32 + 'phoneRetriveUrl' => '/passport/back/mobile', // 通过手机号找回密码的URL链接
  33 + 'emailRetriveUrl' => '/passport/back/email', // 通过邮箱找回密码的URL链接
34 ); 34 );
35 35
36 // 生成HTML(signin.html) 36 // 生成HTML(signin.html)
@@ -2,345 +2,362 @@ @@ -2,345 +2,362 @@
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use LibModels\wap\Product\NewsaleData as Newsale; 4 use LibModels\wap\Product\NewsaleData as Newsale;
5 -use Plugin\Helpers; 5 +use Plugin\DataProcess\NewSaleProcess;
6 /** 6 /**
7 * 新品到着 7 * 新品到着
8 */ 8 */
9 class NewsaleController extends AbstractAction 9 class NewsaleController extends AbstractAction
10 { 10 {
11 - public function indexAction()  
12 - {  
13 - /*$this->_view->assign('title', '新品到着'); 11 + public function indexAction()
  12 + {
14 13
15 - // 新品到着顶部焦点图  
16 - $focusData = Newsale::getNewsaleFocus('a7989369aa86681c678bc40f171b8f1d');  
17 - // 处理返回的数据  
18 - $focus = array();  
19 - if($focusData['code'] == 200)  
20 - {  
21 - foreach ($focusData['data'] as $single)  
22 - {  
23 - foreach ($single['data'] as $val) {  
24 - $val['src'] = Helpers::getImageUrl($val['src'], 375, 667, 1);  
25 - $focus[] = $val;  
26 - }  
27 - }  
28 - } 14 + $data = array(
  15 + 'newArrival' => true,
  16 + 'header' => array(
  17 + 'title' => '新品到着'
  18 + )
  19 + );
29 20
30 - // 批量获取新品到着商品数据  
31 - $products = Newsale::getNewProducts('1,3', 1, 60);  
32 - var_dump($focus); 21 + // 新品到着顶部焦点图
  22 + $focusData = Newsale::getNewsaleFocus('a7989369aa86681c678bc40f171b8f1d');
  23 + // 处理返回的数据
  24 + $focus = array();
  25 + if($focusData['code'] == 200)
  26 + {
  27 + $focus = $focusData['data'];
  28 + }
33 29
34 - $this->_view->display('new', compact('focus', 'products'));*/  
35 -  
36 - $data = array(  
37 - 'headerBanner' => array(  
38 - 'list' => array(  
39 - array(  
40 - 'url' => '',  
41 - 'img' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
42 - )  
43 - )  
44 - ),  
45 - 'tabs' => array(  
46 - array(  
47 - 'title' => '10月15日',  
48 - 'focus' => true  
49 - ),  
50 - array(  
51 - 'title' => '本周上新'  
52 - ),  
53 - array(  
54 - 'title' => '销量'  
55 - )  
56 - ),  
57 - 'goodsContainer' => array(  
58 - array(  
59 - 'show' => 'true',  
60 - 'goods' => array(  
61 - array(  
62 - 'id' => '',  
63 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
64 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
65 - 'isLike' => false,  
66 - 'price' => 1268,  
67 - 'salePrice' => 589,  
68 - 'isSale' => true,  
69 - 'isFew' => true,  
70 - 'isNew' => false,  
71 - 'url' => ''  
72 - ),  
73 - array(  
74 - 'id' => '',  
75 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
76 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
77 - 'isLike' => false,  
78 - 'price' => 1268,  
79 - 'salePrice' => 589,  
80 - 'isSale' => true,  
81 - 'isFew' => true,  
82 - 'isNew' => false,  
83 - 'url' => ''  
84 - ),  
85 - array(  
86 - 'id' => '',  
87 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
88 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
89 - 'isLike' => false,  
90 - 'price' => 1268,  
91 - 'salePrice' => 589,  
92 - 'isSale' => true,  
93 - 'isFew' => true,  
94 - 'isNew' => false,  
95 - 'url' => ''  
96 - ),  
97 - array(  
98 - 'id' => '',  
99 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
100 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
101 - 'isLike' => false,  
102 - 'price' => 1268,  
103 - 'salePrice' => 589,  
104 - 'isSale' => true,  
105 - 'isFew' => true,  
106 - 'isNew' => false,  
107 - 'url' => ''  
108 - )  
109 -  
110 - )  
111 - ),  
112 - array(  
113 - 'goods' => array(  
114 - array(  
115 - 'id' => '',  
116 - 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
117 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
118 - 'isLike' => false,  
119 - 'price' => 1268,  
120 - 'salePrice' => 589,  
121 - 'isSale' => true,  
122 - 'isFew' => true,  
123 - 'isNew' => false,  
124 - 'url' => ''  
125 - ),  
126 - array(  
127 - 'id' => '',  
128 - 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
129 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
130 - 'isLike' => false,  
131 - 'price' => 1268,  
132 - 'salePrice' => 589,  
133 - 'isSale' => true,  
134 - 'isFew' => true,  
135 - 'isNew' => false,  
136 - 'url' => ''  
137 - ),  
138 - array(  
139 - 'id' => '',  
140 - 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
141 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
142 - 'isLike' => false,  
143 - 'price' => 1268,  
144 - 'salePrice' => 589,  
145 - 'isSale' => true,  
146 - 'isFew' => true,  
147 - 'isNew' => false,  
148 - 'url' => ''  
149 - ),  
150 - array(  
151 - 'id' => '',  
152 - 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
153 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
154 - 'isLike' => false,  
155 - 'price' => 1268,  
156 - 'salePrice' => 589,  
157 - 'isSale' => true,  
158 - 'isFew' => true,  
159 - 'isNew' => false,  
160 - 'url' => ''  
161 - )  
162 -  
163 - )  
164 -  
165 - ),  
166 - array(  
167 - 'goods' => array(  
168 - array(  
169 - 'id' => '',  
170 - 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',  
171 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
172 - 'isLike' => false,  
173 - 'price' => 1268,  
174 - 'salePrice' => 589,  
175 - 'isSale' => true,  
176 - 'isFew' => true,  
177 - 'isNew' => false,  
178 - 'url' => ''  
179 - ),  
180 - array(  
181 - 'id' => '',  
182 - 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',  
183 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
184 - 'isLike' => false,  
185 - 'price' => 1268,  
186 - 'salePrice' => 589,  
187 - 'isSale' => true,  
188 - 'isFew' => true,  
189 - 'isNew' => false,  
190 - 'url' => ''  
191 - ),  
192 - array(  
193 - 'id' => '',  
194 - 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',  
195 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
196 - 'isLike' => false,  
197 - 'price' => 1268,  
198 - 'salePrice' => 589,  
199 - 'isSale' => true,  
200 - 'isFew' => true,  
201 - 'isNew' => false,  
202 - 'url' => ''  
203 - ),  
204 - array(  
205 - 'id' => '',  
206 - 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',  
207 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
208 - 'isLike' => false,  
209 - 'price' => 1268,  
210 - 'salePrice' => 589,  
211 - 'isSale' => true,  
212 - 'isFew' => true,  
213 - 'isNew' => false,  
214 - 'url' => ''  
215 - )  
216 -  
217 - )  
218 -  
219 -  
220 - )  
221 -  
222 - )  
223 - ); 30 + // 批量获取新品到着商品数据
  31 + $products = Newsale::getNewProducts('1,3', 1, 60);
  32 + // 添加商品数据
  33 + $data += NewSaleProcess::newSaleData($focus, $products);
224 34
225 - $this->_view->assign('title', '新品到着');  
226 - $this->_view->display('new', $data);  
227 - } 35 + /*echo '<pre>';
  36 + print_r($data);exit;*/
228 37
  38 + /*$data = array(
  39 + 'headerBanner' => array(
  40 + 'list' => array(
  41 + array(
  42 + 'url' => '',
  43 + 'img' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  44 + )
  45 + )
  46 + ),
  47 + 'tabs' => array(
  48 + array(
  49 + 'title' => '10月15日',
  50 + 'focus' => true
  51 + ),
  52 + array(
  53 + 'title' => '本周上新'
  54 + ),
  55 + array(
  56 + 'title' => '销量'
  57 + )
  58 + ),
  59 + 'goodsContainer' => array(
  60 + array(
  61 + 'show' => 'true',
  62 + 'goods' => array(
  63 + array(
  64 + 'id' => '',
  65 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  66 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  67 + 'isLike' => false,
  68 + 'price' => 1268,
  69 + 'salePrice' => 589,
  70 + 'isSale' => true,
  71 + 'isFew' => true,
  72 + 'isNew' => false,
  73 + 'url' => ''
  74 + ),
  75 + array(
  76 + 'id' => '',
  77 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  78 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  79 + 'isLike' => false,
  80 + 'price' => 1268,
  81 + 'salePrice' => 589,
  82 + 'isSale' => true,
  83 + 'isFew' => true,
  84 + 'isNew' => false,
  85 + 'url' => ''
  86 + ),
  87 + array(
  88 + 'id' => '',
  89 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  90 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  91 + 'isLike' => false,
  92 + 'price' => 1268,
  93 + 'salePrice' => 589,
  94 + 'isSale' => true,
  95 + 'isFew' => true,
  96 + 'isNew' => false,
  97 + 'url' => ''
  98 + ),
  99 + array(
  100 + 'id' => '',
  101 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  102 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  103 + 'isLike' => false,
  104 + 'price' => 1268,
  105 + 'salePrice' => 589,
  106 + 'isSale' => true,
  107 + 'isFew' => true,
  108 + 'isNew' => false,
  109 + 'url' => ''
  110 + )
  111 +
  112 + )
  113 + ),
  114 + array(
  115 + 'goods' => array(
  116 + array(
  117 + 'id' => '',
  118 + 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
  119 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  120 + 'isLike' => false,
  121 + 'price' => 1268,
  122 + 'salePrice' => 589,
  123 + 'isSale' => true,
  124 + 'isFew' => true,
  125 + 'isNew' => false,
  126 + 'url' => ''
  127 + ),
  128 + array(
  129 + 'id' => '',
  130 + 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
  131 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  132 + 'isLike' => false,
  133 + 'price' => 1268,
  134 + 'salePrice' => 589,
  135 + 'isSale' => true,
  136 + 'isFew' => true,
  137 + 'isNew' => false,
  138 + 'url' => ''
  139 + ),
  140 + array(
  141 + 'id' => '',
  142 + 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
  143 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  144 + 'isLike' => false,
  145 + 'price' => 1268,
  146 + 'salePrice' => 589,
  147 + 'isSale' => true,
  148 + 'isFew' => true,
  149 + 'isNew' => false,
  150 + 'url' => ''
  151 + ),
  152 + array(
  153 + 'id' => '',
  154 + 'thumb' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
  155 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  156 + 'isLike' => false,
  157 + 'price' => 1268,
  158 + 'salePrice' => 589,
  159 + 'isSale' => true,
  160 + 'isFew' => true,
  161 + 'isNew' => false,
  162 + 'url' => ''
  163 + )
  164 +
  165 + )
  166 +
  167 + ),
  168 + array(
  169 + 'goods' => array(
  170 + array(
  171 + 'id' => '',
  172 + 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',
  173 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  174 + 'isLike' => false,
  175 + 'price' => 1268,
  176 + 'salePrice' => 589,
  177 + 'isSale' => true,
  178 + 'isFew' => true,
  179 + 'isNew' => false,
  180 + 'url' => ''
  181 + ),
  182 + array(
  183 + 'id' => '',
  184 + 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',
  185 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  186 + 'isLike' => false,
  187 + 'price' => 1268,
  188 + 'salePrice' => 589,
  189 + 'isSale' => true,
  190 + 'isFew' => true,
  191 + 'isNew' => false,
  192 + 'url' => ''
  193 + ),
  194 + array(
  195 + 'id' => '',
  196 + 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',
  197 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  198 + 'isLike' => false,
  199 + 'price' => 1268,
  200 + 'salePrice' => 589,
  201 + 'isSale' => true,
  202 + 'isFew' => true,
  203 + 'isNew' => false,
  204 + 'url' => ''
  205 + ),
  206 + array(
  207 + 'id' => '',
  208 + 'thumb' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/17/09/015e14c53a41c7adf0bd039f6493b5a700.jpg?imageView/2/w/140/h/140',
  209 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  210 + 'isLike' => false,
  211 + 'price' => 1268,
  212 + 'salePrice' => 589,
  213 + 'isSale' => true,
  214 + 'isFew' => true,
  215 + 'isNew' => false,
  216 + 'url' => ''
  217 + )
  218 +
  219 + )
  220 +
  221 +
  222 + )
229 223
230 - /**  
231 - * Ajax方式筛选新品到着、折扣专区商品  
232 - *  
233 - * @return array 根据指定条件筛选之后的商品  
234 - */  
235 - public function selectNewAction()  
236 - {  
237 - if($this->isAjax())  
238 - {  
239 - $gender = $this->get('gender', '1,3');  
240 - $brand = $this->get('brand', null);  
241 - $sort = $this->get('sort', null);  
242 - $color = $this->get('color', null);  
243 - $size = $this->get('size', null);  
244 - $price = $this->get('price', null);  
245 - $p_d = $this->get('p_d', null);  
246 - $channel = $this->get('channel', '1');  
247 - $dayLimit = $this->get('dayLimit', '1');  
248 - $limit = $this->get('limit', 50);  
249 - $page = $this->get('page', 1); 224 + )
  225 + );*/
250 226
251 - $data = Newsale::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page); 227 + $this->_view->assign('title', '新品到着');
  228 + $this->_view->display('new', $data);
  229 + }
252 230
253 - $this->returnJson(200, '获取成功', $data);  
254 - }  
255 - }  
256 231
  232 + /**
  233 + * Ajax方式筛选新品到着、折扣专区商品
  234 + *
  235 + * @return array 根据指定条件筛选之后的商品
  236 + */
  237 + public function selectNewAction()
  238 + {
  239 + if($this->isAjax())
  240 + {
  241 + $gender = $this->get('gender', '1,3');
  242 + $brand = $this->get('brand', null);
  243 + $sort = $this->get('sort', null);
  244 + $color = $this->get('color', null);
  245 + $size = $this->get('size', null);
  246 + $price = $this->get('price', null);
  247 + $p_d = $this->get('p_d', null);
  248 + $channel = $this->get('channel', '1');
  249 + $dayLimit = $this->get('dayLimit', '1');
  250 + $limit = $this->get('limit', 50);
  251 + $page = $this->get('page', 1);
257 252
258 - public function discountAction()  
259 - { 253 + $data = Newsale::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
260 254
261 - $data = array(  
262 - 'header' => array(  
263 - 'title' => 'SALE'  
264 - ),  
265 -  
266 - 'goodsContainer' => array(  
267 - 'goods' => array(  
268 - array(  
269 - 'id' => '',  
270 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
271 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
272 - 'isLike' => false,  
273 - 'price' => 1268,  
274 - 'salePrice' => 589,  
275 - 'isSale' => true,  
276 - 'isFew' => true,  
277 - 'isNew' => false,  
278 - 'url' => ''  
279 - ),  
280 - array(  
281 - 'id' => '',  
282 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
283 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
284 - 'isLike' => false,  
285 - 'price' => 1268,  
286 - 'salePrice' => 589,  
287 - 'isSale' => true,  
288 - 'isFew' => true,  
289 - 'isNew' => false,  
290 - 'url' => ''  
291 - ),  
292 - array(  
293 - 'id' => '',  
294 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
295 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
296 - 'isLike' => false,  
297 - 'price' => 1268,  
298 - 'salePrice' => 589,  
299 - 'isSale' => true,  
300 - 'isFew' => true,  
301 - 'isNew' => false,  
302 - 'url' => ''  
303 - ),  
304 - array(  
305 - 'id' => '',  
306 - 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',  
307 - 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',  
308 - 'isLike' => false,  
309 - 'price' => 1268,  
310 - 'salePrice' => 589,  
311 - 'isSale' => true,  
312 - 'isFew' => true,  
313 - 'isNew' => false,  
314 - 'url' => ''  
315 - )  
316 - )  
317 - )  
318 - );  
319 -  
320 - /*$this->_view->assign('title', '折扣专区'); 255 + $this->returnJson(200, '获取成功', $data);
  256 + }
  257 + }
321 258
322 - // 折扣专区顶部焦点图  
323 - $focusData = Newsale::getNewsaleFocus('e9c9be32d72e2906d404a72ee24cb523');  
324 - // 处理返回的数据  
325 - $focus = array();  
326 - if($focusData['code'] == 200)  
327 - {  
328 - foreach ($focusData['data'] as $single)  
329 - {  
330 - foreach ($single['data'] as $val) {  
331 - $val['src'] = Helpers::getImageUrl($val['src'], 375, 667, 1);  
332 - $focus[] = $val;  
333 - }  
334 - }  
335 - } 259 + /**
  260 + * 折扣专区
  261 + */
  262 + public function discountAction()
  263 + {
336 264
337 - // 折扣专区商品数据  
338 - $products = Newsale::getNewProducts('1,3', 1, 60);  
339 - var_dump($products); 265 + /*$data = array(
  266 + 'header' => array(
  267 + 'title' => 'SALE'
  268 + ),
  269 +
  270 + 'goodsContainer' => array(
  271 + 'goods' => array(
  272 + array(
  273 + 'id' => '',
  274 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  275 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  276 + 'isLike' => false,
  277 + 'price' => 1268,
  278 + 'salePrice' => 589,
  279 + 'isSale' => true,
  280 + 'isFew' => true,
  281 + 'isNew' => false,
  282 + 'url' => ''
  283 + ),
  284 + array(
  285 + 'id' => '',
  286 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  287 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  288 + 'isLike' => false,
  289 + 'price' => 1268,
  290 + 'salePrice' => 589,
  291 + 'isSale' => true,
  292 + 'isFew' => true,
  293 + 'isNew' => false,
  294 + 'url' => ''
  295 + ),
  296 + array(
  297 + 'id' => '',
  298 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  299 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  300 + 'isLike' => false,
  301 + 'price' => 1268,
  302 + 'salePrice' => 589,
  303 + 'isSale' => true,
  304 + 'isFew' => true,
  305 + 'isNew' => false,
  306 + 'url' => ''
  307 + ),
  308 + array(
  309 + 'id' => '',
  310 + 'thumb' => 'http://img12.static.yhbimg.com/adpic/2015/08/14/12/0205a06e86edb30a7d1833477a9e886577.jpg?imageView/2/w/640/h/480',
  311 + 'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
  312 + 'isLike' => false,
  313 + 'price' => 1268,
  314 + 'salePrice' => 589,
  315 + 'isSale' => true,
  316 + 'isFew' => true,
  317 + 'isNew' => false,
  318 + 'url' => ''
  319 + )
  320 + )
  321 + )
  322 + );*/
340 323
341 - $this->_view->display('new', compact('focus', 'products'));*/ 324 + $data = array(
  325 + 'discount' => true,
  326 + 'header' => array(
  327 + 'title' => 'SALE'
  328 + )
  329 + );
342 330
343 - $this->_view->assign('title', '折扣专区');  
344 - $this->_view->display('sale', $data);  
345 - } 331 + // 折扣专区顶部焦点图
  332 + $focusData = Newsale::getNewsaleFocus('e9c9be32d72e2906d404a72ee24cb523');
  333 + // 处理返回的数据
  334 + $focus = array();
  335 + if($focusData['code'] == 200)
  336 + {
  337 + $focus = $focusData['data'];
  338 + }
  339 +
  340 + // 折扣专区商品数据
  341 + $products = Newsale::getSaleProducts('1,3', 1);
  342 + // 更新tabs
  343 + $tabs = array();
  344 + foreach (array_keys($products) as $key => $value) {
  345 + $tabItem = array();
  346 + $tabItem['title'] = $value;
  347 + if($key === 0)
  348 + {
  349 + $tabItem['focus'] = true;
  350 + }
  351 + $tabs[] = $tabItem;
  352 + }
  353 + $data += array('tabs' => $tabs);
  354 + // 添加商品数据
  355 + $data += NewSaleProcess::newSaleData($focus, $products);
  356 +
  357 + echo '<pre>';
  358 + print_r($data);exit;
  359 +
  360 + $this->_view->assign('title', '折扣专区');
  361 + $this->_view->display('sale', $data);
  362 + }
346 } 363 }