Toggle navigation
Toggle navigation
This project
Loading...
Sign in
chenchao
/
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
Rock Zhang
9 years ago
Commit
7f0b2b9e2ae87d53bceb35b5dc9e867543a29eb8
2 parents
a951b940
58655c07
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
179 additions
and
38 deletions
library/LibModels/Wap/Passport/BindData.php
static/js/cart/chose-panel.js
template/m.yohobuy.com/partials/cart/chose-panel.phtml
template/m.yohobuy.com/partials/passport/header.phtml
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
library/LibModels/Wap/Passport/BindData.php
View file @
7f0b2b9
...
...
@@ -42,7 +42,7 @@ class BindData
* @param string $mobile 手机号
*
*/
public
static
function
sendBindMsg
(
$area
,
$mobile
)
public
static
function
sendBindMsg
(
$area
,
$mobile
)
{
$param
=
Yohobuy
::
param
();
...
...
@@ -58,7 +58,7 @@ class BindData
* 验证验证码是否正确
*
*/
public
static
function
checkBindCode
(
$area
,
$mobile
,
$code
)
public
static
function
checkBindCode
(
$area
,
$mobile
,
$code
)
{
$param
=
Yohobuy
::
param
();
...
...
@@ -100,4 +100,47 @@ class BindData
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 换绑手机检验
* @param string $mobile 手机号
* @param string $area 国别码
*/
public
static
function
changeCheck
(
$mobile
,
$area
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.passport.changeCheck'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'area'
]
=
$area
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 换绑手机
* @param string $uid 用户Id
* @param string $code 验证码
* @param string $mobile 手机号
* @param string $area 国别码
*/
public
static
function
changeMobile
(
$uid
,
$mobile
,
$area
,
$code
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.passport.changeMobile'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'uid'
]
=
$uid
;
$param
[
'code'
]
=
$code
;
$param
[
'area'
]
=
$area
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
}
...
...
static/js/cart/chose-panel.js
View file @
7f0b2b9
...
...
@@ -82,16 +82,20 @@ function show(data) {
$chosePanel
.
html
(
panelTmpl
(
data
));
init
();
}
}
//显示当前Panel
function
show
()
{
$
(
'.chose-panel'
).
show
();
$
(
'body'
).
css
(
'overflow'
,
'hidden'
);
$num
=
$
(
'#good-num'
);
}
////显示当前Panel
//function show() {
// $('.chose-panel').show();
//
// $('body').css('overflow', 'hidden');
// $num = $('#good-num');
//}
//隐藏当前Panel
function
hide
()
{
$
(
'.chose-panel'
).
hide
();
...
...
template/m.yohobuy.com/partials/cart/chose-panel.phtml
View file @
7f0b2b9
...
...
@@ -58,6 +58,7 @@
</a>
</div>
<span
class=
"left-num"
></span>
<input
id=
"left-num"
type=
"hidden"
value=
"0"
>
</div>
</div>
</div>
...
...
template/m.yohobuy.com/partials/passport/header.phtml
View file @
7f0b2b9
<div class="header">
{{#backUrl}}
<a class="go-back" href="javascript:history.go(-1);"></a>
{{/backUrl}}
<a class="go-back" href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}"></a>
{{#showHeaderImg}}
<div class="img-header"></div>
<div class="img-header"></div>
{{/showHeaderImg}}
{{#headerText}}
<p class="title">{{.}}</p>
<p class="title">{{.}}</p>
{{/headerText}}
</div>
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
View file @
7f0b2b9
...
...
@@ -17,7 +17,8 @@ class BindController extends AbstractAction
public
function
indexAction
()
{
$refer
=
$this
->
get
(
'refer'
);
if
(
!
empty
(
$refer
))
{
if
(
!
empty
(
$refer
))
{
$this
->
setCookie
(
'refer'
,
$refer
);
}
...
...
@@ -105,9 +106,11 @@ class BindController extends AbstractAction
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
if
(
!
$this
->
isAjax
())
{
break
;
}
...
...
@@ -118,21 +121,27 @@ class BindController extends AbstractAction
$nickname
=
$this
->
post
(
'nickname'
);
if
(
!
is_numeric
(
$phoneNum
)
||
!
$openId
||
!
$areaCode
||
!
$sourceType
)
{
if
(
!
is_numeric
(
$phoneNum
)
||
!
$openId
||
!
$areaCode
||
!
$sourceType
)
{
break
;
}
$res
=
BindData
::
bindCheck
(
$phoneNum
,
$openId
,
$sourceType
);
if
(
!
isset
(
$res
[
'code'
]))
{
if
(
!
isset
(
$res
[
'code'
]))
{
break
;
}
if
(
$res
[
'code'
]
==
200
)
{
if
(
$res
[
'code'
]
==
200
)
{
$next
=
Helpers
::
url
(
'/passport/bind/code'
,
array
(
'isReg'
=>
$res
[
'data'
][
'is_register'
],
'openId'
=>
$openId
,
'sourceType'
=>
$sourceType
,
'nickname'
=>
$nickname
,
'areaCode'
=>
$areaCode
,
'phoneNum'
=>
$phoneNum
));
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'isReg'
=>
$res
[
'data'
][
'is_register'
],
'next'
=>
$next
));
}
else
{
}
else
{
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
isset
(
$res
[
'data'
])
?
$res
[
'data'
]
:
''
);
}
}
while
(
false
);
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
...
...
@@ -142,24 +151,29 @@ class BindController extends AbstractAction
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
if
(
!
$this
->
isAjax
())
{
break
;
}
$phoneNum
=
$this
->
post
(
'phoneNum'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$phoneNum
))
{
if
(
!
is_numeric
(
$phoneNum
)
||
!
$areaCode
)
{
break
;
}
$data
=
BindData
::
sendBindMsg
(
$areaCode
,
$phoneNum
);
if
(
!
isset
(
$data
[
'code'
]))
{
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
}
while
(
false
);
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
...
...
@@ -169,9 +183,11 @@ class BindController extends AbstractAction
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
if
(
!
$this
->
isAjax
())
{
break
;
}
...
...
@@ -179,15 +195,18 @@ class BindController extends AbstractAction
$code
=
$this
->
post
(
'code'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$phoneNum
)
||
!
$code
)
{
if
(
!
is_numeric
(
$phoneNum
)
||
!
$code
||
!
$areaCode
)
{
break
;
}
$data
=
BindData
::
checkBindCode
(
$areaCode
,
$phoneNum
,
$code
);
if
(
!
isset
(
$data
[
'code'
]))
{
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
}
while
(
false
);
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
...
...
@@ -197,9 +216,11 @@ class BindController extends AbstractAction
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
if
(
!
$this
->
isAjax
())
{
break
;
}
...
...
@@ -210,33 +231,107 @@ class BindController extends AbstractAction
$nickname
=
$this
->
post
(
'nickname'
);
$password
=
$this
->
post
(
'password'
);
if
(
!
is_numeric
(
$phoneNum
)
||
!
$openId
||
!
$sourceType
||
!
$areaCode
)
{
if
(
!
is_numeric
(
$phoneNum
)
||
!
$openId
||
!
$sourceType
||
!
$areaCode
)
{
break
;
}
$res
=
BindData
::
bindMobile
(
$openId
,
$nickname
,
$sourceType
,
$phoneNum
,
$areaCode
,
$password
);
if
(
!
isset
(
$res
[
'code'
]))
{
if
(
!
isset
(
$res
[
'code'
]))
{
break
;
}
//绑定成功,跳转页面
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
}
else
{
}
else
{
$refer
=
rawurldecode
(
$refer
);
}
if
(
isset
(
$res
[
'code'
])
&&
$res
[
'code'
]
==
200
&&
!
empty
(
$res
[
'data'
][
'uid'
]))
{
if
(
isset
(
$res
[
'code'
])
&&
$res
[
'code'
]
==
200
&&
!
empty
(
$res
[
'data'
][
'uid'
]))
{
$token
=
Helpers
::
makeToken
(
$res
[
'data'
][
'uid'
]);
$this
->
setCookie
(
'_TOKEN'
,
$token
);
$this
->
setSession
(
'_TOKEN'
,
$token
);
$refer
=
Helpers
::
syncUserSession
(
$res
[
'data'
][
'uid'
],
$refer
);
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'refer'
=>
$refer
));
}
else
{
}
else
{
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'refer'
=>
$refer
));
}
}
while
(
false
);
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
//换绑check
public
function
changeCheckAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$phoneNum
=
$this
->
post
(
'phoneNum'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$phoneNum
)
||
!
$areaCode
)
{
break
;
}
$data
=
BindData
::
changeCheck
(
$phoneNum
,
$areaCode
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
//换绑mobile
public
function
changeMobileAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$uid
=
$this
->
getUid
(
true
);
$phoneNum
=
$this
->
post
(
'phoneNum'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
$code
=
$this
->
post
(
'code'
);
if
(
!
is_numeric
(
$phoneNum
)
||
!
$areaCode
||
!
$code
||
!
$uid
)
{
break
;
}
$data
=
BindData
::
changeMobile
(
$uid
,
$phoneNum
,
$areaCode
,
$code
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
...
...
Please
register
or
login
to post a comment