Authored by 毕凯

Merge remote-tracking branch 'origin/hotfix-api-change' into feature/address

@@ -24,8 +24,8 @@ class Yohobuy @@ -24,8 +24,8 @@ class Yohobuy
24 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 24 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
25 25
26 /* 测试环境 */ 26 /* 测试环境 */
27 - const API_URL = 'http://devapi.yoho.cn:58078/';  
28 - const SERVICE_URL = 'http://devservice.yoho.cn:58077/'; 27 + const API_URL = 'http://test2.open.yohobuy.com/';
  28 + const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
29 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 29 const YOHOBUY_URL = 'http://www.yohobuy.com/';
30 const YOHOBUY_ORDER = 'http://192.168.102.205:8084/order/'; //我的订单 30 const YOHOBUY_ORDER = 'http://192.168.102.205:8084/order/'; //我的订单
31 const API_URL_MYCENTER = 'http://192.168.102.205:8081/users/'; // 我的个人中心接口URL 31 const API_URL_MYCENTER = 'http://192.168.102.205:8081/users/'; // 我的个人中心接口URL
@@ -28,6 +28,5 @@ @@ -28,6 +28,5 @@
28 确认 28 确认
29 </div> 29 </div>
30 </div> 30 </div>
31 - {{> me/address/address-list}}  
32 </div> 31 </div>
33 {{> layout/footer}} 32 {{> layout/footer}}
@@ -306,6 +306,23 @@ class HomeController extends AbstractAction @@ -306,6 +306,23 @@ class HomeController extends AbstractAction
306 }*/ 306 }*/
307 307
308 /** 308 /**
  309 + * 异步获取三级地址数据
  310 + */
  311 + public function locationListAction() {
  312 + $result = array();
  313 +
  314 + if ($this->isAjax()) {
  315 + $result['addressList'] = UserModel::getAddressListData($this->_uid);
  316 + }
  317 +
  318 + if (empty($result)) {
  319 + echo ' ';
  320 + } else {
  321 + $this->_view->display('location-list', $result);
  322 + }
  323 + }
  324 +
  325 + /**
309 * 地址管理 326 * 地址管理
310 */ 327 */
311 public function addressAction() { 328 public function addressAction() {
@@ -314,14 +331,12 @@ class HomeController extends AbstractAction @@ -314,14 +331,12 @@ class HomeController extends AbstractAction
314 $this->setNavHeader('地址管理'); 331 $this->setNavHeader('地址管理');
315 332
316 $address = UserModel::getAddressData($this->_uid); 333 $address = UserModel::getAddressData($this->_uid);
317 - $addressList = UserModel::getAddressListData($this->_uid);  
318 334
319 $this->_view->display('address', array( 335 $this->_view->display('address', array(
320 'addressPage' => true, 336 'addressPage' => true,
321 'pageFooter' => true, 337 'pageFooter' => true,
322 'address' => $address, 338 'address' => $address,
323 - 'showAddBtn' => (count($address) <= 5),  
324 - 'addressList' => $addressList 339 + 'showAddBtn' => (count($address) <= 5)
325 )); 340 ));
326 } 341 }
327 342
@@ -172,29 +172,25 @@ class UserModel @@ -172,29 +172,25 @@ class UserModel
172 172
173 // 处理用户收藏的商品数据 173 // 处理用户收藏的商品数据
174 if (isset($favProduct['data']) && !empty($favProduct['data']['product_list'])) { 174 if (isset($favProduct['data']) && !empty($favProduct['data']['product_list'])) {
175 - if ($page > $favProduct['data']['page_total']) {  
176 - $result['end'] = true;  
177 -  
178 - return $result;  
179 - }  
180 -  
181 $datas = array(); 175 $datas = array();
182 $product = array(); 176 $product = array();
183 -  
184 foreach ($favProduct['data']['product_list'] as $val) { 177 foreach ($favProduct['data']['product_list'] as $val) {
185 $product = array(); 178 $product = array();
186 $product['fav_id'] = $val['product_id']; 179 $product['fav_id'] = $val['product_id'];
187 - $product['imgUrl'] = $val['image']; 180 + $product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
  181 + $product['imgUrl'] = Helpers::getImageUrl($val['image'], 447, 596);;
188 $product['title'] = $val['product_name']; 182 $product['title'] = $val['product_name'];
189 $product['price'] = !empty($val['market_price']) ? '¥'.$val['market_price'] . '.00' : 0; 183 $product['price'] = !empty($val['market_price']) ? '¥'.$val['market_price'] . '.00' : 0;
190 $product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . $val['sales_price'] . '.00' : false; 184 $product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . $val['sales_price'] . '.00' : false;
191 - $product['savePrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) . '.00' : false;  
192 - $product['sellOut'] = (bool)($val['price_down']); 185 + $product['savePrice'] = !empty($val['price_down'] > 0) ? '¥'.$val['price_down'] . '.00' : false;
  186 + $product['sellOut'] = ($val['storage'] <= 0);
193 187
194 $datas[] = $product; 188 $datas[] = $product;
195 } 189 }
196 190
197 !empty($datas) && $result['hasFavProduct'] = $datas; 191 !empty($datas) && $result['hasFavProduct'] = $datas;
  192 + } else if ($page > 1 && isset($favProduct['code']) && $favProduct['code'] === 500){
  193 + $result['end'] = true;
198 } 194 }
199 195
200 return $result; 196 return $result;
@@ -230,19 +226,19 @@ class UserModel @@ -230,19 +226,19 @@ class UserModel
230 foreach ($favBrand['data']['brand_list'] as $val) { 226 foreach ($favBrand['data']['brand_list'] as $val) {
231 $brand = array(); 227 $brand = array();
232 $brand['id'] = $val['brand_id']; 228 $brand['id'] = $val['brand_id'];
233 - $brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314); 229 + $brand['brandImg'] = !empty($val['brand_ico']) ? Images::getImageUrl($val['brand_ico'], 47, 47) : '';
234 $brand['brandName'] = $val['brand_name']; 230 $brand['brandName'] = $val['brand_name'];
235 $brand['update'] = $val['new_product_num']; 231 $brand['update'] = $val['new_product_num'];
236 $brand['discount'] = $val['product_discount_num']; 232 $brand['discount'] = $val['product_discount_num'];
237 - $brand['link'] = '#'; 233 + $brand['link'] = Helpers::url('', array('query' => $val['brand_name']), 'search');
238 234
239 // 处理品牌产品 235 // 处理品牌产品
240 $product = array(); 236 $product = array();
241 foreach ($val['new_product'] as $one) { 237 foreach ($val['new_product'] as $one) {
242 $product = array(); 238 $product = array();
243 $product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314); 239 $product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
244 - $product['price'] = '¥'.$one['market_price'];  
245 - $product['discount'] = '¥'.$one['sales_price']; 240 + $product['price'] = !empty($one['market_price']) ? '¥'.$one['market_price'] . '.00' : 0;
  241 + $product['discount'] = !empty($one['sales_price']) ? '¥'.$one['sales_price'] . '.00' : 0;
246 242
247 $brand['productList'][] = $product; 243 $brand['productList'][] = $product;
248 } 244 }
@@ -277,7 +273,7 @@ class UserModel @@ -277,7 +273,7 @@ class UserModel
277 * @param int $udid 客户端唯一标识 273 * @param int $udid 客户端唯一标识
278 * @param int $page 第几页,默认为1 274 * @param int $page 第几页,默认为1
279 * @param int $limit 限制多少条,默认100 275 * @param int $limit 限制多少条,默认100
280 - * @return array处理之后的数据 276 + * @return array 处理之后的数据
281 */ 277 */
282 public static function browserRecord($uid, $udid, $page, $limit) 278 public static function browserRecord($uid, $udid, $page, $limit)
283 { 279 {
@@ -285,9 +281,30 @@ class UserModel @@ -285,9 +281,30 @@ class UserModel
285 281
286 $records = UserData::browseRecord($uid, $udid, $page, $limit); 282 $records = UserData::browseRecord($uid, $udid, $page, $limit);
287 283
  284 + if (!$records) {
  285 + $result['walkwayUrl'] = '/product/new';
  286 + $result['noRecord'] = true;
  287 +
  288 + return $result;
  289 + }
  290 +
288 // 处理数据 291 // 处理数据
289 - if (isset($records['data']['product_list']) && !empty($records['data']['product_list'])) {  
290 - $result = $records['data']['product_list']; 292 + if (isset($records['data']['product_list'])) {
  293 +
  294 + // 不能再查到结果了
  295 + if ($page == 1 && $records['data']['total'] === 0) {
  296 + $result['walkwayUrl'] = '/product/new';
  297 + $result['noRecord'] = true;
  298 + } else {
  299 + $data = $records['data']['product_list'];
  300 + foreach ($data as &$val) {
  301 + $val['image'] = Helpers::getImageUrl($val['image'], 140, 140);
  302 + $val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0;
  303 + $val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0;
  304 + }
  305 +
  306 + !empty($data) && $result['browseRecord'] = $data;
  307 + }
291 } 308 }
292 309
293 return $result; 310 return $result;
@@ -566,7 +583,7 @@ class UserModel @@ -566,7 +583,7 @@ class UserModel
566 foreach ($suggest['data']['list'] as $val) { 583 foreach ($suggest['data']['list'] as $val) {
567 $one = array(); 584 $one = array();
568 $one['suggest_id'] = $val['id']; 585 $one['suggest_id'] = $val['id'];
569 - $one['imgUrl'] = !empty($val['cover_image']) ? Images::getSourceUrl($val['cover_image'], 'suggest') . '?imageMogr2/thumbnail/320x155/extent/240x155/background/d2hpdGU=/position/center/quality/90' : ''; 586 + $one['imgUrl'] = !empty($val['cover_image']) ? Images::getSourceUrl($val['cover_image'], 'suggest') : '';
570 $one['title'] = $val['filter_content']; 587 $one['title'] = $val['filter_content'];
571 $one['content'] = $val['reply_content']; 588 $one['content'] = $val['reply_content'];
572 $one['good'] = ($val['is_reliable'] == 1); 589 $one['good'] = ($val['is_reliable'] == 1);