Authored by uedxwg

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

@@ -22,16 +22,13 @@ class Yohobuy @@ -22,16 +22,13 @@ class Yohobuy
22 // const API_URL2 = 'http://api.open.yohobuy.com/'; 22 // const API_URL2 = 'http://api.open.yohobuy.com/';
23 // const SERVICE_URL = 'http://service.api.yohobuy.com/'; 23 // const SERVICE_URL = 'http://service.api.yohobuy.com/';
24 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 24 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
  25 + // const API_URL_LOGINSESSION = 'http://m1.yohobuy.com/';
25 26
26 /* 测试环境 */ 27 /* 测试环境 */
27 const API_URL = 'http://testapi.yoho.cn:28078/'; 28 const API_URL = 'http://testapi.yoho.cn:28078/';
28 const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; 29 const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
29 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 30 const YOHOBUY_URL = 'http://www.yohobuy.com/';
30 - const YOHOBUY_ORDER = 'http://192.168.102.209:8084/order/'; //我的订单  
31 - const API_URL_MYCENTER = 'http://192.168.102.207:8081/users/'; // 我的个人中心接口URL  
32 - const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL  
33 - const API_URL_PRODUCTDETAIL = 'http://192.168.102.212:8083/product/'; // 商品详情页  
34 - const API_URL_LOGISTICS = 'http://192.168.102.205:8080/gateway'; //查看物流接口URL 31 + const API_URL_LOGINSESSION = 'http://m1.yohobuy.com/';
35 32
36 /** 33 /**
37 * 私钥列表 34 * 私钥列表
@@ -59,7 +59,6 @@ class OrderData @@ -59,7 +59,6 @@ class OrderData
59 * To change this template file, choose Tools | Templates 59 * To change this template file, choose Tools | Templates
60 * and open the template in the editor. 60 * and open the template in the editor.
61 */ 61 */
62 -  
63 public static function deleteOrderData($order_code, $uid, $gender, $yh_channel) 62 public static function deleteOrderData($order_code, $uid, $gender, $yh_channel)
64 { 63 {
65 //构建必传参数 64 //构建必传参数
@@ -94,7 +93,7 @@ class OrderData @@ -94,7 +93,7 @@ class OrderData
94 } 93 }
95 94
96 /* 95 /*
97 - * 支付url 96 + * 支付页面的资源位
98 * To change this template file, choose Tools | Templates 97 * To change this template file, choose Tools | Templates
99 */ 98 */
100 public static function paymentData($gender, $yh_channel, $code) 99 public static function paymentData($gender, $yh_channel, $code)
1 <?php 1 <?php
  2 +
2 namespace LibModels\Wap\Passport; 3 namespace LibModels\Wap\Passport;
3 4
4 use Api\Sign; 5 use Api\Sign;
@@ -71,4 +72,35 @@ class LoginData @@ -71,4 +72,35 @@ class LoginData
71 72
72 return Yohobuy::get(Yohobuy::API_URL, $param); 73 return Yohobuy::get(Yohobuy::API_URL, $param);
73 } 74 }
  75 +
  76 + /**
  77 + * 写入SESSION会话
  78 + *
  79 + * @param int $uid 用户ID
  80 + * @return array
  81 + */
  82 + public static function signinSession($uid)
  83 + {
  84 + $param = array();
  85 + $param['uid'] = $uid;
  86 + $param['token'] = md5($uid . '#@!@#');
  87 +
  88 + return Yohobuy::get(Yohobuy::API_URL_LOGINSESSION . 'Passport/session/index', $param);
  89 + }
  90 +
  91 + /**
  92 + * 写入SESSION会话
  93 + *
  94 + * @param int $uid 用户ID
  95 + * @return array
  96 + */
  97 + public static function checkSession($uid)
  98 + {
  99 + $param = array();
  100 + $param['uid'] = $uid;
  101 + $param['token'] = md5($uid . '#@!@#');
  102 +
  103 + return Yohobuy::get(Yohobuy::API_URL_LOGINSESSION . 'Passport/session/val', $param);
  104 + }
  105 +
74 } 106 }
@@ -31,9 +31,13 @@ class DetailData @@ -31,9 +31,13 @@ class DetailData
31 */ 31 */
32 public static function baseInfo($productId, $uid) 32 public static function baseInfo($productId, $uid)
33 { 33 {
34 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array(  
35 - 'param' => intval($productId), 'userId' => intval($uid)  
36 - )); 34 + $param = Yohobuy::param();
  35 + $param['method'] = 'h5.product.data';
  36 + $param['product_id'] = $productId;
  37 + $param['uid'] = $uid;
  38 + $param['client_secret'] = Sign::getSign($param);
  39 +
  40 + return Yohobuy::post(Yohobuy::API_URL, $param);
37 } 41 }
38 42
39 /** 43 /**
@@ -44,7 +48,12 @@ class DetailData @@ -44,7 +48,12 @@ class DetailData
44 */ 48 */
45 public static function sizeInfo($productSkn) 49 public static function sizeInfo($productSkn)
46 { 50 {
47 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn))); 51 + $param = Yohobuy::param();
  52 + $param['method'] = 'h5.product.intro';
  53 + $param['productskn'] = $productSkn;
  54 + $param['client_secret'] = Sign::getSign($param);
  55 +
  56 + return Yohobuy::post(Yohobuy::API_URL, $param);
48 } 57 }
49 58
50 /** 59 /**
@@ -57,11 +66,14 @@ class DetailData @@ -57,11 +66,14 @@ class DetailData
57 */ 66 */
58 public static function consultList($productId, $pageNum, $pageSize) 67 public static function consultList($productId, $pageNum, $pageSize)
59 { 68 {
60 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_CONSULT_LIST, array(  
61 - 'productId' => intval($productId),  
62 - 'pageNum' => intval($pageNum),  
63 - 'pageSize' => intval($pageSize),  
64 - )); 69 + $param = Yohobuy::param();
  70 + $param['method'] = 'h5.consult.li';
  71 + $param['product_id'] = $productId;
  72 + $param['page'] = $pageNum;
  73 + $param['limit'] = $pageSize;
  74 + $param['client_secret'] = Sign::getSign($param);
  75 +
  76 + return Yohobuy::post(Yohobuy::API_URL, $param);
65 } 77 }
66 78
67 /** 79 /**
@@ -74,25 +86,22 @@ class DetailData @@ -74,25 +86,22 @@ class DetailData
74 */ 86 */
75 public static function commentList($productId, $pageNum, $pageSize) 87 public static function commentList($productId, $pageNum, $pageSize)
76 { 88 {
77 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_COMMENT_LIST, array(  
78 - 'productId' => intval($productId),  
79 - 'pageNum' => intval($pageNum),  
80 - 'pageSize' => intval($pageSize),  
81 - )); 89 + // 暂未提供提口
82 } 90 }
83 91
84 /** 92 /**
85 * 为你优选的商品列表 93 * 为你优选的商品列表
86 * 94 *
87 - * @todo 需要替换成JAVA接口  
88 * @param int $productSkn 商品SKN号 95 * @param int $productSkn 商品SKN号
89 * @return array 96 * @return array
90 */ 97 */
91 - public static function preference($productSkn) 98 + public static function preference($productSkn, $channel, $brandId)
92 { 99 {
93 $param = Yohobuy::param(); 100 $param = Yohobuy::param();
94 - $param['method'] = 'app.product.topreference';  
95 - $param['product_skn'] = $productSkn; 101 + $param['method'] = 'h5.preference.Search';
  102 + $param['productskn'] = $productSkn;
  103 + $param['yhchannel'] = $channel;
  104 + $param['brandId'] = $brandId;
96 $param['client_secret'] = Sign::getSign($param); 105 $param['client_secret'] = Sign::getSign($param);
97 106
98 return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时 107 return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时
@@ -108,7 +117,7 @@ class DetailData @@ -108,7 +117,7 @@ class DetailData
108 public static function addConsult($uid, $productId, $content) 117 public static function addConsult($uid, $productId, $content)
109 { 118 {
110 $param = Yohobuy::param(); 119 $param = Yohobuy::param();
111 - $param['method'] = 'app.consult.add'; 120 + $param['method'] = 'h5.consult.add';
112 $param['product_id'] = $productId; 121 $param['product_id'] = $productId;
113 $param['content'] = $content; 122 $param['content'] = $content;
114 $param['uid'] = $uid; 123 $param['uid'] = $uid;
@@ -95,9 +95,9 @@ class NewsaleData @@ -95,9 +95,9 @@ class NewsaleData
95 }); 95 });
96 96
97 $param = Yohobuy::param(); 97 $param = Yohobuy::param();
98 - if(!is_null($dayLimit)) { 98 + if (!is_null($dayLimit)) {
99 $param['method'] = 'app.search.newProduct'; 99 $param['method'] = 'app.search.newProduct';
100 - }else { 100 + } else {
101 $param['method'] = 'app.search.sales'; 101 $param['method'] = 'app.search.sales';
102 } 102 }
103 $param['page'] = $page; 103 $param['page'] = $page;
@@ -178,7 +178,6 @@ class NewsaleData @@ -178,7 +178,6 @@ class NewsaleData
178 return Yohobuy::get(Yohobuy::API_URL, $param); 178 return Yohobuy::get(Yohobuy::API_URL, $param);
179 } 179 }
180 180
181 -  
182 /** 181 /**
183 * 获取热销排行榜商品数据 182 * 获取热销排行榜商品数据
184 * 183 *
@@ -683,6 +683,7 @@ class HomeController extends AbstractAction @@ -683,6 +683,7 @@ class HomeController extends AbstractAction
683 $order['walkwayUrl'] = Helpers::url('/product/new'); 683 $order['walkwayUrl'] = Helpers::url('/product/new');
684 } else { 684 } else {
685 echo ' '; 685 echo ' ';
  686 + exit();
686 } 687 }
687 688
688 //渲染模板 689 //渲染模板
@@ -23,7 +23,7 @@ class OrderModel @@ -23,7 +23,7 @@ class OrderModel
23 { 23 {
24 $result = array(); 24 $result = array();
25 //调用接口获得数据 25 //调用接口获得数据
26 - $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid); 26 + $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, 5772257); var_dump($data); exit;
27 // 判断是否还有数据, 没有数据则返回空 27 // 判断是否还有数据, 没有数据则返回空
28 if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) { 28 if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
29 return $result; 29 return $result;
@@ -33,7 +33,7 @@ class OrderModel @@ -33,7 +33,7 @@ class OrderModel
33 foreach ($data['data']['order_list'] as $key => $vo) { 33 foreach ($data['data']['order_list'] as $key => $vo) {
34 //订单号,支付状态,订单商品数量,订单总价格 34 //订单号,支付状态,订单商品数量,订单总价格
35 $result[$key]['orderNum'] = $vo['order_code']; 35 $result[$key]['orderNum'] = $vo['order_code'];
36 - $result[$key]['orderStatus'] = $vo['status_str']; 36 + $result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $vo['status_str'];
37 $result[$key]['count'] = count($vo['order_goods']); 37 $result[$key]['count'] = count($vo['order_goods']);
38 $result[$key]['sumCost'] = $vo['amount']; 38 $result[$key]['sumCost'] = $vo['amount'];
39 //类内调用格式化订单商品数据方法 39 //类内调用格式化订单商品数据方法
@@ -96,8 +96,8 @@ class DetailModel @@ -96,8 +96,8 @@ class DetailModel
96 if (isset($baseInfo['promotionBoList'])) { 96 if (isset($baseInfo['promotionBoList'])) {
97 $build = array(); 97 $build = array();
98 foreach ($baseInfo['promotionBoList'] as $value) { 98 foreach ($baseInfo['promotionBoList'] as $value) {
99 - $build['title'] = $value['promotionTitle'];  
100 - $build['type'] = $value['promotionType']; 99 + $build['text'] = $value['promotionTitle'];
  100 + //$build['type'] = $value['promotionType'];
101 $result['goodsDiscount']['list'][] = $build; 101 $result['goodsDiscount']['list'][] = $build;
102 } 102 }
103 } 103 }
@@ -146,6 +146,8 @@ class DetailModel @@ -146,6 +146,8 @@ class DetailModel
146 'storeName' => $baseInfo['brand']['brandName'], 146 'storeName' => $baseInfo['brand']['brandName'],
147 'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain']) 147 'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
148 ); 148 );
  149 + // 为你优选的链接
  150 + $result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']));
149 } 151 }
150 152
151 // 商品信息 153 // 商品信息
@@ -448,12 +450,12 @@ class DetailModel @@ -448,12 +450,12 @@ class DetailModel
448 * @param int $productSkn 商品SKN 450 * @param int $productSkn 商品SKN
449 * @return array 451 * @return array
450 */ 452 */
451 - public static function getPreference($productSkn) 453 + public static function getPreference($productSkn, $channel, $brandId)
452 { 454 {
453 $result = array(); 455 $result = array();
454 456
455 if (is_numeric($productSkn)) { 457 if (is_numeric($productSkn)) {
456 - $preference = DetailData::preference($productSkn); 458 + $preference = DetailData::preference($productSkn, $channel, $brandId);
457 if (!empty($preference['data'])) { 459 if (!empty($preference['data'])) {
458 foreach ($preference['data'] as $value) { 460 foreach ($preference['data'] as $value) {
459 $result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false); 461 $result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
@@ -21,6 +21,7 @@ use Plugin\Cache; @@ -21,6 +21,7 @@ use Plugin\Cache;
21 class NewsaleModel 21 class NewsaleModel
22 { 22 {
23 /* 男生频道取新品到着及折扣专区数据的位置码 */ 23 /* 男生频道取新品到着及折扣专区数据的位置码 */
  24 +
24 const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12'; 25 const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12';
25 const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637'; 26 const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637';
26 /* 女生频道取新品到着及折扣专区数据的位置码 */ 27 /* 女生频道取新品到着及折扣专区数据的位置码 */
@@ -125,7 +126,6 @@ class NewsaleModel @@ -125,7 +126,6 @@ class NewsaleModel
125 return $result; 126 return $result;
126 } 127 }
127 128
128 -  
129 /** 129 /**
130 * 获取折扣专区的商品列表 130 * 获取折扣专区的商品列表
131 * 131 *
@@ -162,7 +162,6 @@ class NewsaleModel @@ -162,7 +162,6 @@ class NewsaleModel
162 return $result; 162 return $result;
163 } 163 }
164 164
165 -  
166 /** 165 /**
167 * 顶部焦点图缓存控制 166 * 顶部焦点图缓存控制
168 * @param const $cacheKey 缓存常量值 167 * @param const $cacheKey 缓存常量值
@@ -184,7 +183,7 @@ class NewsaleModel @@ -184,7 +183,7 @@ class NewsaleModel
184 $newsale = NewsaleData::getNewsaleFocus($codeKey); 183 $newsale = NewsaleData::getNewsaleFocus($codeKey);
185 184
186 // 调用接口获取数据并封装 185 // 调用接口获取数据并封装
187 - if (isset($newsale['code']) && isset($newsale['data']['list']) && !empty($newsale['data']['list'])) { 186 + if (isset($newsale['code']) && !empty($newsale['data']['list'])) {
188 if(count($newsale['data']['list'][0]['data']) === 1) { 187 if(count($newsale['data']['list'][0]['data']) === 1) {
189 $result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240); 188 $result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240);
190 } else { 189 } else {
@@ -220,7 +219,7 @@ class NewsaleModel @@ -220,7 +219,7 @@ class NewsaleModel
220 219
221 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { 220 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
222 foreach ($data['data']['product_list'] as $val) { 221 foreach ($data['data']['product_list'] as $val) {
223 - $result['goods'][] = Helpers::formatProduct($val, true, false, false, 299,388); 222 + $result['goods'][] = Helpers::formatProduct($val, true, false, false, 299, 388);
224 } 223 }
225 } 224 }
226 225
@@ -251,7 +250,6 @@ class NewsaleModel @@ -251,7 +250,6 @@ class NewsaleModel
251 return $result; 250 return $result;
252 } 251 }
253 252
254 -  
255 /** 253 /**
256 * 获取筛选数据 254 * 获取筛选数据
257 * @param array $data 接口返回的数据 255 * @param array $data 接口返回的数据
@@ -269,4 +267,5 @@ class NewsaleModel @@ -269,4 +267,5 @@ class NewsaleModel
269 267
270 return $result; 268 return $result;
271 } 269 }
  270 +
272 } 271 }
@@ -19,6 +19,9 @@ class LoginController extends AbstractAction @@ -19,6 +19,9 @@ class LoginController extends AbstractAction
19 { 19 {
20 $this->setTitle('登录'); 20 $this->setTitle('登录');
21 21
  22 + $refer = $this->get('refer', SITE_MAIN . '/?go=1');
  23 + $this->setCookie('refer', $refer);
  24 +
22 $data = array( 25 $data = array(
23 'loginIndex' => true, // 模板中使用JS的标识 26 'loginIndex' => true, // 模板中使用JS的标识
24 'backUrl' => '/', // 返回的URL链接 27 'backUrl' => '/', // 返回的URL链接
@@ -33,8 +36,6 @@ class LoginController extends AbstractAction @@ -33,8 +36,6 @@ class LoginController extends AbstractAction
33 'emailRetriveUrl' => '/passport/back/email', // 通过邮箱找回密码的URL链接 36 'emailRetriveUrl' => '/passport/back/email', // 通过邮箱找回密码的URL链接
34 ); 37 );
35 38
36 - // 生成HTML(signin.html)  
37 - $this->_view->html('signin');  
38 // 渲染模板 39 // 渲染模板
39 $this->_view->display('index', $data); 40 $this->_view->display('index', $data);
40 } 41 }
@@ -53,9 +54,7 @@ class LoginController extends AbstractAction @@ -53,9 +54,7 @@ class LoginController extends AbstractAction
53 $data['isPassportPage'] = true; // 模板中模块标识 54 $data['isPassportPage'] = true; // 模板中模块标识
54 $data['areaCode'] = '+86'; // 默认区号 55 $data['areaCode'] = '+86'; // 默认区号
55 $data['countrys'] = RegData::getAreasData(); // 地区信息列表 56 $data['countrys'] = RegData::getAreasData(); // 地区信息列表
56 - //  
57 - // 生成HTML(login.html)  
58 - $this->_view->html('login'); 57 +
59 // 渲染模板 58 // 渲染模板
60 $this->_view->display('international', $data); 59 $this->_view->display('international', $data);
61 } 60 }
@@ -124,8 +123,7 @@ class LoginController extends AbstractAction @@ -124,8 +123,7 @@ class LoginController extends AbstractAction
124 // $name = $profile['data']['mobile']; 123 // $name = $profile['data']['mobile'];
125 // } 124 // }
126 $data['data'] = '/'; // @todo 125 $data['data'] = '/'; // @todo
127 - }  
128 - while (false); 126 + } while (false);
129 127
130 $this->echoJson($data); 128 $this->echoJson($data);
131 } 129 }
@@ -188,8 +186,7 @@ class LoginController extends AbstractAction @@ -188,8 +186,7 @@ class LoginController extends AbstractAction
188 $nickname = $userInfo['response']['user_info']['user_name']; 186 $nickname = $userInfo['response']['user_info']['user_name'];
189 // $alipayEmail = $userInfo['response']['user_info']['email']; 187 // $alipayEmail = $userInfo['response']['user_info']['email'];
190 } 188 }
191 - }  
192 - else { 189 + } else {
193 $nickname = $_GET['real_name']; 190 $nickname = $_GET['real_name'];
194 // $alipayEmail = isset($_GET['email']) ? $_GET['email'] : ''; 191 // $alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
195 } 192 }
@@ -272,7 +272,7 @@ class RegController extends AbstractAction @@ -272,7 +272,7 @@ class RegController extends AbstractAction
272 if (empty($refer)) { 272 if (empty($refer)) {
273 $refer = SITE_MAIN . '/?go=1'; 273 $refer = SITE_MAIN . '/?go=1';
274 } 274 }
275 - $data['data'] = $refer; 275 + $data['data'] = rawurldecode($refer);
276 } 276 }
277 277
278 } while (false); 278 } while (false);
@@ -182,7 +182,9 @@ class DetailController extends AbstractAction @@ -182,7 +182,9 @@ class DetailController extends AbstractAction
182 182
183 if ($this->isAjax()) { 183 if ($this->isAjax()) {
184 $productSkn = $this->get('productSkn'); // 50000058 184 $productSkn = $this->get('productSkn'); // 50000058
185 - $result = \Product\DetailModel::getPreference($productSkn); 185 + $brandId = $this->get('brandId');
  186 + $channel = Helpers::getChannelByCookie();
  187 + $result = \Product\DetailModel::getPreference($productSkn, $channel, $brandId);
186 } 188 }
187 189
188 if (empty($result)) { 190 if (empty($result)) {
@@ -106,7 +106,7 @@ class NewsaleController extends AbstractAction @@ -106,7 +106,7 @@ class NewsaleController extends AbstractAction
106 $tab_id = $this->get('tab_id', null); 106 $tab_id = $this->get('tab_id', null);
107 $limit = $this->get('limit', 50); 107 $limit = $this->get('limit', 50);
108 $page = $this->get('page', 1); 108 $page = $this->get('page', 1);
109 - $notab = (boolean)$this->get('notab', false); 109 + $notab = (boolean) $this->get('notab', false);
110 110
111 // 获取性别 111 // 获取性别
112 $gender = Helpers::getGenderByCookie(); 112 $gender = Helpers::getGenderByCookie();