Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ruer_cms
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蔡闯
ruer_cms
Commits
a170f952
Commit
a170f952
authored
Feb 19, 2021
by
蔡闯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登入接口修改
parent
0f6567b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
13 deletions
+26
-13
app/api/controller/Login.php
app/api/controller/Login.php
+26
-13
No files found.
app/api/controller/Login.php
View file @
a170f952
...
...
@@ -42,20 +42,10 @@ class Login extends BaseController
$res
[
'uid'
]
=
$uid
;
$res
[
'phone'
]
=
$phone
;
$res
[
'pwd'
]
=
empty
(
$userInfo
[
'password'
])
?
0
:
1
;
//查询该用户是否绑定了房间,如果有,则返回上一次绑定的房间
$userBind
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'uid'
=>
$uid
,
'status'
=>
1
,
'is_lately_login'
=>
1
])
->
field
(
'house_user_bind_id,village_id,vacancy_id'
)
->
find
();
if
(
$userBind
){
$res
[
'userBindInfo'
]
=
$userBind
;
}
else
{
//查询是否有房间
$userBind
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'uid'
=>
$uid
,
'status'
=>
1
])
->
field
(
'house_user_bind_id,village_id,vacancy_id'
)
->
find
();
if
(
$userBind
){
$res
[
'userBindInfo'
]
=
$userBind
;
Db
::
name
(
'house_user_bind'
)
->
where
([
'uid'
=>
$uid
,
'status'
=>
1
])
->
save
([
'is_lately_login'
=>
1
]);
}
else
{
$res
[
'userBindInfo'
]
=
(
Object
)[];
}
}
$res
[
'userBindInfo'
]
=
$this
->
findOnlyRoom
(
$uid
);
return
$this
->
returnJson
(
$res
);
}
else
{
...
...
@@ -79,15 +69,38 @@ class Login extends BaseController
$res
[
'uid'
]
=
$userInfo
[
'uid'
];
$res
[
'phone'
]
=
$phone
;
$res
[
'pwd'
]
=
empty
(
$userInfo
[
'password'
])
?
0
:
1
;
//查询该用户是否绑定了房间,如果有,则返回上一次绑定的房间
$res
[
'userBindInfo'
]
=
$this
->
findOnlyRoom
(
$userInfo
[
'uid'
]);
Common
::
synUserData
(
$userInfo
[
'uid'
],
$phone
);
return
$this
->
returnJson
(
$res
,
200
);
}
else
{
return
$this
->
returnJson
([],
'密码不正确!'
,
'400'
);
}
}
return
$this
->
returnJson
([],
'参数错误,请检查!'
,
'400'
);
}
//查询是否有房间唯一,如果唯一返回
public
function
findOnlyRoom
(
$uid
)
{
//查询该用户是否绑定了房间,如果有,则返回上一次绑定的房间
$userBind
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'uid'
=>
$uid
,
'status'
=>
1
,
'is_lately_login'
=>
1
])
->
field
(
'house_user_bind_id,village_id,vacancy_id'
)
->
find
();
if
(
$userBind
){
return
$userBind
;
}
else
{
//查询是否有房间
$userBind
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'uid'
=>
$uid
,
'status'
=>
1
])
->
field
(
'house_user_bind_id,village_id,vacancy_id'
)
->
find
();
if
(
$userBind
){
return
$userBind
;
Db
::
name
(
'house_user_bind'
)
->
where
([
'uid'
=>
$uid
,
'status'
=>
1
])
->
save
([
'is_lately_login'
=>
1
]);
}
else
{
return
(
Object
)[];
}
}
}
//发送短信验证码
public
function
sendCode
()
{
$phone
=
Request
::
param
(
'phone'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment