Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
7379f2d1
Commit
7379f2d1
authored
Mar 08, 2021
by
m1991
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录功能增加生成唯一标识 用于绑定有赞OpengId
修复 前端无法拿到返回值问题
parent
3b192d8c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
30 deletions
+19
-30
UserService.java
...e/src/main/java/cn/wisenergy/service/app/UserService.java
+2
-0
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-service/src/main/java/cn/wisenergy/service/app/UserService.java
View file @
7379f2d1
...
...
@@ -58,4 +58,6 @@ public interface UserService {
R
<
AerialDeliveryVo
>
queryAerialDelivery
();
R
<
Boolean
>
setHeadImage
(
String
userId
,
String
headImage
);
R
<
Boolean
>
fillInInviteCode
(
String
userId
,
String
inviteCode
);
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/LoginController.java
View file @
7379f2d1
...
...
@@ -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 @
7379f2d1
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