Authored by 周少峰

Merge branch 'release/5.1'

@@ -20,6 +20,7 @@ use Hood\Session; @@ -20,6 +20,7 @@ use Hood\Session;
20 use WebPlugin\Mobile; 20 use WebPlugin\Mobile;
21 use Api\Yohobuy; 21 use Api\Yohobuy;
22 use LibModels\Web\Passport\LoginData; 22 use LibModels\Web\Passport\LoginData;
  23 +use LibModels\Web\Home\IndexData;
23 use WebPlugin\UdpLog; 24 use WebPlugin\UdpLog;
24 use WebPlugin\Encryption; 25 use WebPlugin\Encryption;
25 26
@@ -564,15 +565,24 @@ class WebAction extends Controller_Abstract @@ -564,15 +565,24 @@ class WebAction extends Controller_Abstract
564 else { 565 else {
565 $channel = \Index\HomeModel::getSwitchChannel(); 566 $channel = \Index\HomeModel::getSwitchChannel();
566 } 567 }
  568 +
567 $apiDomain = $this->getApiDomain(); 569 $apiDomain = $this->getApiDomain();
568 $header = array( 570 $header = array(
569 'navbars' => \Index\HomeModel::getNavBars($channel), 571 'navbars' => \Index\HomeModel::getNavBars($channel),
  572 + 'hotSearch' => '',
570 'gobytype' => 'gobuy' . $channel, 573 'gobytype' => 'gobuy' . $channel,
571 'searchcate' => 'searchcate' . $channel, 574 'searchcate' => 'searchcate' . $channel,
572 'header' => true, 575 'header' => true,
573 'apiDomain' => $apiDomain, 576 'apiDomain' => $apiDomain,
574 'sysUserSession'=> '', 577 'sysUserSession'=> '',
575 ); 578 );
  579 +
  580 + $terms = IndexData::getHotSearchData();
  581 +
  582 + if(!empty($terms['data'])) {
  583 + $header['hotSearch'] = isset($terms['data']['hotTerms'][0]['content']) ? $terms['data']['defaultTerms'][0]['content'] : '';
  584 + }
  585 +
576 //同步session 586 //同步session
577 if(!empty($uid) && $sysUserSession < 20) { 587 if(!empty($uid) && $sysUserSession < 20) {
578 $header['sysUserSession'] = Helpers::syncUserSession($uid); 588 $header['sysUserSession'] = Helpers::syncUserSession($uid);
@@ -155,10 +155,10 @@ class Yohobuy @@ -155,10 +155,10 @@ class Yohobuy
155 $urlBack = $url; 155 $urlBack = $url;
156 156
157 if (USE_INTER_FACE_SHUNT) { 157 if (USE_INTER_FACE_SHUNT) {
158 - if (strpos($url, API_URL)) { 158 + if (strpos($url, API_URL) !== false) {
159 $isApi = true; 159 $isApi = true;
160 $url = self::_getUrl($url, $data); 160 $url = self::_getUrl($url, $data);
161 - } else if (strpos($url, SERVICE_URL)) { 161 + } else if (strpos($url, SERVICE_URL) !== false) {
162 $isService = true; 162 $isService = true;
163 $url = self::_getUrl($url, $data); 163 $url = self::_getUrl($url, $data);
164 } 164 }
@@ -180,7 +180,7 @@ class Yohobuy @@ -180,7 +180,7 @@ class Yohobuy
180 $url = self::httpBuildQuery($url, $data); 180 $url = self::httpBuildQuery($url, $data);
181 } //echo $url; 181 } //echo $url;
182 182
183 - UdpLog::debug('get shut api', $url); 183 + // UdpLog::debug('get shut api', $url);
184 184
185 /* 开启缓存的情况 */ 185 /* 开启缓存的情况 */
186 if ($cache && USE_CACHE) { 186 if ($cache && USE_CACHE) {
@@ -212,10 +212,9 @@ class Yohobuy @@ -212,10 +212,9 @@ class Yohobuy
212 } 212 }
213 213
214 $result = curl_exec($ch); 214 $result = curl_exec($ch);
215 - $httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);  
216 215
217 //如果分流执行失败,则走原来的逻辑 216 //如果分流执行失败,则走原来的逻辑
218 - if (USE_INTER_FACE_SHUNT && $httpCode !== 200) { 217 + if (USE_INTER_FACE_SHUNT && curl_getinfo($ch,CURLINFO_HTTP_CODE) !== 200) {
219 curl_close($ch); 218 curl_close($ch);
220 return self::_get($urlBack, $data, $cache, $returnJson, $timeout, $userAgent, $useGzip); 219 return self::_get($urlBack, $data, $cache, $returnJson, $timeout, $userAgent, $useGzip);
221 } 220 }
@@ -279,7 +278,6 @@ class Yohobuy @@ -279,7 +278,6 @@ class Yohobuy
279 UdpLog::debug('call api: ', $url); 278 UdpLog::debug('call api: ', $url);
280 279
281 $result = curl_exec($ch); 280 $result = curl_exec($ch);
282 - $httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);  
283 if (!$returnJson && !empty($result)) { 281 if (!$returnJson && !empty($result)) {
284 $result = json_decode($result, true); 282 $result = json_decode($result, true);
285 } 283 }
@@ -319,10 +317,10 @@ class Yohobuy @@ -319,10 +317,10 @@ class Yohobuy
319 $urlBack = $url; 317 $urlBack = $url;
320 318
321 if (USE_INTER_FACE_SHUNT) { 319 if (USE_INTER_FACE_SHUNT) {
322 - if (strpos($url, API_URL)) { 320 + if (strpos($url, API_URL) !== false) {
323 $isApi = true; 321 $isApi = true;
324 $url = self::_getUrl($url, $data); 322 $url = self::_getUrl($url, $data);
325 - } else if (strpos($url, SERVICE_URL)) { 323 + } else if (strpos($url, SERVICE_URL) !== false) {
326 $isService = true; 324 $isService = true;
327 $url = self::_getUrl($url, $data); 325 $url = self::_getUrl($url, $data);
328 } 326 }
@@ -372,12 +370,8 @@ class Yohobuy @@ -372,12 +370,8 @@ class Yohobuy
372 } 370 }
373 $result = curl_exec($ch); 371 $result = curl_exec($ch);
374 372
375 - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);  
376 -  
377 - UdpLog::debug('post api', array('url' => $url, 'httpCode' => $httpCode));  
378 -  
379 //如果分流执行失败,则走原来的逻辑 373 //如果分流执行失败,则走原来的逻辑
380 - if (USE_INTER_FACE_SHUNT && $httpCode !== 200) { 374 + if (USE_INTER_FACE_SHUNT && curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) {
381 curl_close($ch); 375 curl_close($ch);
382 return self::_post($urlBack, $data, $returnJson, $timeout, $header, $cookie); 376 return self::_post($urlBack, $data, $returnJson, $timeout, $header, $cookie);
383 } 377 }
@@ -708,11 +702,9 @@ class Yohobuy @@ -708,11 +702,9 @@ class Yohobuy
708 return false; 702 return false;
709 } 703 }
710 704
711 -  
712 - UdpLog::debug('read memcache');  
713 $interfaceShunt = Cache::getBy('INTERFACE_SHUT_KEY', 'master'); 705 $interfaceShunt = Cache::getBy('INTERFACE_SHUT_KEY', 'master');
714 706
715 - UdpLog::debug('read memcahe: ', $interfaceShunt); 707 + // UdpLog::debug('read memcahe: ', $interfaceShunt);
716 if (empty($interfaceShunt)) { 708 if (empty($interfaceShunt)) {
717 return false; 709 return false;
718 } 710 }
@@ -761,7 +753,7 @@ class Yohobuy @@ -761,7 +753,7 @@ class Yohobuy
761 } 753 }
762 754
763 $paseUrl = parse_url($url); 755 $paseUrl = parse_url($url);
764 - if (strpos($url, API_URL)) { 756 + if (strpos($url, API_URL) !== false) {
765 757
766 if (empty($ips['api.yoho.cn'])) { 758 if (empty($ips['api.yoho.cn'])) {
767 return false; 759 return false;
@@ -775,7 +767,7 @@ class Yohobuy @@ -775,7 +767,7 @@ class Yohobuy
775 767
776 $url = 'http://' . $ips['api.yoho.cn'][$num]['ip'] . rtrim($paseUrl['path'], '/') . '/'; 768 $url = 'http://' . $ips['api.yoho.cn'][$num]['ip'] . rtrim($paseUrl['path'], '/') . '/';
777 769
778 - } else if (strpos($url, SERVICE_URL)) { 770 + } else if (strpos($url, SERVICE_URL) !== false) {
779 771
780 if (empty($ips['service.yoho.cn'])) { 772 if (empty($ips['service.yoho.cn'])) {
781 return false; 773 return false;
@@ -32,6 +32,23 @@ class IndexData @@ -32,6 +32,23 @@ class IndexData
32 } 32 }
33 33
34 /** 34 /**
  35 + * 获取热搜词数据
  36 + *
  37 + * @param int $status (default)
  38 + * @param string $fields (default)
  39 + * @return array
  40 + */
  41 + public static function getHotSearchData()
  42 + {
  43 + $params = Yohobuy::param();
  44 + $params['client_type'] = 'web'; // 调用web手机网站的
  45 + $params['method'] = 'app.search.getTerms';
  46 + $params['private_key'] = Yohobuy::$privateKeyList['web'];
  47 + $params['client_secret'] = Sign::getSign($params);
  48 + return Yohobuy::get(API_URL, $params, true);
  49 + }
  50 +
  51 + /**
35 * 获取资源数据 52 * 获取资源数据
36 * 53 *
37 * @param string $content_code 54 * @param string $content_code
@@ -135,8 +135,9 @@ @@ -135,8 +135,9 @@
135 <div class="search float-left {{searchcate}}" > 135 <div class="search float-left {{searchcate}}" >
136 <form action="//search.yohobuy.com" method="get" id="searchForm"> 136 <form action="//search.yohobuy.com" method="get" id="searchForm">
137 <span class="searchspan"> 137 <span class="searchspan">
138 - <input type="hidden" id="defaultsearch">  
139 - <input class="searchinput" type="text" name="query" id="query_key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="" onfocus="if(this.value==this.defaultValue){this.value='';this.style.color='#333'}" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#999'}" maxlength="30"></span> 138 + <input type="hidden" id="defaultsearch" value="">
  139 + <input class="searchinput" type="text" name="query" id="query_key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="{{hotSearch}}" onfocus="if(this.value==this.defaultValue){this.value='';this.style.color='#333'}" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#999'}" maxlength="30" style="color: #999;">
  140 + </span>
140 <a class="icon-search" href="javascript:submitSearch();"></a> 141 <a class="icon-search" href="javascript:submitSearch();"></a>
141 <ul class="search-list"></ul> 142 <ul class="search-list"></ul>
142 </form> 143 </form>
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -111,7 +111,7 @@ function getShoppingKey() { @@ -111,7 +111,7 @@ function getShoppingKey() {
111 a.async = 1; 111 a.async = 1;
112 a.src = j; 112 a.src = j;
113 m.parentNode.insertBefore(a, m); 113 m.parentNode.insertBefore(a, m);
114 -})(window, document, 'script', ('https:' == document.location.protocol ? 'https' : 'http') + '://' + 'cdn.yoho.cn/yas-jssdk/1.0.17/yas.js', '_yas'); 114 +})(window, document, 'script', ('https:' == document.location.protocol ? 'https' : 'http') + '://' + 'cdn.yoho.cn/yas-jssdk/1.0.18/yas.js', '_yas');
115 115
116 (function() { 116 (function() {
117 var uid = getUid(); 117 var uid = getUid();
@@ -121,7 +121,7 @@ function getShoppingKey() { @@ -121,7 +121,7 @@ function getShoppingKey() {
121 window._ozuid = uid; //暴露ozuid 121 window._ozuid = uid; //暴露ozuid
122 122
123 if (window._yas) { 123 if (window._yas) {
124 - window._yas(1 * new Date(), '1.0.17', 'yohobuy_web', uid, '', ''); 124 + window._yas(1 * new Date(), '1.0.18', 'yohobuy_web', uid, '', '');
125 } 125 }
126 }()); 126 }());
127 127
@@ -803,6 +803,7 @@ @@ -803,6 +803,7 @@
803 float: left; 803 float: left;
804 width: 240px; 804 width: 240px;
805 height: 28px; 805 height: 28px;
  806 + color: #999;
806 border: 1px solid #000; 807 border: 1px solid #000;
807 box-sizing: border-box; 808 box-sizing: border-box;
808 padding: 6px 0 5px 10px; 809 padding: 6px 0 5px 10px;
@@ -36,7 +36,7 @@ class OrderModel @@ -36,7 +36,7 @@ class OrderModel
36 if($orderV['is_cancel'] == 'Y' || $orderV['status'] === 6) { 36 if($orderV['is_cancel'] == 'Y' || $orderV['status'] === 6) {
37 $orders[$orderK]['canDelete'] = true; //删除订单 37 $orders[$orderK]['canDelete'] = true; //删除订单
38 } 38 }
39 - $statusInfo = self::getOrderStatus($orderV['is_cancel'], $orderV['status'], $orderV['payment_type'], $orderV['payment_status']); 39 + $statusInfo = self::getOrderStatus($orderV['is_cancel'], $orderV['status'], $orderV['payment_type'], $orderV['payment_status'], $orderV['status_str']);
40 //订单状态 40 //订单状态
41 if ($statusInfo['cancel']) { 41 if ($statusInfo['cancel']) {
42 $orders[$orderK]['cancel'] = $statusInfo['cancel']; 42 $orders[$orderK]['cancel'] = $statusInfo['cancel'];
@@ -83,7 +83,7 @@ class OrderModel @@ -83,7 +83,7 @@ class OrderModel
83 $orders[$orderK]['fregit'] = $orderV['shipping_cost']; //邮费 83 $orders[$orderK]['fregit'] = $orderV['shipping_cost']; //邮费
84 } 84 }
85 //操作 85 //操作
86 - $orders[$orderK]['operation'] = self::getOperateInfo($orderV['attribute'], $orderV['is_cancel'], $orderV['status'], $orderV['payment_status'], $orderV['update_time'], $orderV['order_type'], $orderV['refund_status'], $orderV['payment_type'], $orderV['order_code'], $opRefundStatus); 86 + $orders[$orderK]['operation'] = self::getOperateInfo($orderV['attribute'], $orderV['is_cancel'], $orderV['status'], $orderV['payment_status'], $orderV['update_time'], $orderV['order_type'], $orderV['refund_status'], $orderV['payment_type'], $orderV['order_code'], $opRefundStatus, $orderV['use_limit_code']);
87 87
88 if ($orderV['attribute'] * 1 === 3) { 88 if ($orderV['attribute'] * 1 === 3) {
89 //包含虚拟商品,订单列表不显示物流属性 89 //包含虚拟商品,订单列表不显示物流属性
@@ -507,9 +507,10 @@ class OrderModel @@ -507,9 +507,10 @@ class OrderModel
507 * @param type $status 507 * @param type $status
508 * @param type $payType 508 * @param type $payType
509 * @param type $payStatus 509 * @param type $payStatus
  510 + * @param type $statusStr
510 * @return string 511 * @return string
511 */ 512 */
512 - protected static function getOrderStatus($isCancel, $status, $payType, $payStatus) 513 + protected static function getOrderStatus($isCancel, $status, $payType, $payStatus, $statusStr = '')
513 { 514 {
514 //初始化:未取消,待付款 515 //初始化:未取消,待付款
515 $ret = array('cancel' => FALSE, 'keyName' => 'noPay', 'statusStr' => '待付款'); 516 $ret = array('cancel' => FALSE, 'keyName' => 'noPay', 'statusStr' => '待付款');
@@ -556,6 +557,9 @@ class OrderModel @@ -556,6 +557,9 @@ class OrderModel
556 break; 557 break;
557 } 558 }
558 } 559 }
  560 + if ($statusStr) {
  561 + $ret['statusStr'] = $statusStr;
  562 + }
559 return $ret; 563 return $ret;
560 } 564 }
561 565
@@ -571,9 +575,10 @@ class OrderModel @@ -571,9 +575,10 @@ class OrderModel
571 * @param type $paymentType 付款类型 575 * @param type $paymentType 付款类型
572 * @param type $orderCode 订单号 576 * @param type $orderCode 订单号
573 * @param type $opRefundStatus 退换操作是否灰化 true 灰化 false 可用 577 * @param type $opRefundStatus 退换操作是否灰化 true 灰化 false 可用
  578 + * @param type $useLimitCode 使用限购码 N(默认), Y
574 * @return string 579 * @return string
575 */ 580 */
576 - protected static function getOperateInfo($attribute, $isCancel, $status, $payStatus, $updateTime, $orderType, $refundStatus, $paymentType, $orderCode, $opRefundStatus) 581 + protected static function getOperateInfo($attribute, $isCancel, $status, $payStatus, $updateTime, $orderType, $refundStatus, $paymentType, $orderCode, $opRefundStatus = false, $useLimitCode = 'N')
577 { 582 {
578 //查看订单 583 //查看订单
579 $orderDetailUrl = Helpers::url('/home/orders/detail', array('orderCode' => $orderCode)); 584 $orderDetailUrl = Helpers::url('/home/orders/detail', array('orderCode' => $orderCode));
@@ -590,8 +595,8 @@ class OrderModel @@ -590,8 +595,8 @@ class OrderModel
590 $exchangeUrl = Helpers::url('/home/returns/exchangeRequest', array('orderCode' => $orderCode)); 595 $exchangeUrl = Helpers::url('/home/returns/exchangeRequest', array('orderCode' => $orderCode));
591 //申请退货 596 //申请退货
592 $refundUrl = Helpers::url('/home/returns/refundrequest', array('orderCode' => $orderCode)); 597 $refundUrl = Helpers::url('/home/returns/refundrequest', array('orderCode' => $orderCode));
593 - //再次购买  
594 - if ( $isCancel == 'Y') { 598 + //再次购买 use_limit_code
  599 + if ( $isCancel == 'Y' && $useLimitCode !== 'Y') {
595 $operation[] = array( 'name' => '再次购买', 'reBuy' => true); 600 $operation[] = array( 'name' => '再次购买', 'reBuy' => true);
596 } 601 }
597 //立即付款 602 //立即付款
@@ -627,6 +632,10 @@ class OrderModel @@ -627,6 +632,10 @@ class OrderModel
627 $operation[] = array('href' => $refundUrl, 'name' => '申请退货', 'optDis' => $opRefundStatus); 632 $operation[] = array('href' => $refundUrl, 'name' => '申请退货', 'optDis' => $opRefundStatus);
628 } 633 }
629 634
  635 + // 预售商品提示app操作
  636 + if ($attribute == 9) {
  637 + $operation = array('name' => '定金预售商品只能在APP端操作');
  638 + }
630 return $operation; 639 return $operation;
631 } 640 }
632 641
@@ -95,10 +95,10 @@ class UserModel @@ -95,10 +95,10 @@ class UserModel
95 'name' => '我的评论', 95 'name' => '我的评论',
96 'href' => Helpers::url('/home/comment') 96 'href' => Helpers::url('/home/comment')
97 ), 97 ),
98 - array(  
99 - 'name' => '我的投诉',  
100 - 'href' => Helpers::url('/home/complaints')  
101 - ), 98 +// array(
  99 +// 'name' => '我的投诉',
  100 +// 'href' => Helpers::url('/home/complaints')
  101 +// ),
102 array( 102 array(
103 'name' => '我的信息', 103 'name' => '我的信息',
104 'count' => self::unredTotal($uid), //获取未读消息数量 104 'count' => self::unredTotal($uid), //获取未读消息数量
@@ -21,8 +21,8 @@ define('USE_INTER_FACE_SHUNT', false);//分流开关 @@ -21,8 +21,8 @@ define('USE_INTER_FACE_SHUNT', false);//分流开关
21 //define('API_OLD', 'http://test2.open.yohobuy.com/'); 21 //define('API_OLD', 'http://test2.open.yohobuy.com/');
22 22
23 #dev环境 23 #dev环境
24 - define('API_URL', 'http://api-test2.yohops.com:9999');  
25 - define('SERVICE_URL', 'http://service-test2.yohops.com:9999/'); 24 + define('API_URL', 'http://api-test3.yohops.com:9999');
  25 + define('SERVICE_URL', 'http://service-test3.yohops.com:9999/');
26 define('YOHOBUY_URL', 'http://www.yohobuy.com/'); 26 define('YOHOBUY_URL', 'http://www.yohobuy.com/');
27 define('SERVICE_NOTIFY', 'http://test2.open.yohobuy.com/'); 27 define('SERVICE_NOTIFY', 'http://test2.open.yohobuy.com/');
28 define('API_OLD', 'http://devservice.yoho.cn:58077/'); 28 define('API_OLD', 'http://devservice.yoho.cn:58077/');
@@ -14,8 +14,8 @@ define('EXHIBITION_TICKET', 51335912);//展览票skn @@ -14,8 +14,8 @@ define('EXHIBITION_TICKET', 51335912);//展览票skn
14 14
15 define('USE_INTER_FACE_SHUNT', false);//分流开关 15 define('USE_INTER_FACE_SHUNT', false);//分流开关
16 16
17 -define('API_URL', 'http://api-test2.yohops.com:9999/');  
18 -define('SERVICE_URL', 'http://service-test2.yohops.com:9999/'); 17 +define('API_URL', 'http://api-test3.yohops.com:9999/');
  18 +define('SERVICE_URL', 'http://service-test3.yohops.com:9999/');
19 define('YOHOBUY_URL', 'http://www.yohobuy.com/'); 19 define('YOHOBUY_URL', 'http://www.yohobuy.com/');
20 define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/'); 20 define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
21 define('API_OLD', 'http://test2.open.yohobuy.com/'); 21 define('API_OLD', 'http://test2.open.yohobuy.com/');