Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
783db6924a05cbb54646afd5d895f1f3fea41b4d
2 parents
5c77ce28
2b80643f
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
52 deletions
library/Action/AbstractAction.php
library/Plugin/Partner/renren/Call.php
web-static/js/passport/reg.js
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Autouserinfo.php
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Register.php
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Sale.php
library/Action/AbstractAction.php
View file @
783db69
...
...
@@ -68,7 +68,7 @@ class AbstractAction extends Controller_Abstract
case
'develop'
:
// 开发
default
:
$this
->
_view
->
assign
(
'devEnv'
,
true
);
$this
->
_useSession
=
tru
e
;
$this
->
_useSession
=
fals
e
;
break
;
}
}
...
...
library/Plugin/Partner/renren/Call.php
View file @
783db69
...
...
@@ -55,7 +55,7 @@ class Call extends Factory
try
{
$token
=
$this
->
renn
->
getTokenFromTokenEndpoint
(
'code'
,
$keys
,
TokenType
::
Bearer
);
$token
=
$this
->
renn
->
getTokenFromTokenEndpoint
(
'code'
,
$keys
,
\
TokenType
::
Bearer
);
// 返回数组格式的信息
$token
=
$this
->
renn
->
getTokens
();
...
...
@@ -84,7 +84,7 @@ class Call extends Factory
{
if
(
is_array
(
$token
))
{
$token
=
new
AccessToken
(
isset
(
$token
[
'type'
])
?
$token
[
'type'
]
:
TokenType
::
Bearer
,
$token
[
'accessToken'
],
isset
(
$token
[
'refreshToken'
])
?
$token
[
'refreshT
oken'
]
:
null
,
isset
(
$token
[
'macKey'
])
?
$token
[
'macKey'
]
:
null
,
isset
(
$token
[
'macAlgorithm'
])
?
$token
[
'macAlgorithm'
]
:
null
);
$token
=
new
\AccessToken
(
isset
(
$token
[
'token_type'
])
?
$token
[
'token_type'
]
:
\TokenType
::
Bearer
,
$token
[
'access_token'
],
isset
(
$token
[
'refresh_token'
])
?
$token
[
'refresh_t
oken'
]
:
null
,
isset
(
$token
[
'macKey'
])
?
$token
[
'macKey'
]
:
null
,
isset
(
$token
[
'macAlgorithm'
])
?
$token
[
'macAlgorithm'
]
:
null
);
}
// 获得保存的token
$this
->
renn
->
authWithToken
(
$token
);
...
...
@@ -130,7 +130,7 @@ class Call extends Factory
{
if
(
is_array
(
$token
))
{
$token
=
new
AccessToken
(
isset
(
$token
[
'type'
])
?
$token
[
'type'
]
:
TokenType
::
Bearer
,
$token
[
'accessToken'
],
isset
(
$token
[
'refreshToken'
])
?
$token
[
'refreshToken'
]
:
null
,
isset
(
$token
[
'macKey'
])
?
$token
[
'macKey'
]
:
null
,
isset
(
$token
[
'macAlgorithm'
])
?
$token
[
'macAlgorithm'
]
:
null
);
$token
=
new
\AccessToken
(
isset
(
$token
[
'type'
])
?
$token
[
'type'
]
:
\
TokenType
::
Bearer
,
$token
[
'accessToken'
],
isset
(
$token
[
'refreshToken'
])
?
$token
[
'refreshToken'
]
:
null
,
isset
(
$token
[
'macKey'
])
?
$token
[
'macKey'
]
:
null
,
isset
(
$token
[
'macAlgorithm'
])
?
$token
[
'macAlgorithm'
]
:
null
);
}
// 获得保存的token
$this
->
renn
->
authWithToken
(
$token
);
...
...
@@ -178,7 +178,7 @@ class Call extends Factory
{
if
(
is_array
(
$token
))
{
$token
=
new
AccessToken
(
isset
(
$token
[
'type'
])
?
$token
[
'type'
]
:
TokenType
::
Bearer
,
$token
[
'accessToken'
],
isset
(
$token
[
'refreshToken'
])
?
$token
[
'refreshToken'
]
:
null
,
isset
(
$token
[
'macKey'
])
?
$token
[
'macKey'
]
:
null
,
isset
(
$token
[
'macAlgorithm'
])
?
$token
[
'macAlgorithm'
]
:
null
);
$token
=
new
\AccessToken
(
isset
(
$token
[
'type'
])
?
$token
[
'type'
]
:
\
TokenType
::
Bearer
,
$token
[
'accessToken'
],
isset
(
$token
[
'refreshToken'
])
?
$token
[
'refreshToken'
]
:
null
,
isset
(
$token
[
'macKey'
])
?
$token
[
'macKey'
]
:
null
,
isset
(
$token
[
'macAlgorithm'
])
?
$token
[
'macAlgorithm'
]
:
null
);
}
// 获得保存的token
$this
->
renn
->
authWithToken
(
$token
);
...
...
web-static/js/passport/reg.js
View file @
783db69
...
...
@@ -538,29 +538,35 @@ exports.init = function(page) {
var
time
=
0
,
t
,
refer
=
data
.
href
;
refer
;
t
=
setTimeout
(
function
()
{
time
++
;
},
1000
);
if
(
data
.
code
===
200
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/register/mobileregister'
,
data
:
{
session
:
data
.
session
}
}).
then
(
function
(
data
)
{
refer
=
data
.
data
.
href
;
t
=
setTimeout
(
function
()
{
time
++
;
},
1000
);
$
.
ajax
({
type
:
'GET'
,
url
:
data
.
data
.
session
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
&&
t
<
3
)
{
clearInterval
(
t
);
location
.
href
=
refer
;
}
});
if
(
data
.
code
===
200
&&
t
<
3
)
{
if
(
t
>=
3
)
{
clearInterval
(
t
);
location
.
href
=
refer
;
}
}
);
}
else
{
if
(
t
>=
3
)
{
clearInterval
(
t
);
location
.
href
=
refer
;
//todo
console
.
log
(
'网络超时~'
);
}
});
...
...
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Autouserinfo.php
View file @
783db69
...
...
@@ -50,7 +50,7 @@ class AutouserinfoController extends AbstractAction
'actionUrl'
=>
Helpers
::
url
(
'/autouserinfo/bind'
),
'region'
=>
RegData
::
getAreasData
(),
'location'
=>
'+86'
,
'captchaUrl'
=>
'/passport/images?t=1449799445'
,
'captchaUrl'
=>
Helpers
::
url
(
'/passport/images?t='
.
time
())
,
'itemUrl'
=>
Helpers
::
url
(
'/help/?category_id=9'
),
'referUrl'
=>
$refer
,
'skipUrl'
=>
SITE_MAIN
,
...
...
@@ -71,7 +71,7 @@ class AutouserinfoController extends AbstractAction
public
function
userInfoAction
()
{
//获取用户
$uid
=
$this
->
getUid
(
tru
e
);
$uid
=
$this
->
getUid
(
fals
e
);
$nickname
=
$this
->
get
(
'nickname'
);
$openId
=
$this
->
get
(
'openId'
);
$sourceType
=
$this
->
get
(
'sourceType'
);
...
...
@@ -113,9 +113,9 @@ class AutouserinfoController extends AbstractAction
break
;
}
$phoneNum
=
trim
(
$this
->
post
(
'
phoneNum
'
));
$phoneNum
=
trim
(
$this
->
post
(
'
mobile
'
));
$openId
=
trim
(
$this
->
post
(
'openId'
));
$areaCode
=
trim
(
$this
->
post
(
'area
Code
'
,
'86'
));
$areaCode
=
trim
(
$this
->
post
(
'area'
,
'86'
));
$sourceType
=
trim
(
$this
->
post
(
'sourceType'
));
...
...
@@ -152,20 +152,20 @@ class AutouserinfoController extends AbstractAction
break
;
}
$phoneNum
=
trim
(
$this
->
post
(
'phoneNum'
));
$areaCode
=
trim
(
$this
->
post
(
'areaCode'
));
$phoneNum
=
trim
(
$this
->
post
(
'mobile'
));
$areaCode
=
trim
(
$this
->
post
(
'area'
));
$verifyCode
=
trim
(
$this
->
post
(
'verifyCode'
));
//校验手机号格式
if
(
!
is_numeric
(
$phoneNum
)
||
!
is_numeric
(
$areaCode
))
{
$data
[
'code'
]
=
40
1
;
$data
[
'code'
]
=
40
0
;
$data
[
'message'
]
=
'手机号码格式不正确'
;
break
;
}
//检测验证码不正确
if
(
!
PassportModel
::
verifyCode
(
$verifyCode
))
{
$data
[
'code'
]
=
40
2
;
$data
[
'code'
]
=
40
0
;
$data
[
'message'
]
=
'图形验证码不正确'
;
break
;
}
...
...
@@ -183,7 +183,6 @@ class AutouserinfoController extends AbstractAction
/*
* 校验图形验证码
*/
public
function
checkPicCodeAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
...
...
@@ -193,7 +192,7 @@ class AutouserinfoController extends AbstractAction
if
(
!
$this
->
isAjax
())
{
break
;
}
$verifyCode
=
$phoneNum
=
trim
(
$this
->
post
(
'verifyCode'
));
$verifyCode
=
trim
(
$this
->
post
(
'verifyCode'
));
$picFlag
=
PassportModel
::
verifyCode
(
$verifyCode
);
if
(
$picFlag
)
{
$data
=
array
(
'code'
=>
200
,
'message'
=>
'验证码正确'
,
'data'
=>
''
);
...
...
@@ -220,8 +219,8 @@ class AutouserinfoController extends AbstractAction
break
;
}
$phoneNum
=
trim
(
$this
->
post
(
'phoneNum'
));
$areaCode
=
trim
(
$this
->
post
(
'areaCode'
));
$phoneNum
=
trim
(
$this
->
post
(
'mobile'
));
$areaCode
=
trim
(
$this
->
post
(
'area'
));
$code
=
trim
(
$this
->
post
(
'code'
));
//短信验证码
//校验手机号格式
if
(
!
is_numeric
(
$phoneNum
)
||
!
is_numeric
(
$areaCode
))
{
...
...
@@ -253,8 +252,8 @@ class AutouserinfoController extends AbstractAction
break
;
}
$phoneNum
=
trim
(
$this
->
post
(
'phoneNum'
));
$areaCode
=
trim
(
$this
->
post
(
'areaCode'
,
'86'
));
$phoneNum
=
trim
(
$this
->
post
(
'mobile'
));
$areaCode
=
trim
(
$this
->
post
(
'area'
,
'86'
));
$openId
=
trim
(
$this
->
post
(
'openId'
));
$sourceType
=
trim
(
$this
->
post
(
'sourceType'
));
$code
=
trim
(
$this
->
post
(
'code'
));
//短信验证码
...
...
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Register.php
View file @
783db69
...
...
@@ -73,15 +73,40 @@ class RegisterController extends WebAction
}
/**
* 校验
并发送
验证码
* 校验
图形
验证码
*
* @return json
*/
public
function
piccaptchaAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$verifyCode
=
trim
(
$this
->
post
(
'verifyCode'
));
$picFlag
=
PassportModel
::
verifyCode
(
$verifyCode
);
if
(
$picFlag
)
{
$data
=
array
(
'code'
=>
200
,
'message'
=>
'验证码正确'
,
'data'
=>
''
);
}
else
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'验证码错误'
,
'data'
=>
''
);
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
/**
* 发送短信验证码
*/
public
function
sendBindMsgAction
(){
$mobile
=
trim
(
$this
->
post
(
'mobile'
),
' '
);
$area
=
intval
(
trim
(
$this
->
post
(
'area'
),
' '
));
$verifyCode
=
strtolower
(
trim
(
$this
->
post
(
'
c
ode'
),
' '
));
$verifyCode
=
strtolower
(
trim
(
$this
->
post
(
'
verifyC
ode'
),
' '
));
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
...
...
@@ -91,13 +116,14 @@ class RegisterController extends WebAction
}
/* 判断参数是否合法 */
if
(
!
is_numeric
(
$mobile
)
||
!
is_numeric
(
$area
))
{
$
code
=
400
;
$
data
[
'code'
]
=
400
;
$data
[
'message'
]
=
'手机号码格式不正确'
;
break
;
}
//检测验证码不正确
if
(
!
PassportModel
::
verifyCode
(
$verifyCode
))
{
$data
[
'message'
]
=
'验证码不正确'
;
$data
[
'code'
]
=
400
;
$data
[
'message'
]
=
'图形验证码不正确'
;
break
;
}
//发送代码
...
...
@@ -119,7 +145,32 @@ class RegisterController extends WebAction
public
function
msgcaptchaAction
()
{
$this
->
echoJson
(
array
(
'code'
=>
200
));
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$phoneNum
=
trim
(
$this
->
post
(
'mobile'
));
$areaCode
=
trim
(
$this
->
post
(
'area'
));
$code
=
trim
(
$this
->
post
(
'code'
));
//短信验证码
//校验手机号格式
if
(
!
is_numeric
(
$phoneNum
)
||
!
is_numeric
(
$areaCode
))
{
$data
[
'code'
]
=
401
;
$data
[
'message'
]
=
'手机号码格式不正确'
;
break
;
}
$data
=
BindData
::
checkBindCode
(
$areaCode
,
$phoneNum
,
$code
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
/**
...
...
@@ -130,7 +181,7 @@ class RegisterController extends WebAction
{
$mobile
=
trim
(
$this
->
post
(
'mobile'
),
' '
);
//mobile
$area
=
intval
(
trim
(
$this
->
post
(
'area'
),
' '
));
//area
$verifyCode
=
strtolower
(
trim
(
$this
->
post
(
'
captcha'
),
' '
));
//captcha
$verifyCode
=
strtolower
(
trim
(
$this
->
post
(
'
verifyCode'
),
' '
));
//图形验证码
$code
=
trim
(
$this
->
post
(
'code'
),
''
);
//code
$password
=
$this
->
post
(
'password'
);
$url
=
'/passport/register/index'
;
...
...
@@ -156,18 +207,18 @@ class RegisterController extends WebAction
$data
[
'message'
]
=
'密码不正确'
;
break
;
}
$effective_time
=
$this
->
getSession
(
'effective_time'
);
if
(
$effective_time
<
time
()
||
empty
(
$effective_time
))
{
$data
[
'message'
]
=
'注册超时'
;
break
;
}
/* 验证注册的标识码是否有效 */
$data
=
RegData
::
validMobileCode
(
$area
,
$mobile
,
$code
);
if
(
!
isset
(
$data
[
'code'
])
||
$data
[
'code'
]
!=
200
)
{
$data
[
'message'
]
=
'验证码错误'
;
break
;
}
$effective_time
=
$this
->
getSession
(
'effective_time'
);
if
(
$effective_time
<
time
()
||
empty
(
$effective_time
))
{
$data
[
'message'
]
=
'注册超时'
;
break
;
}
/*手机注册*/
$data
=
RegData
::
regMobile
(
$area
,
$mobile
,
$password
);
if
(
!
isset
(
$data
[
'code'
])
||
$data
[
'code'
]
!=
200
)
{
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Sale.php
View file @
783db69
...
...
@@ -13,13 +13,15 @@ class SaleController extends WebAction
public
function
indexAction
()
{
//获取专区ID
$specialsaleId
=
$this
->
param
(
'specialsaleI
d'
);
$specialsaleId
=
$this
->
get
(
'specialsale_i
d'
);
$specialInfo
=
SaleData
::
getSpecial
(
$specialsaleId
);
$special
=
$specialInfo
[
'data'
];
if
(
isset
(
$specialInfo
[
'data'
]))
{
$special
=
$specialInfo
[
'data'
];
}
else
{
$special
=
array
();
}
//获取促销ID
$promotion
=
$this
->
param
(
'promotion'
);
$promotion
=
$this
->
get
(
'promotion'
);
//专区ID和促销ID都为空时,跳转到主页
if
(
empty
(
$specialsaleId
)
&&
empty
(
$promotion
))
{
$this
->
go
(
SITE_MAIN
);
...
...
Please
register
or
login
to post a comment