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
2fb3688d
Commit
2fb3688d
authored
Aug 11, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 小程序藏品首页、详情
parent
11a76673
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
18 deletions
+26
-18
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WxWebMvcConfiguration.java
...ain/java/com/wwdz/ch/wx/config/WxWebMvcConfiguration.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+16
-9
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
...ain/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+8
-8
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WxWebMvcConfiguration.java
View file @
2fb3688d
...
@@ -30,6 +30,6 @@ public class WxWebMvcConfiguration implements WebMvcConfigurer {
...
@@ -30,6 +30,6 @@ public class WxWebMvcConfiguration implements WebMvcConfigurer {
registry
.
addInterceptor
(
loginInterceptor
())
registry
.
addInterceptor
(
loginInterceptor
())
.
addPathPatterns
(
"/**"
)
.
addPathPatterns
(
"/**"
)
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/wx/user/loginByWx"
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/wx/user/loginByWx"
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
);
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
,
"/wx/item/page"
,
"/wx/item/info"
);
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
2fb3688d
...
@@ -63,7 +63,10 @@ public class ItemServiceImpl implements ItemService {
...
@@ -63,7 +63,10 @@ public class ItemServiceImpl implements ItemService {
vo
.
setImages
(
item
.
getImages
());
vo
.
setImages
(
item
.
getImages
());
vo
.
setPrice
(
String
.
valueOf
(
item
.
getPrice
()
*
100
));
vo
.
setPrice
(
String
.
valueOf
(
item
.
getPrice
()
*
100
));
vo
.
setDetail
(
item
.
getDetail
());
vo
.
setDetail
(
item
.
getDetail
());
vo
.
setIsCollected
(
0
);
if
(!
dto
.
getUserId
().
equals
(
0L
))
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
}
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
if
(
item
.
getSourceType
().
equals
(
CommonEnum
.
SourceTypeEnum
.
USER_UPLOAD
.
getCode
()))
{
if
(
item
.
getSourceType
().
equals
(
CommonEnum
.
SourceTypeEnum
.
USER_UPLOAD
.
getCode
()))
{
count
--;
count
--;
...
@@ -154,6 +157,9 @@ public class ItemServiceImpl implements ItemService {
...
@@ -154,6 +157,9 @@ public class ItemServiceImpl implements ItemService {
}
}
itemResponseVo
.
setPrice
(
String
.
valueOf
(
item
.
getPrice
()
*
100
));
itemResponseVo
.
setPrice
(
String
.
valueOf
(
item
.
getPrice
()
*
100
));
itemResponseVo
.
setSourceType
(
item
.
getSourceType
());
itemResponseVo
.
setSourceType
(
item
.
getSourceType
());
itemResponseVo
.
setIsCollected
(
0
);
itemResponseVo
.
setIsMine
(
0
);
if
(!
dto
.
getUserId
().
equals
(
0L
))
{
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
item
.
getId
());
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
item
.
getId
());
if
(
Objects
.
nonNull
(
favoritesItemsRelation
))
{
if
(
Objects
.
nonNull
(
favoritesItemsRelation
))
{
itemResponseVo
.
setIsCollected
(
1
);
itemResponseVo
.
setIsCollected
(
1
);
...
@@ -162,6 +168,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -162,6 +168,7 @@ public class ItemServiceImpl implements ItemService {
itemResponseVo
.
setIsCollected
(
0
);
itemResponseVo
.
setIsCollected
(
0
);
}
}
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
}
logger
.
info
(
"【请求结束】查看藏品详情成功"
);
logger
.
info
(
"【请求结束】查看藏品详情成功"
);
return
Result
.
success
(
itemResponseVo
);
return
Result
.
success
(
itemResponseVo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -236,7 +243,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -236,7 +243,7 @@ public class ItemServiceImpl implements ItemService {
return
Result
.
success
();
return
Result
.
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"修改藏品失败,原因:"
+
e
.
getMessage
(),
e
);
logger
.
error
(
"修改藏品失败,原因:"
+
e
.
getMessage
(),
e
);
return
Result
.
failed
(
"
收藏
藏品失败"
);
return
Result
.
failed
(
"
修改
藏品失败"
);
}
}
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
View file @
2fb3688d
...
@@ -30,6 +30,7 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -30,6 +30,7 @@ public class LoginInterceptor implements HandlerInterceptor {
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
logger
.
info
(
"-------------进入拦截器"
);
logger
.
info
(
"-------------进入拦截器"
);
String
token
=
request
.
getHeader
(
"kl_token"
);
String
token
=
request
.
getHeader
(
"kl_token"
);
logger
.
info
(
"token的值是:"
+
token
);
if
(
StringUtils
.
isBlank
(
token
))
{
if
(
StringUtils
.
isBlank
(
token
))
{
return
true
;
return
true
;
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
2fb3688d
...
@@ -31,9 +31,6 @@ public class WxItemController {
...
@@ -31,9 +31,6 @@ public class WxItemController {
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
page
))
{
if
(
StringUtils
.
isBlank
(
page
))
{
return
Result
.
failed
(
"当前页不能为空"
);
return
Result
.
failed
(
"当前页不能为空"
);
}
}
...
@@ -42,7 +39,10 @@ public class WxItemController {
...
@@ -42,7 +39,10 @@ public class WxItemController {
}
}
ItemRequestDto
dto
=
new
ItemRequestDto
();
ItemRequestDto
dto
=
new
ItemRequestDto
();
dto
.
setUserId
(
0L
);
if
(
StringUtils
.
isNotBlank
(
userId
))
{
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
}
dto
.
setPage
(
Integer
.
parseInt
(
page
));
dto
.
setPage
(
Integer
.
parseInt
(
page
));
dto
.
setSize
(
Integer
.
parseInt
(
size
));
dto
.
setSize
(
Integer
.
parseInt
(
size
));
return
itemService
.
page
(
dto
);
return
itemService
.
page
(
dto
);
...
@@ -150,15 +150,15 @@ public class WxItemController {
...
@@ -150,15 +150,15 @@ public class WxItemController {
logger
.
info
(
"【请求开始】藏品详情查询,请求参数,kl_data:{}"
,
json
);
logger
.
info
(
"【请求开始】藏品详情查询,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
// if (StringUtils.isBlank(userId)) {
// return Result.failed("用户id不能为空");
// }
if
(
StringUtils
.
isBlank
(
id
))
{
if
(
StringUtils
.
isBlank
(
id
))
{
return
Result
.
failed
(
"当前页不能为空"
);
return
Result
.
failed
(
"当前页不能为空"
);
}
}
ItemRequestDto
dto
=
new
ItemRequestDto
();
ItemRequestDto
dto
=
new
ItemRequestDto
();
dto
.
setUserId
(
0L
);
if
(
StringUtils
.
isNotBlank
(
userId
))
{
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
}
dto
.
setId
(
Long
.
parseLong
(
id
));
dto
.
setId
(
Long
.
parseLong
(
id
));
return
itemService
.
info
(
dto
);
return
itemService
.
info
(
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