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
6100504b
Commit
6100504b
authored
Jan 18, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
c20e8def
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
16 deletions
+32
-16
TokenService.java
src/main/java/com/egolm/film/api/service/TokenService.java
+5
-2
UserTokenService.java
...ain/java/com/egolm/film/api/service/UserTokenService.java
+1
-0
AdminTokenServiceImpl.java
...om/egolm/film/api/service/impl/AdminTokenServiceImpl.java
+3
-3
MemberTokenServiceImpl.java
...m/egolm/film/api/service/impl/MemberTokenServiceImpl.java
+3
-3
UserTokenServiceImpl.java
...com/egolm/film/api/service/impl/UserTokenServiceImpl.java
+6
-4
AdminAuthController.java
...ava/com/egolm/film/api/web/admin/AdminAuthController.java
+2
-1
AdminReviewController.java
...a/com/egolm/film/api/web/admin/AdminReviewController.java
+1
-1
WebUtilController.java
.../java/com/egolm/film/api/web/admin/WebUtilController.java
+1
-1
UserLoginController.java
...java/com/egolm/film/api/web/user/UserLoginController.java
+7
-0
UserNewsController.java
.../java/com/egolm/film/api/web/user/UserNewsController.java
+3
-1
No files found.
src/main/java/com/egolm/film/api/service/TokenService.java
View file @
6100504b
package
com
.
egolm
.
film
.
api
.
service
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.slf4j.Logger
;
...
...
@@ -13,8 +15,8 @@ public interface TokenService {
LoginToken
getToken
();
Object
getTokenObj
();
Map
<
String
,
Object
>
getTokenObj
();
LoginToken
doLogin
(
String
username
,
String
password
);
void
doLogout
();
...
...
@@ -24,4 +26,5 @@ public interface TokenService {
boolean
isLoginByToken
(
String
token
);
void
doLog
(
HttpServletRequest
request
);
}
src/main/java/com/egolm/film/api/service/UserTokenService.java
View file @
6100504b
...
...
@@ -6,4 +6,5 @@ public interface UserTokenService extends TokenService {
final
String
TOKEN_NAME
=
"FILM_USER_LOGIN_TOKEN_NAME"
;
final
String
LOG_TYPE
=
"USER"
;
}
src/main/java/com/egolm/film/api/service/impl/AdminTokenServiceImpl.java
View file @
6100504b
...
...
@@ -2,6 +2,7 @@ package com.egolm.film.api.service.impl;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -77,10 +78,9 @@ public class AdminTokenServiceImpl implements AdminTokenService {
}
@Override
public
Object
getTokenObj
()
{
public
Map
<
String
,
Object
>
getTokenObj
()
{
Integer
id
=
(
Integer
)
this
.
getToken
().
getId
();
Fc_admin
obj
=
jdbcTemplate
.
queryForBean
(
"select * from fc_admin where adminid = ?"
,
Fc_admin
.
class
,
id
);
return
obj
;
return
jdbcTemplate
.
queryForMap
(
"select * from fc_admin where adminid = ?"
,
id
);
}
@Override
...
...
src/main/java/com/egolm/film/api/service/impl/MemberTokenServiceImpl.java
View file @
6100504b
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Date
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -76,10 +77,9 @@ public class MemberTokenServiceImpl implements MemberTokenService {
}
@Override
public
Object
getTokenObj
()
{
public
Map
<
String
,
Object
>
getTokenObj
()
{
Integer
id
=
(
Integer
)
this
.
getToken
().
getId
();
Fc_member
obj
=
jdbcTemplate
.
queryForBean
(
"select * from fc_member where id = ?"
,
Fc_member
.
class
,
id
);
return
obj
;
return
jdbcTemplate
.
queryForMap
(
"select * from fc_member where id = ?"
,
id
);
}
@Override
...
...
src/main/java/com/egolm/film/api/service/impl/UserTokenServiceImpl.java
View file @
6100504b
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Date
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -73,12 +74,11 @@ public class UserTokenServiceImpl implements UserTokenService {
}
@Override
public
Object
getTokenObj
()
{
public
Map
<
String
,
Object
>
getTokenObj
()
{
Integer
id
=
(
Integer
)
this
.
getToken
().
getId
();
Fc_user
obj
=
jdbcTemplate
.
queryForBean
(
"select * from fc_user where uid = ?"
,
Fc_user
.
class
,
id
);
return
obj
;
return
jdbcTemplate
.
queryForMap
(
"select u.*, ug.group_name from fc_user u left join fc_user_group ug on ug.group_id = u.group_id where u.uid = ?"
,
id
);
}
@Override
public
void
doLogout
()
{
String
sql
=
"update fc_user set token = ? where uid = ?"
;
...
...
@@ -122,4 +122,6 @@ public class UserTokenServiceImpl implements UserTokenService {
Object
[]
objs
=
new
Object
[]{
LOG_TYPE
,
loginid
,
prefix
,
path
,
ip
,
content
,
user_agent
,
now
};
jdbcTemplate
.
executeUpdate
(
sql
,
objs
);
}
}
src/main/java/com/egolm/film/api/web/admin/AdminAuthController.java
View file @
6100504b
...
...
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.Util
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.AdminAuthService
;
...
...
@@ -191,7 +192,7 @@ public class AdminAuthController {
@PostMapping
(
"adminAuth"
)
@ApiOperation
(
"当前登陆管理员权限查询"
)
public
Object
getAdminAuth
()
throws
FileNotFoundException
{
Fc_admin
admin
=
(
Fc_admin
)
tokenService
.
getTokenObj
(
);
Fc_admin
admin
=
Util
.
mapTo
(
tokenService
.
getTokenObj
(),
Fc_admin
.
class
);
List
<
Map
<
String
,
Object
>>
groupMenuList
=
service
.
queryGroupMenuList
(
admin
.
getGroup_id
());
return
Rjx
.
jsonOk
().
set
(
"admin"
,
admin
).
setData
(
groupMenuList
);
}
...
...
src/main/java/com/egolm/film/api/web/admin/AdminReviewController.java
View file @
6100504b
...
...
@@ -79,7 +79,7 @@ public class AdminReviewController {
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
Page
page
=
new
Page
(
index
,
limit
);
Fc_admin
admin
=
(
Fc_admin
)
tokenService
.
getTokenObj
(
);
Fc_admin
admin
=
Util
.
mapTo
(
tokenService
.
getTokenObj
(),
Fc_admin
.
class
);
List
<
Map
<
String
,
Object
>>
list
=
reviewService
.
queryReviewListForAdmin
(
keyword
,
admin
.
getGroup_id
(),
...
...
src/main/java/com/egolm/film/api/web/admin/WebUtilController.java
View file @
6100504b
...
...
@@ -57,7 +57,7 @@ public class WebUtilController {
@PostMapping
(
"verifyAuth"
)
@ApiOperation
(
"校验权限"
)
public
void
verifyAuth
()
{
Fc_admin
admin
=
(
Fc_admin
)
tokenService
.
getTokenObj
(
);
Fc_admin
admin
=
Util
.
mapTo
(
tokenService
.
getTokenObj
(),
Fc_admin
.
class
);
if
(!
admin
.
getUsername
().
equals
(
"admin"
))
{
throw
new
XRException
(
"权限错误"
);
}
...
...
src/main/java/com/egolm/film/api/web/user/UserLoginController.java
View file @
6100504b
...
...
@@ -51,4 +51,11 @@ public class UserLoginController {
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"info"
)
@ApiOperation
(
"查询登陆信息"
)
public
Object
info
()
{
return
Rjx
.
jsonOk
().
setData
(
tokenService
.
getTokenObj
());
}
}
src/main/java/com/egolm/film/api/web/user/UserNewsController.java
View file @
6100504b
...
...
@@ -10,10 +10,12 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.egolm.common.Util
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.NewsService
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.bean.Fc_news_read
;
import
com.egolm.film.bean.Fc_user
;
...
...
@@ -40,7 +42,7 @@ public class UserNewsController {
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
Page
page
=
new
Page
(
index
,
limit
);
Fc_user
user
=
(
Fc_user
)
tokenService
.
getTokenObj
(
);
Fc_user
user
=
Util
.
mapTo
(
tokenService
.
getTokenObj
(),
Fc_user
.
class
);
Integer
uid
=
user
.
getUid
();
Integer
gid
=
user
.
getGroup_id
();
List
<
Map
<
String
,
Object
>>
list
=
service
.
queryListForUser
(
uid
,
gid
,
page
);
...
...
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