Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
Z
zion
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
zion
Commits
e889e19d
提交
e889e19d
authored
1月 06, 2020
作者:
zgy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化登录功能
上级
b55beae9
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
48 行增加
和
10 行删除
+48
-10
pom.xml
pom.xml
+12
-5
LoginController.java
...m/diaoyun/zion/chinafrica/controller/LoginController.java
+8
-0
TbCfUserInfoDao.java
...java/com/diaoyun/zion/chinafrica/dao/TbCfUserInfoDao.java
+1
-0
TbCfUserInfoService.java
.../diaoyun/zion/chinafrica/service/TbCfUserInfoService.java
+4
-0
TbCfUserInfoServiceImpl.java
...zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
+22
-5
SMSUtil.java
src/main/java/com/diaoyun/zion/master/util/SMSUtil.java
+1
-0
没有找到文件。
pom.xml
浏览文件 @
e889e19d
...
@@ -40,6 +40,13 @@
...
@@ -40,6 +40,13 @@
<artifactId>
yunpian-java-sdk
</artifactId>
<artifactId>
yunpian-java-sdk
</artifactId>
<version>
1.2.7
</version>
<version>
1.2.7
</version>
</dependency>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-elasticsearch -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-elasticsearch
</artifactId>
</dependency>
<!--springframework.boot-->
<!--springframework.boot-->
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -200,11 +207,11 @@
...
@@ -200,11 +207,11 @@
</dependency>
</dependency>
<!--net.sf.json-lib-->
<!--net.sf.json-lib-->
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<!-- <dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.httpcomponents</groupId>-->
<!-- <groupId>org.apache.httpcomponents</groupId>-->
<!-- <artifactId>httpclient</artifactId>-->
<!-- <artifactId>httpclient</artifactId>-->
<!-- <!–<version>4.5.2</version>–>-->
<!-- <!–<version>4.5.2</version>–>-->
<!-- </dependency>-->
<!-- </dependency>-->
<!--apache httpclient-->
<!--apache httpclient-->
...
...
src/main/java/com/diaoyun/zion/chinafrica/controller/LoginController.java
浏览文件 @
e889e19d
...
@@ -9,6 +9,7 @@ import com.diaoyun.zion.master.enums.ResultCodeEnum;
...
@@ -9,6 +9,7 @@ import com.diaoyun.zion.master.enums.ResultCodeEnum;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
org.apiguardian.api.API
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -104,4 +105,11 @@ public class LoginController extends BaseController {
...
@@ -104,4 +105,11 @@ public class LoginController extends BaseController {
result
.
setData
(
userInfo
);
result
.
setData
(
userInfo
);
return
result
;
return
result
;
}
}
@ApiOperation
(
"验证手机号"
)
@GetMapping
(
"/checkByPhone/{phone}"
)
public
Result
checkByPhone
(
@ApiParam
(
"手机号"
)
@PathVariable
(
"phone"
)
String
phone
)
{
return
tbCfUserInfoService
.
checkByPhone
(
phone
);
}
}
}
src/main/java/com/diaoyun/zion/chinafrica/dao/TbCfUserInfoDao.java
浏览文件 @
e889e19d
...
@@ -70,4 +70,5 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
...
@@ -70,4 +70,5 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
String
findEmails
();
String
findEmails
();
int
updateIsSend
(
String
email
);
int
updateIsSend
(
String
email
);
}
}
src/main/java/com/diaoyun/zion/chinafrica/service/TbCfUserInfoService.java
浏览文件 @
e889e19d
...
@@ -4,7 +4,9 @@ import com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity;
...
@@ -4,7 +4,9 @@ import com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity;
import
com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo
;
import
com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo
;
import
com.diaoyun.zion.master.base.Result
;
import
com.diaoyun.zion.master.base.Result
;
import
freemarker.template.TemplateException
;
import
freemarker.template.TemplateException
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.mail.EmailException
;
import
org.apache.commons.mail.EmailException
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
...
@@ -186,4 +188,6 @@ public interface TbCfUserInfoService {
...
@@ -186,4 +188,6 @@ public interface TbCfUserInfoService {
String
findEmails
();
String
findEmails
();
int
updateIsSend
(
String
email
);
int
updateIsSend
(
String
email
);
Result
checkByPhone
(
String
phone
);
}
}
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
浏览文件 @
e889e19d
package
com
.
diaoyun
.
zion
.
chinafrica
.
service
.
impl
;
package
com
.
diaoyun
.
zion
.
chinafrica
.
service
.
impl
;
import
autovalue.shaded.com.google
$
.
common
.
collect
.
$BiMap
;
import
com.diaoyun.zion.chinafrica.constant.EmailTemplateConstant
;
import
com.diaoyun.zion.chinafrica.constant.EmailTemplateConstant
;
import
com.diaoyun.zion.chinafrica.constant.KeyConstant
;
import
com.diaoyun.zion.chinafrica.constant.KeyConstant
;
import
com.diaoyun.zion.chinafrica.dao.TbCfCouponDao
;
import
com.diaoyun.zion.chinafrica.dao.TbCfCouponDao
;
...
@@ -45,10 +46,7 @@ import java.io.IOException;
...
@@ -45,10 +46,7 @@ import java.io.IOException;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 用户表Service实现类
* 用户表Service实现类
...
@@ -301,6 +299,10 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
...
@@ -301,6 +299,10 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
String
phone
=
"+"
+
phoneNum
.
trim
();
String
phone
=
"+"
+
phoneNum
.
trim
();
Result
result
=
new
Result
();
Result
result
=
new
Result
();
TbCfUserInfoEntity
user
=
tbCfUserInfoDao
.
checkUserByPhone
(
phone
);
TbCfUserInfoEntity
user
=
tbCfUserInfoDao
.
checkUserByPhone
(
phone
);
if
(
user
==
null
)
{
result
.
setData
(
ResultCodeEnum
.
QUERY_ERROR
.
getCode
()).
setMessage
(
"You haven't registered yet, please register first!"
);
return
result
;
}
String
phoneCode
=
(
String
)
captchaRedisCache
.
get
(
KeyConstant
.
CAPTCHA_PHONE
+
phone
);
String
phoneCode
=
(
String
)
captchaRedisCache
.
get
(
KeyConstant
.
CAPTCHA_PHONE
+
phone
);
if
(
phoneCode
==
null
)
{
if
(
phoneCode
==
null
)
{
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
()).
setMessage
(
"Verification code failure"
);
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
()).
setMessage
(
"Verification code failure"
);
...
@@ -308,6 +310,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
...
@@ -308,6 +310,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
}
}
if
(
user
!=
null
&&
phoneCode
.
equals
(
code
))
{
if
(
user
!=
null
&&
phoneCode
.
equals
(
code
))
{
result
=
loginByPhoneCode
(
ip
,
phone
);
result
=
loginByPhoneCode
(
ip
,
phone
);
captchaRedisCache
.
delete
(
KeyConstant
.
CAPTCHA_PHONE
+
phone
);
}
else
{
}
else
{
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
());
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
());
result
.
setMessage
(
"Login failed"
);
result
.
setMessage
(
"Login failed"
);
...
@@ -567,7 +570,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
...
@@ -567,7 +570,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
}
}
@Override
@Override
public
String
findEmails
()
{
public
String
findEmails
()
{
return
tbCfUserInfoDao
.
findEmails
();
return
tbCfUserInfoDao
.
findEmails
();
}
}
...
@@ -576,6 +579,20 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
...
@@ -576,6 +579,20 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
return
tbCfUserInfoDao
.
updateIsSend
(
email
);
return
tbCfUserInfoDao
.
updateIsSend
(
email
);
}
}
@Override
public
Result
checkByPhone
(
String
phone
)
{
Result
result
=
new
Result
();
Map
map
=
new
HashMap
();
boolean
isRegistered
=
true
;
TbCfUserInfoEntity
user
=
tbCfUserInfoDao
.
checkUserByPhone
(
"+"
+
phone
.
trim
());
if
(
user
==
null
)
{
isRegistered
=
false
;
}
map
.
put
(
"isRegistered"
,
isRegistered
);
result
.
setData
(
map
).
setMessage
(
ResultCodeEnum
.
SUCCESS
.
getDesc
());
return
result
;
}
/**
/**
* 获取用户类型
* 获取用户类型
...
...
src/main/java/com/diaoyun/zion/master/util/SMSUtil.java
浏览文件 @
e889e19d
...
@@ -115,6 +115,7 @@ public class SMSUtil {
...
@@ -115,6 +115,7 @@ public class SMSUtil {
+
URLEncoder
.
encode
(
code
,
ENCODING
);
+
URLEncoder
.
encode
(
code
,
ENCODING
);
String
s
=
SMSUtil
.
tplSendSms
(
API_KEY
,
tpl_id
,
tpl_value
,
phone
);
String
s
=
SMSUtil
.
tplSendSms
(
API_KEY
,
tpl_id
,
tpl_value
,
phone
);
System
.
out
.
println
(
s
);
System
.
out
.
println
(
s
);
System
.
out
.
println
(
code
);
return
code
;
return
code
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论