Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
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
wangqing
9 years ago
Commit
035de69ee6d708428dcf0c6872350e8d8cf97d35
2 parents
f96061d6
8a51867e
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
39 deletions
library/LibModels/Web/Home/UserData.php
library/LibModels/Web/Passport/RegData.php
yohobuy/www.yohobuy.com/application/models/Passport/Passport.php
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Back.php
library/LibModels/Web/Home/UserData.php
0 → 100644
View file @
035de69
<?php
namespace
LibModels\Web\Home
;
use
Api\Yohobuy
;
use
Api\Sign
;
use
Plugin\Helpers
;
class
UserData
extends
\LibModels\Wap\Home\UserData
{
/**
* 根据手机号获取用户信息[TODO +cache]
*
* @param string $area
* @param string $mobile
* @return array
*/
public
static
function
getUserInfoByMobile
(
$area
,
$mobile
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.passport.userlist'
;
$param
[
'mobile'
]
=
Helpers
::
makeMobile
(
$area
,
$mobile
);
$param
[
'debug'
]
=
'Y'
;
$param
[
'screen_size'
]
=
'320x568'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 根据email获取用户信息
*
* @param string $email
* @return array
*/
public
static
function
getUserInfoByEmail
(
$email
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.passport.userlist'
;
$param
[
'email'
]
=
$email
;
$param
[
'debug'
]
=
'Y'
;
$param
[
'screen_size'
]
=
'320x568'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
}
\ No newline at end of file
...
...
library/LibModels/Web/Passport/RegData.php
View file @
035de69
<?php
namespace
LibModels\Web\Passport
;
use
Api\Yohobuy
;
use
Api\Sign
;
use
Plugin\Helpers
;
class
RegData
extends
\LibModels\Wap\Passport\RegData
{
/**
* 根据手机号获取用户信息[TODO +cache]
*
* @param string $area
* @param string $mobile
* @return string
*/
public
static
function
getUserInfoByMobile
(
$area
,
$mobile
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.passport.userlist'
;
$param
[
'mobile'
]
=
Helpers
::
makeMobile
(
$area
,
$mobile
);
$param
[
'debug'
]
=
'Y'
;
$param
[
'screen_size'
]
=
'320x568'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
}
\ No newline at end of file
...
...
yohobuy/www.yohobuy.com/application/models/Passport/Passport.php
View file @
035de69
...
...
@@ -4,7 +4,7 @@ namespace Passport;
use
Plugin\Helpers
;
use
LibModels\Web\Home\IndexData
;
use
LibModels\Web\
Passport\Reg
Data
;
use
LibModels\Web\
Home\User
Data
;
use
Plugin\Images
;
use
Plugin\Captcha
;
...
...
@@ -113,7 +113,7 @@ class PassportModel
*/
public
static
function
getUserInfoByMobile
(
$area
,
$mobile
)
{
$ret
=
array
();
$data
=
Reg
Data
::
getUserInfoByMobile
(
$area
,
$mobile
);
$data
=
User
Data
::
getUserInfoByMobile
(
$area
,
$mobile
);
if
(
$data
[
'code'
]
==
200
)
{
if
(
!
empty
(
$data
[
'data'
]))
{
$ret
=
current
(
$data
[
'data'
]);
...
...
@@ -122,4 +122,20 @@ class PassportModel
return
$ret
;
}
/**
* 根据邮箱获取用户信息
*
* @param string $email
* @return array
*/
public
static
function
getUserInfoByEmail
(
$email
)
{
$ret
=
array
();
$data
=
UserData
::
getUserInfoByEmail
(
$email
);
if
(
$data
[
'code'
]
==
200
)
{
if
(
!
empty
(
$data
[
'data'
]))
{
$ret
=
current
(
$data
[
'data'
]);
}
}
return
$ret
;
}
}
...
...
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Back.php
View file @
035de69
...
...
@@ -25,22 +25,34 @@ class BackController extends WebAction {
)
);
$this
->
_view
->
display
(
'index'
,
$data
);
}
/**
* 校验验证码
*/
public
function
authcodeAction
()
{
$phoneNum
=
$this
->
post
(
'phoneNum'
,
''
);
$area
=
intval
(
$this
->
post
(
'area'
,
'86'
));
$verifyCode
=
$this
->
post
(
'verifyCode'
,
''
);
$data
=
array
(
'code'
=>
400
,
'message'
=>
'验证失败'
);
if
((
Helpers
::
verifyEmail
(
$phoneNum
)
||
Helpers
::
verifyMobile
(
$phoneNum
))
&&
PassportModel
::
verifyCode
(
$verifyCode
))
{
$data
[
'code'
]
=
200
;
$data
[
'message'
]
=
'验证成功'
;
}
echo
$this
->
echoJson
(
$data
);
}
/**
* 校验验证码
*/
public
function
authcodeAction
()
{
$phoneNum
=
$this
->
post
(
'phoneNum'
,
''
);
$area
=
intval
(
$this
->
post
(
'area'
,
'86'
));
$verifyCode
=
$this
->
post
(
'verifyCode'
,
''
);
$data
=
array
(
'code'
=>
200
,
'message'
=>
'验证成功'
);
if
(
PassportModel
::
verifyCode
(
$verifyCode
))
{
if
(
Helpers
::
verifyEmail
(
$phoneNum
))
{
if
(
empty
(
PassportModel
::
getUserInfoByEmail
(
$phoneNum
)))
{
$data
[
'message'
]
=
'该账户不存在'
;
$data
[
'code'
]
=
400
;
}
}
else
if
(
Helpers
::
verifyMobile
(
$phoneNum
))
{
if
(
empty
(
PassportModel
::
getUserInfoByMobile
(
$phoneNum
,
$area
)))
{
$data
[
'message'
]
=
'该账户不存在'
;
$data
[
'code'
]
=
400
;
}
}
}
echo
$this
->
echoJson
(
$data
);
}
/**
...
...
Please
register
or
login
to post a comment