Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
Project
Project
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
licc
shop-Mall
Commits
e93888d8
Commit
e93888d8
authored
Mar 08, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://111.203.232.171:8888/licc/shop-mall
into master
parents
9258ced6
cc1a4120
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
30 deletions
+17
-30
LoginController.java
...n/wisenergy/web/admin/controller/app/LoginController.java
+11
-11
SmsController.java
.../cn/wisenergy/web/admin/controller/app/SmsController.java
+6
-19
No files found.
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/LoginController.java
View file @
e93888d8
...
...
@@ -131,36 +131,36 @@ public class LoginController {
@ApiImplicitParam
(
name
=
"sms"
,
value
=
"验证码"
,
required
=
true
,
dataType
=
"String"
)
})
@RequestMapping
(
"/register"
)
public
Map
register
(
@RequestParam
String
userId
,
@RequestParam
String
beInvitedCode
,
@RequestParam
String
sms
)
{
public
Map
register
(
@RequestParam
String
userId
,
@RequestParam
String
beInvitedCode
,
@RequestParam
String
sms
)
throws
Exception
{
User
users
=
null
;
String
key
=
StringUtil
.
formatKeyWithPrefix
(
Constants
.
RedisKey
.
PROJECT_PRIFIX
,
Constants
.
RedisKey
.
SMS_PRIFIX
,
userId
,
Constants
.
Sms
.
CodeType
.
LOGIN_OR_REGISTER
+
""
);
String
redisCode
=
redisUtils
.
getValue
(
key
);
if
(
StringUtil
.
isBlank
(
redisCode
)
||
!
sms
.
equals
(
redisCode
)){
try
{
throw
new
BaseException
(
ResultEnum
.
FAIL_VERIFY
);
}
catch
(
BaseException
e
)
{
//
try {
//
throw new BaseException(ResultEnum.FAIL_VERIFY);
//
//
} catch (BaseException e) {
Map
map
=
new
HashMap
();
map
.
put
(
"code"
,
"1003"
);
map
.
put
(
"msg"
,
"验证码错误"
);
// throw new BaseException(ResultEnum.FAIL_VERIFY);
return
map
;
}
//
}
}
redisUtils
.
delete
(
key
);
//判断phone是否符合输入类型
if
(!
userId
.
matches
(
Constants
.
RegConstant
.
PHONE_REGSTR
)){
try
{
throw
new
BaseException
(
ResultEnum
.
PHONE_ERROR
);
}
catch
(
BaseException
e
)
{
e
.
printStackTrace
();
//
try {
//
throw new BaseException(ResultEnum.PHONE_ERROR);
//
} catch (BaseException e) {
//
e.printStackTrace();
Map
map
=
new
HashMap
();
map
.
put
(
"code"
,
"1008"
);
map
.
put
(
"msg"
,
"手机号码格式不正确"
);
// throw new BaseException(ResultEnum.FAIL_VERIFY);
return
map
;
}
//
}
}
return
usersService
.
userByZx
(
userId
,
beInvitedCode
);
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/SmsController.java
View file @
e93888d8
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.enums.ResultEnum
;
import
cn.wisenergy.common.utils.*
;
import
cn.wisenergy.web.sms.BaseException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -19,7 +17,7 @@ import java.util.Map;
@Api
(
tags
=
"发送手机验证码 codeType 0注册/登录验证 1修改密码 2订单通知信息"
)
@Slf4j
@RequestMapping
(
"/api/sms"
)
@RequestMapping
(
"/api/sms
/
"
)
@RestController
public
class
SmsController
{
...
...
@@ -46,25 +44,14 @@ public class SmsController {
Map
map
=
new
HashMap
();
//判断phone和codeType是否符合输入类型
if
(!
phone
.
matches
(
Constants
.
RegConstant
.
PHONE_REGSTR
)){
try
{
throw
new
BaseException
(
ResultEnum
.
PHONE_ERROR
);
}
catch
(
BaseException
e
)
{
e
.
printStackTrace
();
map
.
put
(
"code"
,
"1005"
);
map
.
put
(
"msg"
,
"账号不存在,请注册"
);
return
(
Result
)
map
;
}
return
ResultUtils
.
returnFail
(
"手机号码格式不正确"
,
"1009"
)
;
}
if
(
codeType
!=
Constants
.
Sms
.
CodeType
.
LOGIN_OR_REGISTER
&&
codeType
!=
Constants
.
Sms
.
CodeType
.
PASS_UPDATE
&&
codeType
!=
Constants
.
Sms
.
CodeType
.
ORDER_NOTICE
){
try
{
throw
new
BaseException
(
ResultEnum
.
CODETYPE_ERROR
);
}
catch
(
BaseException
e
)
{
e
.
printStackTrace
();
map
.
put
(
"code"
,
"1009"
);
map
.
put
(
"msg"
,
"手机号码格式不正确"
);
return
(
Result
)
map
;
}
return
ResultUtils
.
returnFail
(
"输入codeType不正确!"
,
"1008"
)
;
}
String
key
=
StringUtil
.
formatKeyWithPrefix
(
Constants
.
RedisKey
.
PROJECT_PRIFIX
,
Constants
.
RedisKey
.
SMS_PRIFIX
,
phone
,
codeType
+
""
);
...
...
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