Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
15 changed files
with
296 additions
and
209 deletions
@@ -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 | ); |
@@ -23,17 +23,17 @@ class Yohobuy | @@ -23,17 +23,17 @@ class Yohobuy | ||
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 | 25 | ||
26 | - const API_URL = 'http://apih5.yoho.cn/'; | ||
27 | - const API_URL2 = 'http://apih5.yoho.cn/'; | ||
28 | - const SERVICE_URL = 'http://serviceh5.yoho.cn/'; | ||
29 | - const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
30 | - const API_OLD = 'http://api2.open.yohobuy.com/'; | 26 | +// const API_URL = 'http://apih5.yoho.cn/'; |
27 | +// const API_URL2 = 'http://apih5.yoho.cn/'; | ||
28 | +// const SERVICE_URL = 'http://serviceh5.yoho.cn/'; | ||
29 | +// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
30 | +// const API_OLD = 'http://api2.open.yohobuy.com/'; | ||
31 | 31 | ||
32 | /* 测试环境 */ | 32 | /* 测试环境 */ |
33 | -// const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/' | ||
34 | -// const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | ||
35 | -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
36 | -// const API_OLD = 'http://test2.open.yohobuy.com/'; | 33 | + const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/' |
34 | + const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | ||
35 | + const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
36 | + const API_OLD = 'http://test2.open.yohobuy.com/'; | ||
37 | 37 | ||
38 | /* 预览环境 */ | 38 | /* 预览环境 */ |
39 | // const API_URL = 'http://preapi.yoho.cn/'; | 39 | // const API_URL = 'http://preapi.yoho.cn/'; |
@@ -36,6 +36,7 @@ class SearchData extends \LibModels\Wap\Product\SearchData | @@ -36,6 +36,7 @@ class SearchData extends \LibModels\Wap\Product\SearchData | ||
36 | return 'http://101.200.31.165/yohosearch/shops.json'; | 36 | return 'http://101.200.31.165/yohosearch/shops.json'; |
37 | } | 37 | } |
38 | return 'http://101.200.31.165/yohosearch/search.json'; | 38 | return 'http://101.200.31.165/yohosearch/search.json'; |
39 | + | ||
39 | case 'preview': | 40 | case 'preview': |
40 | if ($type == 'sort') { | 41 | if ($type == 'sort') { |
41 | return 'http://101.200.31.165/yohosearch/sortgroup.json'; | 42 | return 'http://101.200.31.165/yohosearch/sortgroup.json'; |
@@ -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 | //特殊:新品、特价、限量 |
1 | - {{> layout/page-footer}} | ||
2 | - {{#if rlsEnv}} | ||
3 | - <script src="http://cdn.yoho.cn/yohobuy/{{version}}/lib.js"></script> | ||
4 | - <script src="http://cdn.yoho.cn/yohobuy/{{version}}/index.js"></script> | ||
5 | - {{/if}} | ||
6 | - {{#if preEnv}} | ||
7 | - <script src="http://cdn.yoho.cn/yohobuy/{{version}}/lib.js"></script> | ||
8 | - <script src="http://cdn.yoho.cn/yohobuy/{{version}}/index-debug.js"></script> | ||
9 | - {{/if}} | ||
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> | ||
13 | - {{/if}} | ||
14 | - {{#if devEnv}} | ||
15 | - <script src="http://localhost:8001/static/js/sea.js?nowrap"></script> | ||
16 | - <script> | ||
17 | - seajs.config({ | ||
18 | - base: 'http://localhost:8001/' | ||
19 | - }); | ||
20 | - </script> | ||
21 | - {{/if}} | ||
22 | - {{> layout/use}} | ||
23 | - {{> layout/analysis}} | ||
24 | - </body> | ||
25 | -</html> | 1 | + {{> layout/page-footer}} |
2 | + {{#if rlsEnv}} | ||
3 | + <script src="http://cdn.yoho.cn/yohobuy/{{version}}/lib.js"></script> | ||
4 | + <script src="http://cdn.yoho.cn/yohobuy/{{version}}/index.js"></script> | ||
5 | + {{/if}} | ||
6 | + {{#if preEnv}} | ||
7 | + <script src="http://cdn.yoho.cn/yohobuy/{{version}}/lib.js"></script> | ||
8 | + <script src="http://cdn.yoho.cn/yohobuy/{{version}}/index-debug.js"></script> | ||
9 | + {{/if}} | ||
10 | + {{#if testEnv}} | ||
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}} | ||
14 | + {{#if devEnv}} | ||
15 | + <script src="http://localhost:8001/static/js/sea.js?nowrap"></script> | ||
16 | + <script> | ||
17 | + seajs.config({ | ||
18 | + base: 'http://localhost:8001/' | ||
19 | + }); | ||
20 | + </script> | ||
21 | + {{/if}} | ||
22 | + {{> layout/use}} | ||
23 | + {{> layout/analysis}} | ||
24 | + </body> | ||
25 | +</html> |
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | -<head> | ||
4 | - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
5 | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
6 | - <meta http-equiv="Cache-Control" content="no-siteapp" /> | ||
7 | - <meta name="renderer" content="webkit"> | ||
8 | - <meta name="keywords" content="{{keywords}}"> | ||
9 | - <meta name="description" content="{{description}}"> | ||
10 | - <title>{{title}}</title> | ||
11 | - <link rel="dns-prefetch" href="//cdn.yoho.cn"> | ||
12 | - <link rel="dns-prefetch" href="//static.yohobuy.com"> | ||
13 | - <link rel="dns-prefetch" href="//img10.static.yhbimg.com"> | ||
14 | - <link rel="dns-prefetch" href="//img11.static.yhbimg.com"> | ||
15 | - <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> | ||
16 | - <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> | ||
17 | -{{#if rlsEnv}} | ||
18 | - <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css"> | ||
19 | -{{/if}} | ||
20 | -{{#if preEnv}} | ||
21 | - <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css"> | ||
22 | -{{/if}} | ||
23 | -{{#if testEnv}} | ||
24 | - <link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/index.css"> | ||
25 | -{{/if}} | ||
26 | -{{#if devEnv}} | ||
27 | - <link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css"> | ||
28 | -{{/if}} | ||
29 | -</head> | ||
30 | -<body> | ||
31 | - {{> layout/page-header}} | 1 | +<!DOCTYPE html> |
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
5 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
6 | + <meta http-equiv="Cache-Control" content="no-siteapp" /> | ||
7 | + <meta name="renderer" content="webkit"> | ||
8 | + <meta name="keywords" content="{{keywords}}"> | ||
9 | + <meta name="description" content="{{description}}"> | ||
10 | + <title>{{title}}</title> | ||
11 | + <link rel="dns-prefetch" href="//cdn.yoho.cn"> | ||
12 | + <link rel="dns-prefetch" href="//static.yohobuy.com"> | ||
13 | + <link rel="dns-prefetch" href="//img10.static.yhbimg.com"> | ||
14 | + <link rel="dns-prefetch" href="//img11.static.yhbimg.com"> | ||
15 | + <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> | ||
16 | + <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> | ||
17 | +{{#if rlsEnv}} | ||
18 | + <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css"> | ||
19 | +{{/if}} | ||
20 | +{{#if preEnv}} | ||
21 | + <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css"> | ||
22 | +{{/if}} | ||
23 | +{{#if testEnv}} | ||
24 | + <link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css"> | ||
25 | +{{/if}} | ||
26 | +{{#if devEnv}} | ||
27 | + <link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css"> | ||
28 | +{{/if}} | ||
29 | +</head> | ||
30 | +<body> | ||
31 | + {{> layout/page-header}} | ||
32 | {{> layout/simple-header}} | 32 | {{> layout/simple-header}} |
@@ -14,7 +14,7 @@ fonts_dir = "font" | @@ -14,7 +14,7 @@ fonts_dir = "font" | ||
14 | output_style = :expanded | 14 | output_style = :expanded |
15 | # To enable relative paths to assets via compass helper functions. Uncomment: | 15 | # To enable relative paths to assets via compass helper functions. Uncomment: |
16 | relative_assets = true | 16 | relative_assets = true |
17 | -# sourcemap = true | 17 | +sourcemap = true |
18 | 18 | ||
19 | # To disable debugging comments that display the original location of your selectors. Uncomment: | 19 | # To disable debugging comments that display the original location of your selectors. Uncomment: |
20 | line_comments = false | 20 | line_comments = false |
@@ -72,10 +72,10 @@ gulp.task('spm-doc', function() { | @@ -72,10 +72,10 @@ gulp.task('spm-doc', function() { | ||
72 | }); | 72 | }); |
73 | 73 | ||
74 | //生成发布目录,可用于上传测试机 | 74 | //生成发布目录,可用于上传测试机 |
75 | -gulp.task('ge', ['assets', 'compass-production', 'build']); | 75 | +gulp.task('ge', ['assets', 'compass-production', 'build', 'script']); |
76 | 76 | ||
77 | //发布 | 77 | //发布 |
78 | -gulp.task('dist', ['assets', 'compass-production', 'build'], function() { | 78 | +gulp.task('dist', ['assets', 'compass-production', 'build', 'script'], function() { |
79 | var ftpstream = ftp(ftpConfig); | 79 | var ftpstream = ftp(ftpConfig); |
80 | 80 | ||
81 | return gulp.src('dist/**/') | 81 | return gulp.src('dist/**/') |
@@ -101,7 +101,8 @@ gulp.task('compass-production', ['assets'], function() { | @@ -101,7 +101,8 @@ gulp.task('compass-production', ['assets'], function() { | ||
101 | image: distDir.img, | 101 | image: distDir.img, |
102 | font: distDir.font, | 102 | font: distDir.font, |
103 | http_path: '/', | 103 | http_path: '/', |
104 | - style: 'compressed' | 104 | + style: 'compressed', |
105 | + sourcemap: false | ||
105 | }) | 106 | }) |
106 | ) | 107 | ) |
107 | .on('error', function(error) { | 108 | .on('error', function(error) { |
@@ -193,7 +194,7 @@ gulp.task('business', ['libs'], function() { | @@ -193,7 +194,7 @@ gulp.task('business', ['libs'], function() { | ||
193 | }); | 194 | }); |
194 | 195 | ||
195 | //页面需要直接标签引用的JS | 196 | //页面需要直接标签引用的JS |
196 | -// gulp.task('script', function() { | ||
197 | -// gulp.src('plugin/page/**/*') | ||
198 | -// .pipe(gulp.dest(rootDist)); | ||
199 | -// }); | 197 | +gulp.task('script', function() { |
198 | + gulp.src('plugin/page/**/*') | ||
199 | + .pipe(gulp.dest(rootDist)); | ||
200 | +}); |
1 | -<?php | ||
2 | -use Action\WebAction; | ||
3 | -use WebPlugin\Cache; | ||
4 | -use Configs\WebCacheConfig; | ||
5 | -use WebPlugin\AuthCode; | ||
6 | -use Index\HomeModel; | ||
7 | -class ToolsController extends WebAction | ||
8 | -{ | ||
9 | - public function init() | ||
10 | - { | ||
11 | - $valid_passwords = array ('test' => '123456'); | ||
12 | - $valid_users = array_keys($valid_passwords); | ||
13 | - $user = $pass = ''; | ||
14 | - if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_USER'])) | ||
15 | - { | ||
16 | - $user = $_SERVER['PHP_AUTH_USER']; | ||
17 | - $pass = $_SERVER['PHP_AUTH_PW']; | ||
18 | - } | ||
19 | - $validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]); | ||
20 | - if (!$validated) { | ||
21 | - header('WWW-Authenticate: Basic realm="www.yohobuy.com"'); | ||
22 | - header('HTTP/1.0 401 Unauthorized'); | ||
23 | - die ("Not authorized"); | ||
24 | - } | ||
25 | - } | ||
26 | - | ||
27 | - /** | ||
28 | - * 缓存html | ||
29 | - * | ||
30 | - */ | ||
31 | - public function cacheAction() | ||
32 | - { | ||
33 | - //频道=>key | ||
34 | - $channels = array( | ||
35 | - '导航' => WebCacheConfig::KEY_WEB_HOME_NAVBAR_DATA, | ||
36 | - '男生首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_BOYS_CHANNEL, | ||
37 | - '女生首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_GIRLS_CHANNEL, | ||
38 | - 'kids首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_KIDS_CHANNEL, | ||
39 | - 'lifestyle首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_LIFESTYLE_CHANNEL, | ||
40 | - ); | ||
41 | - $html = ''; | ||
42 | - foreach ($channels as $key => $val) { | ||
43 | - $url = '/tools/cacheclear?key='.urlencode(AuthCode::encode($val, 'yohobuy')); | ||
44 | - $html.= sprintf('<li><a href="%s" target="_blank">清除%s缓存</a></li>',$url, $key); | ||
45 | - } | ||
46 | - echo $html; | ||
47 | - } | ||
48 | - | ||
49 | - /** | ||
50 | - * 清除缓存 | ||
51 | - * | ||
52 | - * @return json | ||
53 | - */ | ||
54 | - public function cacheclearAction() | ||
55 | - { | ||
56 | - $key = $this->get('key'); | ||
57 | - if(!empty($key)) { | ||
58 | - $key = AuthCode::decode($key, 'yohobuy'); | ||
59 | - if(!empty($key)) { | ||
60 | - //导航清除 | ||
61 | - if($key == WebCacheConfig::KEY_WEB_HOME_NAVBAR_DATA) { | ||
62 | - $list = array(HomeModel::COOKIE_NAME_BOYS, HomeModel::COOKIE_NAME_GIRLS, HomeModel::COOKIE_NAME_KIDS, HomeModel::COOKIE_NAME_LIFESTYLE); | ||
63 | - foreach ($list as $val) { | ||
64 | - Cache::delete($key.'_'.$val); | ||
65 | - } | ||
66 | - } else { | ||
67 | - Cache::delete($key); | ||
68 | - } | ||
69 | - echo '清除成功'; | ||
70 | - } | ||
71 | - } | ||
72 | - } | ||
73 | - | ||
74 | - public function logAction() | ||
75 | - { | ||
76 | - print_r($_SERVER); | ||
77 | - } | ||
78 | -} | ||
79 | - | 1 | +<?php |
2 | +use Action\WebAction; | ||
3 | +use WebPlugin\Cache; | ||
4 | +use Configs\WebCacheConfig; | ||
5 | +use WebPlugin\AuthCode; | ||
6 | +use Index\HomeModel; | ||
7 | +use Api\Yohobuy; | ||
8 | +use Api\Sign; | ||
9 | +use LibModels\Web\Home\IndexData; | ||
10 | +class ToolsController extends WebAction | ||
11 | +{ | ||
12 | + public function init() | ||
13 | + { | ||
14 | + if(APPLICATION_ENV == 'production') { | ||
15 | + $valid_passwords = array ('yoho' => '9646abcdef'); | ||
16 | + } else { | ||
17 | + $valid_passwords = array ('test' => '123456'); | ||
18 | + } | ||
19 | + | ||
20 | + $valid_users = array_keys($valid_passwords); | ||
21 | + $user = $pass = ''; | ||
22 | + if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_USER'])) | ||
23 | + { | ||
24 | + $user = $_SERVER['PHP_AUTH_USER']; | ||
25 | + $pass = $_SERVER['PHP_AUTH_PW']; | ||
26 | + } | ||
27 | + $validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]); | ||
28 | + if (!$validated) { | ||
29 | + header('WWW-Authenticate: Basic realm="www.yohobuy.com"'); | ||
30 | + header('HTTP/1.0 401 Unauthorized'); | ||
31 | + die ("Not authorized"); | ||
32 | + } | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
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测试 | ||
50 | + * | ||
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 | + */ | ||
82 | + public function cacheAction() | ||
83 | + { | ||
84 | + //频道=>key | ||
85 | + $channels = array( | ||
86 | + '导航' => WebCacheConfig::KEY_WEB_HOME_NAVBAR_DATA, | ||
87 | + '男生首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_BOYS_CHANNEL, | ||
88 | + '女生首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_GIRLS_CHANNEL, | ||
89 | + 'kids首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_KIDS_CHANNEL, | ||
90 | + 'lifestyle首页'=> WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.HomeModel::CODE_LIFESTYLE_CHANNEL, | ||
91 | + ); | ||
92 | + $html = '<br/><h3>缓存页面</h3><br/>'; | ||
93 | + foreach ($channels as $key => $val) { | ||
94 | + $url = '/tools/cacheclear?key='.urlencode(AuthCode::encode($val, 'yohobuy')); | ||
95 | + $html.= sprintf('<li><a href="%s" target="_blank">清除%s缓存</a></li>',$url, $key); | ||
96 | + } | ||
97 | + echo $html; | ||
98 | + } | ||
99 | + | ||
100 | + /** | ||
101 | + * 清除缓存 | ||
102 | + * | ||
103 | + * @return json | ||
104 | + */ | ||
105 | + public function cacheclearAction() | ||
106 | + { | ||
107 | + $key = $this->get('key'); | ||
108 | + if(!empty($key)) { | ||
109 | + $key = AuthCode::decode($key, 'yohobuy'); | ||
110 | + if(!empty($key)) { | ||
111 | + //导航清除 | ||
112 | + if($key == WebCacheConfig::KEY_WEB_HOME_NAVBAR_DATA) { | ||
113 | + $list = array(HomeModel::COOKIE_NAME_BOYS, HomeModel::COOKIE_NAME_GIRLS, HomeModel::COOKIE_NAME_KIDS, HomeModel::COOKIE_NAME_LIFESTYLE); | ||
114 | + foreach ($list as $val) { | ||
115 | + Cache::delete($key.'_'.$val); | ||
116 | + } | ||
117 | + } else { | ||
118 | + Cache::delete($key); | ||
119 | + } | ||
120 | + echo '清除成功'; | ||
121 | + } | ||
122 | + } | ||
123 | + } | ||
124 | + | ||
125 | + public function logAction() | ||
126 | + { | ||
127 | + print_r($_SERVER); | ||
128 | + } | ||
129 | +} | ||
130 | + | ||
80 | ?> | 131 | ?> |
@@ -8,11 +8,12 @@ use WebPlugin\Cache; | @@ -8,11 +8,12 @@ use WebPlugin\Cache; | ||
8 | use LibModels\Web\Home\IndexData; | 8 | 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 | - | ||
12 | -//define('CODE_BOYS_CHANNEL_TMP', (APPLICATION_ENV == 'release' || APPLICATION_ENV == 'preview') ? '79372627eee75d73afe7f9bac91e5ce6' : 'c15bf0cbfbd4893fd70c869c991f6d3d'); | ||
13 | -//define('CODE_GIRLS_CHANNEL_TMP', (APPLICATION_ENV == 'release' || APPLICATION_ENV == 'preview') ? '75215008957605c05e8cd375eac4f817' : 'a519ba44ef3a85cf3c05e405c6ba8e53'); | ||
14 | -//define('CODE_KIDS_CHANNEL_TMP', (APPLICATION_ENV == 'release' || APPLICATION_ENV == 'preview') ? 'd71f4b27f2a7229fbb31a4bc490a6f36' : 'a7741b94e8bb9d56d0d36e00c05956f7'); | ||
15 | -//define('CODE_LIFESTYLE_CHANNEL_TMP', (APPLICATION_ENV == 'release' || APPLICATION_ENV == 'preview') ? '8a341ca7eacc069ba80f02dec80eaf34' : '1b053fd044834f5c86d5eb15fb237af9'); | 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'); | ||
16 | + | ||
16 | 17 | ||
17 | /** | 18 | /** |
18 | * web首页模板数据模型 | 19 | * web首页模板数据模型 |
@@ -38,22 +39,22 @@ class HomeModel | @@ -38,22 +39,22 @@ class HomeModel | ||
38 | /* COOKIE标识访问的是创意生活频道 */ | 39 | /* COOKIE标识访问的是创意生活频道 */ |
39 | const COOKIE_NAME_LIFESTYLE = 'lifestyle'; | 40 | const COOKIE_NAME_LIFESTYLE = 'lifestyle'; |
40 | 41 | ||
41 | - //release: test: | 42 | + //production: test: |
42 | //boys:79372627eee75d73afe7f9bac91e5ce6, c15bf0cbfbd4893fd70c869c991f6d3d | 43 | //boys:79372627eee75d73afe7f9bac91e5ce6, c15bf0cbfbd4893fd70c869c991f6d3d |
43 | //girls: 75215008957605c05e8cd375eac4f817, a519ba44ef3a85cf3c05e405c6ba8e53 | 44 | //girls: 75215008957605c05e8cd375eac4f817, a519ba44ef3a85cf3c05e405c6ba8e53 |
44 | //kids:d71f4b27f2a7229fbb31a4bc490a6f36,a7741b94e8bb9d56d0d36e00c05956f7 | 45 | //kids:d71f4b27f2a7229fbb31a4bc490a6f36,a7741b94e8bb9d56d0d36e00c05956f7 |
45 | //lifestyle:8a341ca7eacc069ba80f02dec80eaf34,1b053fd044834f5c86d5eb15fb237af9 | 46 | //lifestyle:8a341ca7eacc069ba80f02dec80eaf34,1b053fd044834f5c86d5eb15fb237af9 |
46 | 47 | ||
47 | // 男首首页 | 48 | // 男首首页 |
48 | - const CODE_BOYS_CHANNEL = '79372627eee75d73afe7f9bac91e5ce6'; | 49 | + const CODE_BOYS_CHANNEL = 'c15bf0cbfbd4893fd70c869c991f6d3d'; |
49 | // 女首首页 | 50 | // 女首首页 |
50 | - const CODE_GIRLS_CHANNEL = '75215008957605c05e8cd375eac4f817'; | 51 | + const CODE_GIRLS_CHANNEL = 'a519ba44ef3a85cf3c05e405c6ba8e53'; |
51 | 52 | ||
52 | // 潮童首页 | 53 | // 潮童首页 |
53 | - const CODE_KIDS_CHANNEL = 'd71f4b27f2a7229fbb31a4bc490a6f36'; | 54 | + const CODE_KIDS_CHANNEL = 'a7741b94e8bb9d56d0d36e00c05956f7'; |
54 | 55 | ||
55 | // 创意生活新 | 56 | // 创意生活新 |
56 | - const CODE_LIFESTYLE_CHANNEL = '8a341ca7eacc069ba80f02dec80eaf34'; | 57 | + const CODE_LIFESTYLE_CHANNEL = '1b053fd044834f5c86d5eb15fb237af9'; |
57 | 58 | ||
58 | // 创意生活 | 59 | // 创意生活 |
59 | const CODE_LIFESTYLE_CHANNEL_1 = '380c38155fd8beee10913a3f5b462da6'; | 60 | const CODE_LIFESTYLE_CHANNEL_1 = '380c38155fd8beee10913a3f5b462da6'; |
@@ -137,20 +137,26 @@ class PassportModel | @@ -137,20 +137,26 @@ class PassportModel | ||
137 | 137 | ||
138 | /* | 138 | /* |
139 | * 重写递增计数 cache方法 | 139 | * 重写递增计数 cache方法 |
140 | - * $key cache-key | 140 | + * $key cache-key,递增存放变量 |
141 | * $offset 递增偏移量 | 141 | * $offset 递增偏移量 |
142 | * $initValue 初始化值 | 142 | * $initValue 初始化值 |
143 | * $expiry 缓存时间 | 143 | * $expiry 缓存时间 |
144 | */ | 144 | */ |
145 | - public static function increment($key, $offset = 1, $initValue = 0, $expire = 1800) | 145 | + |
146 | + public static function increment($key, $timeKey, $offset = 1, $initValue = 0, $expire = 1800) | ||
146 | { | 147 | { |
147 | - //初始化key | ||
148 | - if (!Cache::get($key)) { | ||
149 | - Cache::set($key, $initValue, $expire); | 148 | + //有效期之外清除key |
149 | + if (!Cache::get($timeKey) && Cache::get($key)) { | ||
150 | + Cache::delete($key); | ||
151 | + } | ||
152 | + //初始化计时 | ||
153 | + if (!Cache::get($timeKey) && !Cache::get($key)) { | ||
154 | + Cache::set($timeKey, TRUE, $expire); | ||
155 | + Cache::set($key, $initValue); | ||
150 | } | 156 | } |
151 | - //增加偏移量 | ||
152 | - $cacheValue = intval(Cache::get($key))+$offset; | ||
153 | - Cache::set($key, $cacheValue, $expire); | 157 | + //未过期则递增 |
158 | + $cacheValue = intval(Cache::get($key)) + $offset; | ||
159 | + Cache::set($key, $cacheValue); | ||
154 | } | 160 | } |
155 | 161 | ||
156 | } | 162 | } |
@@ -113,7 +113,7 @@ class AutouserinfoController extends WebAction | @@ -113,7 +113,7 @@ class AutouserinfoController extends WebAction | ||
113 | } | 113 | } |
114 | //未注册 未绑定 | 114 | //未注册 未绑定 |
115 | if ($res['code'] == 200) { | 115 | if ($res['code'] == 200) { |
116 | - $next = Helpers::url('/thirdlogin/index', array( | 116 | + $next = Helpers::url('/thirdlogin/noregist', array( |
117 | 'openId' => $openId, | 117 | 'openId' => $openId, |
118 | 'sourceType' => $sourceType, | 118 | 'sourceType' => $sourceType, |
119 | 'area' => $area, | 119 | 'area' => $area, |
@@ -135,6 +135,9 @@ class AutouserinfoController extends WebAction | @@ -135,6 +135,9 @@ class AutouserinfoController extends WebAction | ||
135 | $this->echoJson($data); | 135 | $this->echoJson($data); |
136 | } | 136 | } |
137 | 137 | ||
138 | + /* | ||
139 | + * 根据手机号获取用户相关信息 | ||
140 | + */ | ||
138 | public static function getUserInfo($area, $mobile) | 141 | public static function getUserInfo($area, $mobile) |
139 | { | 142 | { |
140 | $userInfo = UserData::getUserInfoByMobile($area, $mobile); | 143 | $userInfo = UserData::getUserInfoByMobile($area, $mobile); |
@@ -162,16 +165,16 @@ class AutouserinfoController extends WebAction | @@ -162,16 +165,16 @@ class AutouserinfoController extends WebAction | ||
162 | break; | 165 | break; |
163 | } | 166 | } |
164 | 167 | ||
165 | - $phoneNum = trim($this->post('mobile')); | ||
166 | - $areaCode = trim($this->post('area')); | 168 | + $mobile = trim($this->post('mobile')); |
169 | + $area = trim($this->post('area')); | ||
167 | //校验手机号格式 | 170 | //校验手机号格式 |
168 | - if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 171 | + if (!is_numeric($mobile) || !is_numeric($area)) { |
169 | $data['code'] = 400; | 172 | $data['code'] = 400; |
170 | $data['message'] = '手机号码格式不正确'; | 173 | $data['message'] = '手机号码格式不正确'; |
171 | break; | 174 | break; |
172 | } | 175 | } |
173 | 176 | ||
174 | - $data = BindData::sendBindMsg($areaCode, $phoneNum); | 177 | + $data = BindData::sendBindMsg($area, $mobile); |
175 | if (!isset($data['code'])) { | 178 | if (!isset($data['code'])) { |
176 | break; | 179 | break; |
177 | } | 180 | } |
@@ -194,17 +197,17 @@ class AutouserinfoController extends WebAction | @@ -194,17 +197,17 @@ class AutouserinfoController extends WebAction | ||
194 | break; | 197 | break; |
195 | } | 198 | } |
196 | 199 | ||
197 | - $phoneNum = trim($this->post('mobile')); | ||
198 | - $areaCode = trim($this->post('area')); | 200 | + $mobile = trim($this->post('mobile')); |
201 | + $area= trim($this->post('area')); | ||
199 | $code = trim($this->post('code')); //短信验证码 | 202 | $code = trim($this->post('code')); //短信验证码 |
200 | //校验手机号格式 | 203 | //校验手机号格式 |
201 | - if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 204 | + if (!is_numeric($mobile) || !is_numeric($area)) { |
202 | $data['code'] = 400; | 205 | $data['code'] = 400; |
203 | $data['message'] = '手机号码格式不正确'; | 206 | $data['message'] = '手机号码格式不正确'; |
204 | break; | 207 | break; |
205 | } | 208 | } |
206 | 209 | ||
207 | - $data = BindData::checkBindCode($areaCode, $phoneNum, $code); | 210 | + $data = BindData::checkBindCode($area, $mobile, $code); |
208 | if (!isset($data['code'])) { | 211 | if (!isset($data['code'])) { |
209 | break; | 212 | break; |
210 | } | 213 | } |
@@ -227,8 +230,8 @@ class AutouserinfoController extends WebAction | @@ -227,8 +230,8 @@ class AutouserinfoController extends WebAction | ||
227 | break; | 230 | break; |
228 | } | 231 | } |
229 | 232 | ||
230 | - $phoneNum = trim($this->post('mobile')); | ||
231 | - $areaCode = trim($this->post('area', '86')); | 233 | + $mobile = trim($this->post('mobile')); |
234 | + $area = trim($this->post('area', '86')); | ||
232 | $openId = trim($this->post('openId')); | 235 | $openId = trim($this->post('openId')); |
233 | $sourceType = trim($this->post('sourceType')); | 236 | $sourceType = trim($this->post('sourceType')); |
234 | $code = trim($this->post('code')); //短信验证码 | 237 | $code = trim($this->post('code')); //短信验证码 |
@@ -236,20 +239,20 @@ class AutouserinfoController extends WebAction | @@ -236,20 +239,20 @@ class AutouserinfoController extends WebAction | ||
236 | $password = empty($password) ? '' : $password; | 239 | $password = empty($password) ? '' : $password; |
237 | 240 | ||
238 | //校验手机号格式 | 241 | //校验手机号格式 |
239 | - if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 242 | + if (!is_numeric($mobile) || !is_numeric($area)) { |
240 | $data['code'] = 400; | 243 | $data['code'] = 400; |
241 | $data['message'] = '手机号码格式不正确'; | 244 | $data['message'] = '手机号码格式不正确'; |
242 | break; | 245 | break; |
243 | } | 246 | } |
244 | //校验手机验证码 | 247 | //校验手机验证码 |
245 | - $bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code); | 248 | + $bindMsgFlag = BindData::checkBindCode($area, $mobile, $code); |
246 | if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) { | 249 | if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) { |
247 | $data['code'] = 400; | 250 | $data['code'] = 400; |
248 | $data['message'] = '短信验证码不正确'; | 251 | $data['message'] = '短信验证码不正确'; |
249 | break; | 252 | break; |
250 | } | 253 | } |
251 | //绑定手机号 | 254 | //绑定手机号 |
252 | - $res = BindData::bindMobile($openId, $sourceType, $phoneNum, $areaCode, $password); | 255 | + $res = BindData::bindMobile($openId, $sourceType, $mobile, $area, $password); |
253 | if (!isset($res['code'])) { | 256 | if (!isset($res['code'])) { |
254 | break; | 257 | break; |
255 | } | 258 | } |
@@ -28,7 +28,7 @@ class LoginController extends WebAction | @@ -28,7 +28,7 @@ class LoginController extends WebAction | ||
28 | if (!strstr($refer, 'http')) { | 28 | if (!strstr($refer, 'http')) { |
29 | $refer = SITE_MAIN . $refer; | 29 | $refer = SITE_MAIN . $refer; |
30 | } | 30 | } |
31 | - | 31 | + |
32 | if (!empty($refer)) { | 32 | if (!empty($refer)) { |
33 | $this->setCookie('refer', $refer); | 33 | $this->setCookie('refer', $refer); |
34 | } | 34 | } |
@@ -70,7 +70,7 @@ class LoginController extends WebAction | @@ -70,7 +70,7 @@ class LoginController extends WebAction | ||
70 | */ | 70 | */ |
71 | public function authAction() | 71 | public function authAction() |
72 | { | 72 | { |
73 | - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => ''); | 73 | + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="' . Helpers::url('/passport/back/index') . '" target="_blank">忘记密码?</a>', 'data' => ''); |
74 | do { | 74 | do { |
75 | /* 判断是不是AJAX请求 */ | 75 | /* 判断是不是AJAX请求 */ |
76 | if (!$this->isAjax()) { | 76 | if (!$this->isAjax()) { |
@@ -108,26 +108,43 @@ class LoginController extends WebAction | @@ -108,26 +108,43 @@ class LoginController extends WebAction | ||
108 | */ | 108 | */ |
109 | $ip = Helpers::getClientIp(); | 109 | $ip = Helpers::getClientIp(); |
110 | $ipKey = md5('ip_signin_' . $ip); | 110 | $ipKey = md5('ip_signin_' . $ip); |
111 | + $ipTimeKey = md5('ip_signin_time' . $ip); | ||
111 | $accountKey = md5('account_signin_' . $account); | 112 | $accountKey = md5('account_signin_' . $account); |
112 | - PassportModel::increment($ipKey, 1, 0, 3600); | 113 | + $accountTimeKey = md5('account_signin_time' . $account); |
114 | + //cache初始化,非有效时间内清除次数,有效时间内叠加cache计数 | ||
115 | + if (!Cache::get($accountTimeKey) && Cache::get($accountKey)) { | ||
116 | + Cache::delete($accountKey); | ||
117 | + } | ||
118 | + if (!Cache::get($accountTimeKey) && !Cache::get($accountKey)) { | ||
119 | + Cache::set($accountTimeKey, true, 1800); | ||
120 | + Cache::set($accountKey, 0); | ||
121 | + } | ||
122 | + if (!Cache::get($ipTimeKey) && Cache::get($ipKey)) { | ||
123 | + Cache::delete($ipKey); | ||
124 | + } | ||
125 | + if (!Cache::get($ipTimeKey) && !Cache::get($ipKey)) { | ||
126 | + Cache::set($ipTimeKey, true, 3600); | ||
127 | + Cache::set($ipKey, 0); | ||
128 | + } | ||
113 | $accountTimes = Cache::get($accountKey); | 129 | $accountTimes = Cache::get($accountKey); |
114 | - if ($accountTimes > 10) { | 130 | + $ipTimes = Cache::get($ipKey); |
131 | + if ($accountTimes >= 10) { | ||
115 | $data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => ''); | 132 | $data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => ''); |
116 | break; | 133 | break; |
117 | } | 134 | } |
118 | - | ||
119 | - $ipTimes = Cache::get($ipKey); | ||
120 | - if ($ipTimes > 100) { | 135 | + if ($ipTimes >= 100) { |
121 | $data = array('code' => 400, 'message' => '您尝试的次数过多,账号已被暂时锁定,请稍后再试', 'data' => ''); | 136 | $data = array('code' => 400, 'message' => '您尝试的次数过多,账号已被暂时锁定,请稍后再试', 'data' => ''); |
122 | break; | 137 | break; |
123 | } | 138 | } |
124 | $data = LoginData::signin($area, $account, $password, $shoppingKey); | 139 | $data = LoginData::signin($area, $account, $password, $shoppingKey); |
125 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { | 140 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { |
126 | - PassportModel::increment($accountKey, 1, 0, 1800); | ||
127 | - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => ''); | 141 | + Cache::set($accountKey, intval(Cache::get($accountKey)) + 1); |
142 | + Cache::set($ipKey, intval(Cache::get($ipKey)) + 1); | ||
143 | + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="' . Helpers::url('/passport/back/index') . '" target="_blank">忘记密码?</a>', 'data' => ''); | ||
128 | break; | 144 | break; |
129 | } | 145 | } |
130 | 146 | ||
147 | + //登录成功 | ||
131 | $refer = $this->getCookie('refer'); | 148 | $refer = $this->getCookie('refer'); |
132 | if (empty($refer) || strstr($refer, 'signin.html') || strstr($refer, 'passport/login/index')) { | 149 | if (empty($refer) || strstr($refer, 'signin.html') || strstr($refer, 'passport/login/index')) { |
133 | $refer = SITE_MAIN; | 150 | $refer = SITE_MAIN; |
@@ -48,7 +48,8 @@ class RegisterController extends WebAction | @@ -48,7 +48,8 @@ class RegisterController extends WebAction | ||
48 | $ip = Helpers::getClientIp(); | 48 | $ip = Helpers::getClientIp(); |
49 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 49 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
50 | $ipKey = md5('ip_checkmobile_' . $ip); | 50 | $ipKey = md5('ip_checkmobile_' . $ip); |
51 | - PassportModel::increment($ipKey, 1, 0, 3600); | 51 | + $ipTimeKey = md5('ip_checkmobile_time_' . $ip); |
52 | + PassportModel::increment($ipKey,$ipTimeKey,1, 0, 3600); | ||
52 | $ipTimes = Cache::get($ipKey); | 53 | $ipTimes = Cache::get($ipKey); |
53 | do{ | 54 | do{ |
54 | /* 判断是不是AJAX请求 */ | 55 | /* 判断是不是AJAX请求 */ |
@@ -60,7 +61,7 @@ class RegisterController extends WebAction | @@ -60,7 +61,7 @@ class RegisterController extends WebAction | ||
60 | $data['message'] = '手机号码格式不正确'; | 61 | $data['message'] = '手机号码格式不正确'; |
61 | break; | 62 | break; |
62 | } | 63 | } |
63 | - if ($ipTimes >= 500) { | 64 | + if ($ipTimes > 500) { |
64 | $data['message'] = '由于你IP受限无法注册'; | 65 | $data['message'] = '由于你IP受限无法注册'; |
65 | break; | 66 | break; |
66 | } | 67 | } |
@@ -130,7 +131,8 @@ class RegisterController extends WebAction | @@ -130,7 +131,8 @@ class RegisterController extends WebAction | ||
130 | } | 131 | } |
131 | //发送代码 | 132 | //发送代码 |
132 | $sendCodeKey = md5('send_code_' . $area . '_' . $mobile); | 133 | $sendCodeKey = md5('send_code_' . $area . '_' . $mobile); |
133 | - PassportModel::increment($sendCodeKey, 1, 0, 3600); | 134 | + $sendCodeTimeKey = md5('send_code_time_' . $area . '_' . $mobile); |
135 | + PassportModel::increment($sendCodeKey,$sendCodeTimeKey, 1, 0, 3600); | ||
134 | $sendCodeTimes = Cache::get($sendCodeKey); | 136 | $sendCodeTimes = Cache::get($sendCodeKey); |
135 | if ($sendCodeTimes > 50) { | 137 | if ($sendCodeTimes > 50) { |
136 | $data['message'] = '发送验证码太多'; | 138 | $data['message'] = '发送验证码太多'; |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | use Action\WebAction; | 3 | use Action\WebAction; |
4 | use Passport\PassportModel; | 4 | use Passport\PassportModel; |
5 | use LibModels\Wap\Passport\RegData; | 5 | use LibModels\Wap\Passport\RegData; |
6 | +use WebPlugin\Helpers; | ||
6 | 7 | ||
7 | class ThirdloginController extends WebAction | 8 | class ThirdloginController extends WebAction |
8 | { | 9 | { |
@@ -24,8 +25,8 @@ class ThirdloginController extends WebAction | @@ -24,8 +25,8 @@ class ThirdloginController extends WebAction | ||
24 | 'simpleHeader' => $simpleHeader, | 25 | 'simpleHeader' => $simpleHeader, |
25 | 'openId' => $openId, | 26 | 'openId' => $openId, |
26 | 'sourceType' => $sourceType, | 27 | 'sourceType' => $sourceType, |
27 | - 'region' => RegData::getAreasData(), | ||
28 | - 'serviceUrl' => Helpers::url('/help', array('category_id' => 9)) | 28 | + 'region' => RegData::getAreasData(),//区域 |
29 | + 'serviceUrl' => Helpers::url('/help', array('category_id' => 9))//服务条款 | ||
29 | ); | 30 | ); |
30 | 31 | ||
31 | $this->_view->display('index', $data); | 32 | $this->_view->display('index', $data); |
-
Please register or login to post a comment