Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
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
曲欣亮
member-api
Commits
b1ae727e
Commit
b1ae727e
authored
Dec 14, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
91ab1302
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
26 deletions
+31
-26
AdminTokenServiceImpl.java
...om/egolm/film/api/service/impl/AdminTokenServiceImpl.java
+7
-7
MemberTokenServiceImpl.java
...m/egolm/film/api/service/impl/MemberTokenServiceImpl.java
+5
-5
UserTokenServiceImpl.java
...com/egolm/film/api/service/impl/UserTokenServiceImpl.java
+5
-5
AdminLoginController.java
...va/com/egolm/film/api/web/admin/AdminLoginController.java
+2
-3
MemberLoginController.java
.../com/egolm/film/api/web/member/MemberLoginController.java
+2
-3
UserLoginController.java
...java/com/egolm/film/api/web/user/UserLoginController.java
+2
-3
XRException.java
src/main/java/com/egolm/film/config/XRException.java
+8
-0
No files found.
src/main/java/com/egolm/film/api/service/impl/AdminTokenServiceImpl.java
View file @
b1ae727e
...
@@ -16,7 +16,7 @@ import com.egolm.common.web.ServletUtil;
...
@@ -16,7 +16,7 @@ import com.egolm.common.web.ServletUtil;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.X
R
Exception
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.util.Common
;
import
com.egolm.film.util.Common
;
...
@@ -52,20 +52,20 @@ public class AdminTokenServiceImpl implements AdminTokenService {
...
@@ -52,20 +52,20 @@ public class AdminTokenServiceImpl implements AdminTokenService {
}
}
return
token
;
return
token
;
}
else
if
(
state
==
2
)
{
}
else
if
(
state
==
2
)
{
throw
new
XException
(
"用户已禁用"
);
throw
new
X
R
Exception
(
"用户已禁用"
);
}
else
{
}
else
{
throw
new
XException
(
"用户状态未知"
);
throw
new
X
R
Exception
(
"用户状态未知"
);
}
}
}
else
{
}
else
{
throw
new
XException
(
"用户名或密码错误"
);
throw
new
X
R
Exception
(
"用户名或密码错误"
);
}
}
}
else
if
(
list
.
size
()
==
0
)
{
}
else
if
(
list
.
size
()
==
0
)
{
throw
new
XException
(
"用户名或密码错误"
);
throw
new
X
R
Exception
(
"用户名或密码错误"
);
}
else
{
}
else
{
throw
new
XException
(
"用户登陆信息重复,请联系管理员"
);
throw
new
X
R
Exception
(
"用户登陆信息重复,请联系管理员"
);
}
}
}
else
{
}
else
{
throw
new
XException
(
"用户名或密码错误"
);
throw
new
X
R
Exception
(
"用户名或密码错误"
);
}
}
}
}
...
...
src/main/java/com/egolm/film/api/service/impl/MemberTokenServiceImpl.java
View file @
b1ae727e
...
@@ -17,7 +17,7 @@ import com.egolm.film.api.service.MemberTokenService;
...
@@ -17,7 +17,7 @@ import com.egolm.film.api.service.MemberTokenService;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.X
R
Exception
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.util.Common
;
import
com.egolm.film.util.Common
;
...
@@ -40,7 +40,7 @@ public class MemberTokenServiceImpl implements MemberTokenService {
...
@@ -40,7 +40,7 @@ public class MemberTokenServiceImpl implements MemberTokenService {
try
{
try
{
member
=
memberService
.
getMemberByEmail
(
email
);
member
=
memberService
.
getMemberByEmail
(
email
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
XException
(
messages
.
get
(
"err.user_pwd_err"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_pwd_err"
));
}
}
Integer
state
=
member
.
getState
();
Integer
state
=
member
.
getState
();
if
(
state
==
1
)
{
if
(
state
==
1
)
{
...
@@ -59,12 +59,12 @@ public class MemberTokenServiceImpl implements MemberTokenService {
...
@@ -59,12 +59,12 @@ public class MemberTokenServiceImpl implements MemberTokenService {
logger
.
debug
(
"member login success: "
+
email
);
logger
.
debug
(
"member login success: "
+
email
);
return
token
;
return
token
;
}
else
{
}
else
{
throw
new
XException
(
messages
.
get
(
"err.user_pwd_err"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_pwd_err"
));
}
}
}
else
if
(
state
==
2
)
{
}
else
if
(
state
==
2
)
{
throw
new
XException
(
messages
.
get
(
"err.user_disabled"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_disabled"
));
}
else
{
}
else
{
throw
new
XException
(
messages
.
get
(
"err"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err"
));
}
}
}
}
...
...
src/main/java/com/egolm/film/api/service/impl/UserTokenServiceImpl.java
View file @
b1ae727e
...
@@ -16,7 +16,7 @@ import com.egolm.film.api.service.Messages;
...
@@ -16,7 +16,7 @@ import com.egolm.film.api.service.Messages;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.bean.Fc_user
;
import
com.egolm.film.bean.Fc_user
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.X
R
Exception
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.util.Common
;
import
com.egolm.film.util.Common
;
...
@@ -36,7 +36,7 @@ public class UserTokenServiceImpl implements UserTokenService {
...
@@ -36,7 +36,7 @@ public class UserTokenServiceImpl implements UserTokenService {
try
{
try
{
user
=
this
.
jdbcTemplate
.
queryForBean
(
"select * from fc_user where username = ?"
,
Fc_user
.
class
,
username
);
user
=
this
.
jdbcTemplate
.
queryForBean
(
"select * from fc_user where username = ?"
,
Fc_user
.
class
,
username
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
XException
(
messages
.
get
(
"err.user_pwd_err"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_pwd_err"
));
}
}
Integer
state
=
user
.
getState
();
Integer
state
=
user
.
getState
();
if
(
state
==
1
)
{
if
(
state
==
1
)
{
...
@@ -56,12 +56,12 @@ public class UserTokenServiceImpl implements UserTokenService {
...
@@ -56,12 +56,12 @@ public class UserTokenServiceImpl implements UserTokenService {
logger
.
debug
(
"user login success: "
+
username
);
logger
.
debug
(
"user login success: "
+
username
);
return
token
;
return
token
;
}
else
{
}
else
{
throw
new
XException
(
messages
.
get
(
"err.user_pwd_err"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_pwd_err"
));
}
}
}
else
if
(
state
==
2
)
{
}
else
if
(
state
==
2
)
{
throw
new
XException
(
messages
.
get
(
"err.user_disabled"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_disabled"
));
}
else
{
}
else
{
throw
new
XException
(
messages
.
get
(
"err"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err"
));
}
}
}
}
...
...
src/main/java/com/egolm/film/api/web/admin/AdminLoginController.java
View file @
b1ae727e
...
@@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
...
@@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
...
@@ -29,7 +28,7 @@ public class AdminLoginController {
...
@@ -29,7 +28,7 @@ public class AdminLoginController {
@PostMapping
(
"login"
)
@PostMapping
(
"login"
)
@ApiOperation
(
"登陆"
)
@ApiOperation
(
"登陆"
)
public
Object
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
public
Object
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
XException
.
assertNotBlank
(
"用户名或密码不能为空"
,
username
,
password
);
X
R
Exception
.
assertNotBlank
(
"用户名或密码不能为空"
,
username
,
password
);
if
(
tokenService
.
isLogin
())
{
if
(
tokenService
.
isLogin
())
{
throw
new
XRException
(
"用户已登录"
,
200
);
throw
new
XRException
(
"用户已登录"
,
200
);
}
else
{
}
else
{
...
@@ -38,7 +37,7 @@ public class AdminLoginController {
...
@@ -38,7 +37,7 @@ public class AdminLoginController {
tokenService
.
doLog
(
request
);
tokenService
.
doLog
(
request
);
return
Rjx
.
jsonOk
().
setData
(
token
);
return
Rjx
.
jsonOk
().
setData
(
token
);
}
else
{
}
else
{
throw
new
XException
(
"用户名或密码错误"
);
throw
new
X
R
Exception
(
"用户名或密码错误"
);
}
}
}
}
}
}
...
...
src/main/java/com/egolm/film/api/web/member/MemberLoginController.java
View file @
b1ae727e
...
@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
...
@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.film.api.service.MemberTokenService
;
import
com.egolm.film.api.service.MemberTokenService
;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
...
@@ -38,7 +37,7 @@ public class MemberLoginController {
...
@@ -38,7 +37,7 @@ public class MemberLoginController {
@ApiImplicitParam
(
paramType
=
"header"
,
dataType
=
"string"
,
name
=
"i18n_language"
)
@ApiImplicitParam
(
paramType
=
"header"
,
dataType
=
"string"
,
name
=
"i18n_language"
)
})
})
public
Object
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
public
Object
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
XException
.
assertNotBlank
(
messages
.
get
(
"err.user_pwd_null"
),
username
,
password
);
X
R
Exception
.
assertNotBlank
(
messages
.
get
(
"err.user_pwd_null"
),
username
,
password
);
if
(
tokenService
.
isLogin
())
{
if
(
tokenService
.
isLogin
())
{
throw
new
XRException
(
"用户已登陆"
,
200
);
throw
new
XRException
(
"用户已登陆"
,
200
);
}
else
{
}
else
{
...
@@ -47,7 +46,7 @@ public class MemberLoginController {
...
@@ -47,7 +46,7 @@ public class MemberLoginController {
tokenService
.
doLog
(
request
);
tokenService
.
doLog
(
request
);
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
();
}
else
{
}
else
{
throw
new
XException
(
messages
.
get
(
"err.user_or_pwd"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_or_pwd"
));
}
}
}
}
}
}
...
...
src/main/java/com/egolm/film/api/web/user/UserLoginController.java
View file @
b1ae727e
...
@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
...
@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
...
@@ -31,7 +30,7 @@ public class UserLoginController {
...
@@ -31,7 +30,7 @@ public class UserLoginController {
@PostMapping
(
"login"
)
@PostMapping
(
"login"
)
@ApiOperation
(
"登陆"
)
@ApiOperation
(
"登陆"
)
public
Object
login
(
String
username
,
String
password
)
{
public
Object
login
(
String
username
,
String
password
)
{
XException
.
assertNotBlank
(
messages
.
get
(
"err.user_pwd_null"
),
username
,
password
);
X
R
Exception
.
assertNotBlank
(
messages
.
get
(
"err.user_pwd_null"
),
username
,
password
);
if
(
tokenService
.
isLogin
())
{
if
(
tokenService
.
isLogin
())
{
throw
new
XRException
(
"用户已登陆"
,
200
);
throw
new
XRException
(
"用户已登陆"
,
200
);
}
else
{
}
else
{
...
@@ -39,7 +38,7 @@ public class UserLoginController {
...
@@ -39,7 +38,7 @@ public class UserLoginController {
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
return
Rjx
.
jsonOk
().
setData
(
token
);
return
Rjx
.
jsonOk
().
setData
(
token
);
}
else
{
}
else
{
throw
new
XException
(
messages
.
get
(
"err.user_or_pwd"
));
throw
new
X
R
Exception
(
messages
.
get
(
"err.user_or_pwd"
));
}
}
}
}
}
}
...
...
src/main/java/com/egolm/film/config/XRException.java
View file @
b1ae727e
...
@@ -32,4 +32,12 @@ public class XRException extends XException {
...
@@ -32,4 +32,12 @@ public class XRException extends XException {
return
rjx
;
return
rjx
;
}
}
public
static
void
assertNotBlank
(
String
message
,
Object
...
objs
)
{
for
(
Object
obj
:
objs
)
{
if
(
obj
==
null
||
obj
.
toString
().
trim
().
equals
(
""
))
{
throw
new
XException
((
message
==
null
||
message
.
trim
().
equals
(
""
))
?
"对象不能为空"
:
message
);
}
}
}
}
}
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