Authored by xiaowei

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

@@ -480,7 +480,7 @@ class WebAction extends Controller_Abstract @@ -480,7 +480,7 @@ class WebAction extends Controller_Abstract
480 $header = array( 480 $header = array(
481 'navbars'=> \Index\HomeModel::getNavBars($channel), 481 'navbars'=> \Index\HomeModel::getNavBars($channel),
482 'gobytype'=> 'gobuy'.$channel, 482 'gobytype'=> 'gobuy'.$channel,
483 - 'searchcate'=>'searchcate'.$channel, 483 + // 'searchcate'=>'searchcate'.$channel,
484 'header'=> true, 484 'header'=> true,
485 'apiDomain'=> $apiDomain 485 'apiDomain'=> $apiDomain
486 ); 486 );
@@ -20,7 +20,7 @@ class HelperSearch @@ -20,7 +20,7 @@ class HelperSearch
20 //总页数 20 //总页数
21 public static $pageTotal; 21 public static $pageTotal;
22 //总记录数 22 //总记录数
23 - public static $total; 23 + public static $total = 0;
24 //接口返回搜索条件 24 //接口返回搜索条件
25 public static $filter; 25 public static $filter;
26 //选中的条件 26 //选中的条件
@@ -142,10 +142,6 @@ class HelperSearch @@ -142,10 +142,6 @@ class HelperSearch
142 } 142 }
143 //选中条件 143 //选中条件
144 $result['filters']['checkedConditions'] = self::getSelected(); 144 $result['filters']['checkedConditions'] = self::getSelected();
145 - if (empty($result['goods'])) {  
146 - $result['filters'] = array();  
147 - $result['opts'] = array();  
148 - }  
149 $result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listNav; 145 $result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listNav;
150 return $result; 146 return $result;
151 } 147 }
@@ -680,10 +676,6 @@ class HelperSearch @@ -680,10 +676,6 @@ class HelperSearch
680 public static function price($filter) 676 public static function price($filter)
681 { 677 {
682 $result = array(); 678 $result = array();
683 - //商品记录小于10,不显示价格区间  
684 - if (self::$total < 10) {  
685 - return $result;  
686 - }  
687 $params = self::$params; 679 $params = self::$params;
688 $priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : ''; 680 $priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
689 if (isset($params['price'])) { 681 if (isset($params['price'])) {
@@ -707,6 +699,10 @@ class HelperSearch @@ -707,6 +699,10 @@ class HelperSearch
707 'href' => self::buildUrl($params) 699 'href' => self::buildUrl($params)
708 ); 700 );
709 } 701 }
  702 + //商品记录小于10,不显示价格区间
  703 + if (self::$total < 10) {
  704 + return $result;
  705 + }
710 if (self::checkSearch('price')) { 706 if (self::checkSearch('price')) {
711 return array(); 707 return array();
712 } 708 }
@@ -777,7 +773,7 @@ class HelperSearch @@ -777,7 +773,7 @@ class HelperSearch
777 $styleName = $v['style_name'].""; 773 $styleName = $v['style_name']."";
778 } 774 }
779 elseif ($styleNum ===1){ 775 elseif ($styleNum ===1){
780 - $styleName .= substr($v['style_name'], 0, 3).'...'; 776 + $styleName .= substr($v['style_name'], 0, 4).'...';
781 } 777 }
782 $styleNum ++; 778 $styleNum ++;
783 } 779 }
@@ -1086,6 +1082,10 @@ class HelperSearch @@ -1086,6 +1082,10 @@ class HelperSearch
1086 public static function getSelected() 1082 public static function getSelected()
1087 { 1083 {
1088 $result = array(); 1084 $result = array();
  1085 + //无结果
  1086 + if (self::$total == 0 && self::$options['controller'] == 'Search') {
  1087 + return $result;
  1088 + }
1089 $data = array(); 1089 $data = array();
1090 foreach (self::$selected as $key => $val) { 1090 foreach (self::$selected as $key => $val) {
1091 $data[] = $val; 1091 $data[] = $val;
@@ -1386,6 +1386,10 @@ class HelperSearch @@ -1386,6 +1386,10 @@ class HelperSearch
1386 */ 1386 */
1387 public static function getOpts() 1387 public static function getOpts()
1388 { 1388 {
  1389 + //无结果
  1390 + if (self::$total == 0 && self::$options['controller'] == 'Search') {
  1391 + return array();
  1392 + }
1389 //排序方式 1393 //排序方式
1390 $result['sortType'] = array( self::orderDefault(),self::orderTime(),self::orderPrice(),self::orderDiscount()); 1394 $result['sortType'] = array( self::orderDefault(),self::orderTime(),self::orderPrice(),self::orderDiscount());
1391 //特殊:新品、特价、限量 1395 //特殊:新品、特价、限量
@@ -8,8 +8,8 @@ @@ -8,8 +8,8 @@
8 <script src="http://cdn.yoho.cn/yohobuy/{{version}}/index-debug.js"></script> 8 <script src="http://cdn.yoho.cn/yohobuy/{{version}}/index-debug.js"></script>
9 {{/if}} 9 {{/if}}
10 {{#if testEnv}} 10 {{#if testEnv}}
11 - <script src="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/lib.js"></script>  
12 - <script src="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/index-debug.js"></script> 11 + <script src="http://cdn.yoho.cn/yohobuy/{{version}}/lib.js"></script>
  12 + <script src="http://cdn.yoho.cn/yohobuy/{{version}}/index-debug.js"></script>
13 {{/if}} 13 {{/if}}
14 {{#if devEnv}} 14 {{#if devEnv}}
15 <script src="http://localhost:8001/static/js/sea.js?nowrap"></script> 15 <script src="http://localhost:8001/static/js/sea.js?nowrap"></script>
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css"> 21 <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
22 {{/if}} 22 {{/if}}
23 {{#if testEnv}} 23 {{#if testEnv}}
24 - <link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/index.css"> 24 + <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
25 {{/if}} 25 {{/if}}
26 {{#if devEnv}} 26 {{#if devEnv}}
27 <link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css"> 27 <link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css">
@@ -4,11 +4,19 @@ use WebPlugin\Cache; @@ -4,11 +4,19 @@ use WebPlugin\Cache;
4 use Configs\WebCacheConfig; 4 use Configs\WebCacheConfig;
5 use WebPlugin\AuthCode; 5 use WebPlugin\AuthCode;
6 use Index\HomeModel; 6 use Index\HomeModel;
  7 +use Api\Yohobuy;
  8 +use Api\Sign;
  9 +use LibModels\Web\Home\IndexData;
7 class ToolsController extends WebAction 10 class ToolsController extends WebAction
8 { 11 {
9 public function init() 12 public function init()
10 { 13 {
  14 + if(APPLICATION_ENV == 'production') {
  15 + $valid_passwords = array ('yoho' => '9646abcdef');
  16 + } else {
11 $valid_passwords = array ('test' => '123456'); 17 $valid_passwords = array ('test' => '123456');
  18 + }
  19 +
12 $valid_users = array_keys($valid_passwords); 20 $valid_users = array_keys($valid_passwords);
13 $user = $pass = ''; 21 $user = $pass = '';
14 if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_USER'])) 22 if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_USER']))
@@ -25,9 +33,52 @@ class ToolsController extends WebAction @@ -25,9 +33,52 @@ class ToolsController extends WebAction
25 } 33 }
26 34
27 /** 35 /**
28 - * 缓存html 36 + * 工具首页
  37 + */
  38 + public function indexAction()
  39 + {
  40 + $html = '<br/><h2>工具首页</h2><br/>';
  41 + $channels = array('JAVA API'=>'/tools/javaapi', '缓存页面' =>'/tools/cache');
  42 + foreach($channels as $name => $url) {
  43 + $html .= sprintf('<li style="font-size:18px;"><a href="%s" target="_blank">%s</a></li>',$url, $name);
  44 + }
  45 + echo $html;
  46 + }
  47 +
  48 + /**
  49 + * java api测试
29 * 50 *
30 */ 51 */
  52 + public function javaapiAction()
  53 + {
  54 + $html = '<br/><h3>java api测试</h3><br/>';
  55 + $channels = array('获取资源位'=> $this->getResourceUrl(), '获取最新上架' =>'');
  56 + foreach($channels as $name => $url) {
  57 + $html .= sprintf('<li style="font-size:18px;"><a href="%s" target="_blank">%s</a></li>',$url, $name);
  58 + }
  59 + echo $html;
  60 + }
  61 +
  62 + /**
  63 + * 获取资源位地址
  64 + *
  65 + * @return string
  66 + */
  67 + private function getResourceUrl()
  68 + {
  69 + $client_type ='web';
  70 + $content_code = '0c911d3000f52e8ca7cffb74f5864c29';
  71 + $params = Yohobuy::param();
  72 + $params['content_code'] = $content_code;
  73 + $params['client_type'] = $client_type;
  74 + $params['private_key'] = Yohobuy::$privateKeyList[$client_type];
  75 + $params['client_secret'] = Sign::getSign($params);
  76 + return Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL.IndexData::URL_OPERATIONS_RESOURCE_GET, $params);
  77 + }
  78 +
  79 + /**
  80 + * 缓存html
  81 + */
31 public function cacheAction() 82 public function cacheAction()
32 { 83 {
33 //频道=>key 84 //频道=>key
@@ -38,7 +89,7 @@ class ToolsController extends WebAction @@ -38,7 +89,7 @@ class ToolsController extends WebAction
38 'kids首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_KIDS_CHANNEL, 89 'kids首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_KIDS_CHANNEL,
39 'lifestyle首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_LIFESTYLE_CHANNEL, 90 'lifestyle首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_LIFESTYLE_CHANNEL,
40 ); 91 );
41 - $html = ''; 92 + $html = '<br/><h3>缓存页面</h3><br/>';
42 foreach ($channels as $key => $val) { 93 foreach ($channels as $key => $val) {
43 $url = '/tools/cacheclear?key='.urlencode(AuthCode::encode($val, 'yohobuy')); 94 $url = '/tools/cacheclear?key='.urlencode(AuthCode::encode($val, 'yohobuy'));
44 $html.= sprintf('<li><a href="%s" target="_blank">清除%s缓存</a></li>',$url, $key); 95 $html.= sprintf('<li><a href="%s" target="_blank">清除%s缓存</a></li>',$url, $key);
@@ -9,10 +9,10 @@ use LibModels\Web\Home\IndexData; @@ -9,10 +9,10 @@ use LibModels\Web\Home\IndexData;
9 use LibModels\Web\Product\SearchData; 9 use LibModels\Web\Product\SearchData;
10 use WebPlugin\DataProcess\Channel as ChannelProcess; 10 use WebPlugin\DataProcess\Channel as ChannelProcess;
11 11
12 -define('CODE_BOYS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '79372627eee75d73afe7f9bac91e5ce6' : 'c15bf0cbfbd4893fd70c869c991f6d3d');  
13 -define('CODE_GIRLS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '75215008957605c05e8cd375eac4f817' : 'a519ba44ef3a85cf3c05e405c6ba8e53');  
14 -define('CODE_KIDS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? 'd71f4b27f2a7229fbb31a4bc490a6f36' : 'a7741b94e8bb9d56d0d36e00c05956f7');  
15 -define('CODE_LIFESTYLE_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '8a341ca7eacc069ba80f02dec80eaf34' : '1b053fd044834f5c86d5eb15fb237af9'); 12 +// define('CODE_BOYS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '79372627eee75d73afe7f9bac91e5ce6' : 'c15bf0cbfbd4893fd70c869c991f6d3d');
  13 +// define('CODE_GIRLS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '75215008957605c05e8cd375eac4f817' : 'a519ba44ef3a85cf3c05e405c6ba8e53');
  14 +// define('CODE_KIDS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? 'd71f4b27f2a7229fbb31a4bc490a6f36' : 'a7741b94e8bb9d56d0d36e00c05956f7');
  15 +// define('CODE_LIFESTYLE_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '8a341ca7eacc069ba80f02dec80eaf34' : '1b053fd044834f5c86d5eb15fb237af9');
16 16
17 17
18 /** 18 /**
@@ -46,15 +46,15 @@ class HomeModel @@ -46,15 +46,15 @@ class HomeModel
46 //lifestyle:8a341ca7eacc069ba80f02dec80eaf34,1b053fd044834f5c86d5eb15fb237af9 46 //lifestyle:8a341ca7eacc069ba80f02dec80eaf34,1b053fd044834f5c86d5eb15fb237af9
47 47
48 // 男首首页 48 // 男首首页
49 - const CODE_BOYS_CHANNEL = '79372627eee75d73afe7f9bac91e5ce6'; 49 + const CODE_BOYS_CHANNEL = 'c15bf0cbfbd4893fd70c869c991f6d3d';
50 // 女首首页 50 // 女首首页
51 - const CODE_GIRLS_CHANNEL = '75215008957605c05e8cd375eac4f817'; 51 + const CODE_GIRLS_CHANNEL = 'a519ba44ef3a85cf3c05e405c6ba8e53';
52 52
53 // 潮童首页 53 // 潮童首页
54 - const CODE_KIDS_CHANNEL = 'd71f4b27f2a7229fbb31a4bc490a6f36'; 54 + const CODE_KIDS_CHANNEL = 'a7741b94e8bb9d56d0d36e00c05956f7';
55 55
56 // 创意生活新 56 // 创意生活新
57 - const CODE_LIFESTYLE_CHANNEL = '8a341ca7eacc069ba80f02dec80eaf34'; 57 + const CODE_LIFESTYLE_CHANNEL = '1b053fd044834f5c86d5eb15fb237af9';
58 58
59 // 创意生活 59 // 创意生活
60 const CODE_LIFESTYLE_CHANNEL_1 = '380c38155fd8beee10913a3f5b462da6'; 60 const CODE_LIFESTYLE_CHANNEL_1 = '380c38155fd8beee10913a3f5b462da6';