Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
2102337c
Commit
2102337c
authored
Sep 05, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 邀请码
parent
74255868
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
77 additions
and
7 deletions
+77
-7
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesDao.java
+8
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
...in/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
+8
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesDaoImpl.java
...o/src/main/java/com/wwdz/ch/db/impl/FavoritesDaoImpl.java
+9
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
...va/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
+8
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+16
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+6
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
...ain/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
+4
-5
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
...rc/main/java/com/wwdz/ch/wx/service/FavoritesService.java
+8
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+10
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesDao.java
View file @
2102337c
...
@@ -46,6 +46,14 @@ public interface FavoritesDao {
...
@@ -46,6 +46,14 @@ public interface FavoritesDao {
*/
*/
List
<
Favorites
>
listByUserId
(
Long
userId
);
List
<
Favorites
>
listByUserId
(
Long
userId
);
/**
* 通过用户id查询记录数
*
* @param userId
* @return
*/
long
countByUserId
(
Long
userId
);
/**
/**
* 通过用户id分页查询
* 通过用户id分页查询
*
*
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
View file @
2102337c
...
@@ -115,6 +115,14 @@ public interface FavoritesItemsRelationDao {
...
@@ -115,6 +115,14 @@ public interface FavoritesItemsRelationDao {
*/
*/
long
countByFavoritesId
(
Long
favoritesId
);
long
countByFavoritesId
(
Long
favoritesId
);
/**
* 通过用户id统计记录数
*
* @param userId
* @return
*/
long
countByUserId
(
Long
userId
);
/**
/**
* 通过藏品id分组统计记录数量最多的20条记录
* 通过藏品id分组统计记录数量最多的20条记录
*
*
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesDaoImpl.java
View file @
2102337c
...
@@ -53,6 +53,15 @@ public class FavoritesDaoImpl implements FavoritesDao {
...
@@ -53,6 +53,15 @@ public class FavoritesDaoImpl implements FavoritesDao {
return
favoritesMapper
.
selectByExampleWithBLOBs
(
example
);
return
favoritesMapper
.
selectByExampleWithBLOBs
(
example
);
}
}
@Override
public
long
countByUserId
(
Long
userId
)
{
FavoritesExample
example
=
new
FavoritesExample
();
FavoritesExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andDeletedEqualTo
(
false
);
return
favoritesMapper
.
countByExample
(
example
);
}
@Override
@Override
public
PageInfo
<
Favorites
>
pageByUserId
(
Long
userId
,
int
page
,
int
size
)
{
public
PageInfo
<
Favorites
>
pageByUserId
(
Long
userId
,
int
page
,
int
size
)
{
FavoritesExample
example
=
new
FavoritesExample
();
FavoritesExample
example
=
new
FavoritesExample
();
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
View file @
2102337c
...
@@ -124,6 +124,14 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -124,6 +124,14 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
return
favoritesItemsRelationMapper
.
countByExample
(
example
);
return
favoritesItemsRelationMapper
.
countByExample
(
example
);
}
}
@Override
public
long
countByUserId
(
Long
userId
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
userId
,
criteria:
:
andUserIdEqualTo
);
return
favoritesItemsRelationMapper
.
countByExample
(
example
);
}
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
findItemIdByCount
()
{
public
List
<
Map
<
String
,
Object
>>
findItemIdByCount
()
{
return
favoritesItemsRelationMapper
.
selectItemIdByCount
();
return
favoritesItemsRelationMapper
.
selectItemIdByCount
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
2102337c
...
@@ -197,6 +197,22 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -197,6 +197,22 @@ public class FavoritesServiceImpl implements FavoritesService {
}
}
}
}
@Override
public
Result
favoritesNum
(
FavoritesRequestDto
dto
)
{
try
{
long
itemNum
=
favoritesItemsRelationDao
.
countByUserId
(
dto
.
getUserId
());
long
favoritesNum
=
favoritesDao
.
countByUserId
(
dto
.
getUserId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"itemNum"
,
itemNum
);
map
.
put
(
"favoritesNum"
,
favoritesNum
);
logger
.
info
(
"【请求结束】收藏品和收藏册数量查询成功"
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"收藏品和收藏册数量查询失败,原因:"
+
e
.
getMessage
(),
e
);
return
Result
.
failed
(
"收藏品和收藏册数量查询失败"
);
}
}
@Override
@Override
public
Result
itemList
(
FavoritesRequestDto
dto
)
{
public
Result
itemList
(
FavoritesRequestDto
dto
)
{
try
{
try
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
2102337c
...
@@ -22,6 +22,7 @@ import com.wwdz.ch.wx.manager.AlipayLoginManager;
...
@@ -22,6 +22,7 @@ import com.wwdz.ch.wx.manager.AlipayLoginManager;
import
com.wwdz.ch.wx.manager.TikTokLoginManager
;
import
com.wwdz.ch.wx.manager.TikTokLoginManager
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.service.InviteRecordService
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.wwdz.ch.wx.util.IpUtil
;
import
com.wwdz.ch.wx.util.IpUtil
;
import
com.wwdz.ch.wx.util.RedisUtil
;
import
com.wwdz.ch.wx.util.RedisUtil
;
...
@@ -70,6 +71,9 @@ public class UserServiceImpl implements UserService {
...
@@ -70,6 +71,9 @@ public class UserServiceImpl implements UserService {
@Autowired
@Autowired
private
AliSmsSender
aliSmsSender
;
private
AliSmsSender
aliSmsSender
;
@Autowired
private
InviteRecordService
inviteRecordService
;
@Override
@Override
public
Result
regCaptcha
(
UserRequestDto
dto
)
{
public
Result
regCaptcha
(
UserRequestDto
dto
)
{
...
@@ -124,7 +128,7 @@ public class UserServiceImpl implements UserService {
...
@@ -124,7 +128,7 @@ public class UserServiceImpl implements UserService {
}
}
// 获取登录结果
// 获取登录结果
Map
<
String
,
Object
>
result
=
getLoginResult
(
dto
.
getMobile
(),
request
);
Map
<
String
,
Object
>
result
=
getLoginResult
(
dto
.
getMobile
(),
request
);
result
.
put
(
"isInvited"
,
inviteRecordService
.
isExisted
(
dto
.
getMobile
()).
getData
());
logger
.
info
(
"【请求结束】手机号登录,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
logger
.
info
(
"【请求结束】手机号登录,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
// 清除验证码缓存
// 清除验证码缓存
redisUtil
.
del
(
key
);
redisUtil
.
del
(
key
);
...
@@ -179,7 +183,7 @@ public class UserServiceImpl implements UserService {
...
@@ -179,7 +183,7 @@ public class UserServiceImpl implements UserService {
}
}
// 获取登录结果
// 获取登录结果
Map
<
String
,
Object
>
result
=
getLoginResult
(
mobile
,
request
);
Map
<
String
,
Object
>
result
=
getLoginResult
(
mobile
,
request
);
result
.
put
(
"isInvited"
,
inviteRecordService
.
isExisted
(
dto
.
getMobile
()).
getData
());
logger
.
info
(
"【请求结束】快捷登录成功,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
logger
.
info
(
"【请求结束】快捷登录成功,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
return
Result
.
success
(
result
);
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
View file @
2102337c
...
@@ -66,15 +66,14 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -66,15 +66,14 @@ public class LoginInterceptor implements HandlerInterceptor {
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
}
else
{
}
else
{
if
(
StringUtils
.
equals
(
url
,
"/wx/user/fillCode"
))
{
return
true
;
}
Integer
loginType
=
1
;
Integer
loginType
=
1
;
if
(
StringUtils
.
isBlank
(
token
))
{
if
(
StringUtils
.
isBlank
(
token
))
{
loginType
=
2
;
loginType
=
2
;
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
token
))
{
if
(
userTokenManager
.
checkLogin
(
token
))
{
if
(
userTokenManager
.
checkLogin
(
token
))
{
if
(
StringUtils
.
equals
(
url
,
"/wx/user/fillCode"
))
{
return
true
;
}
User
user
=
userDao
.
queryById
(
userTokenManager
.
getUserId
(
token
));
User
user
=
userDao
.
queryById
(
userTokenManager
.
getUserId
(
token
));
if
(!(
Boolean
)
inviteRecordService
.
isExisted
(
user
.
getMobile
()).
getData
())
{
if
(!(
Boolean
)
inviteRecordService
.
isExisted
(
user
.
getMobile
()).
getData
())
{
loginType
=
3
;
loginType
=
3
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
View file @
2102337c
...
@@ -45,6 +45,14 @@ public interface FavoritesService {
...
@@ -45,6 +45,14 @@ public interface FavoritesService {
*/
*/
Result
info
(
FavoritesRequestDto
dto
);
Result
info
(
FavoritesRequestDto
dto
);
/**
* 收藏品和收藏册数量
*
* @param dto
* @return
*/
Result
favoritesNum
(
FavoritesRequestDto
dto
);
/**
/**
* 收藏册下藏品列表
* 收藏册下藏品列表
*
*
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
2102337c
...
@@ -103,6 +103,16 @@ public class WxFavoritesController {
...
@@ -103,6 +103,16 @@ public class WxFavoritesController {
return
favoritesService
.
info
(
dto
);
return
favoritesService
.
info
(
dto
);
}
}
@ApiOperation
(
value
=
"收藏品和收藏册数量"
)
@PostMapping
(
"/favoritesNum"
)
public
Result
favoritesNum
(
@RequestBody
FavoritesRequestDto
dto
)
{
logger
.
info
(
"【请求开始】收藏品和收藏册数量查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
return
favoritesService
.
favoritesNum
(
dto
);
}
@ApiOperation
(
value
=
"收藏册下藏品列表"
)
@ApiOperation
(
value
=
"收藏册下藏品列表"
)
@PostMapping
(
"/itemList"
)
@PostMapping
(
"/itemList"
)
public
Result
itemList
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
itemList
(
@RequestBody
FavoritesRequestDto
dto
)
{
...
...
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