Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
gs1-office-web-sit
Commits
71de27dc
Commit
71de27dc
authored
Dec 27, 2021
by
唐功亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.【修改】 手机号验证码 使用一次就删除redis中的数据
2.【修改】 用户注册使用的手机号和 修改的手机号 做重复校验
parent
47854f8c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
MemberDao.java
src/main/java/io/office/modules/manage/dao/MemberDao.java
+7
-0
MemberServiceImpl.java
...office/modules/manage/service/impl/MemberServiceImpl.java
+16
-0
TimescodeRegiServiceImpl.java
...modules/manage/service/impl/TimescodeRegiServiceImpl.java
+8
-0
No files found.
src/main/java/io/office/modules/manage/dao/MemberDao.java
View file @
71de27dc
...
...
@@ -45,6 +45,13 @@ public interface MemberDao extends BaseMapper<MemberEntity> {
@Update
(
"UPDATE member SET Applystate = #{applystate} WHERE username = #{userName}"
)
void
updateByIdApplystate
(
@Param
(
"applystate"
)
String
applystate
,
@Param
(
"userName"
)
String
userName
);
@Select
(
"select count(1) from member where phone=#{phone}"
)
int
selectByPhone
(
@Param
(
"phone"
)
String
phone
);
@Select
(
"select count(1) from member where phone=#{phone} and id<>#{id}"
)
int
selectByPhoneNot
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"id"
)
String
id
);
/*@Select("select * from member where username=#{userName} or firmcode=#{userName}")
MemberEntity selectByNameAndSn(@Param("userName") String userName);*/
...
...
src/main/java/io/office/modules/manage/service/impl/MemberServiceImpl.java
View file @
71de27dc
...
...
@@ -100,6 +100,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
if
(
memberEntityName
!=
null
){
throw
new
RRException
(
"用户名已存在"
);
}
//判断手机号是否存在
int
count
=
memberDao
.
selectByPhone
(
phone
);
if
(
count
!=
0
){
throw
new
RRException
(
"手机号已存在"
);
}
//利用获取验证码时保存的session,判断手机验证码非空,和发送的短信内容是否一致,提交时的手机号与接收验证码的手机号是否相同,验证码是否已失效
ValueOperations
forValue
=
redisTemplate
.
opsForValue
();
...
...
@@ -176,6 +181,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
if
(
id
.
equals
(
""
))
{
throw
new
RRException
(
"请先登录"
);
}
//判断手机号是否存在
int
count
=
memberDao
.
selectByPhoneNot
(
phone
,
id
);
if
(
count
!=
0
){
throw
new
RRException
(
"手机号已存在"
);
}
int
flag
=
1
;
TimescodeChphoneEntity
timescodeChphoneEntity
=
timescodeChphoneDao
.
selectById
(
phone
);
if
(
timescodeChphoneEntity
!=
null
)
{
// 该手机号码是否发送过短信
...
...
@@ -258,6 +268,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
if
(!
o
.
toString
().
equals
(
verification
))
{
throw
new
RRException
(
"验证码输入错误"
);
}
redisTemplate
.
delete
(
phone
);
//验证码填写成功后删除 验证码
memberDao
.
updateByIDPhone
(
Integer
.
valueOf
(
id
),
phone
);
}
...
...
@@ -355,6 +366,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
if
(!
matchPhoneNumber
(
phone
))
{
throw
new
RRException
(
"手机格式不正确,请重新填写"
);
}
//判断手机号是否存在
int
count
=
memberDao
.
selectByPhone
(
phone
);
if
(
count
!=
0
){
throw
new
RRException
(
"手机号已存在"
);
}
//TODO tgl 判断手机号码是否在黑名单内
//写入session
//手机验证码写入redis
...
...
src/main/java/io/office/modules/manage/service/impl/TimescodeRegiServiceImpl.java
View file @
71de27dc
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import
io.office.common.exception.RRException
;
import
io.office.common.utils.IPUtils
;
import
io.office.modules.manage.dao.LogMessageDao
;
import
io.office.modules.manage.dao.MemberDao
;
import
io.office.modules.manage.dao.TimescodeRegiIpDao
;
import
io.office.modules.manage.entity.LogMessageEntity
;
import
io.office.modules.manage.entity.TimescodeRegiIpEntity
;
...
...
@@ -57,6 +58,8 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@Autowired
private
MemberDao
memberDao
;
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
TimescodeRegiEntity
>
page
=
this
.
page
(
...
...
@@ -106,6 +109,11 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
if
(!
matchPhoneNumber
(
phone
)){
throw
new
RRException
(
"手机格式不正确,请重新填写"
);
}
//判断手机号是否存在
int
count
=
memberDao
.
selectByPhone
(
phone
);
if
(
count
!=
0
){
throw
new
RRException
(
"手机号已存在"
);
}
//TODO tgl 判断手机号码是否在黑名单内
//手机验证码写入redis
ValueOperations
forValue
=
redisTemplate
.
opsForValue
();
...
...
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