Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
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
Administrator
browser-backend
Commits
da7dcd0c
Commit
da7dcd0c
authored
Sep 19, 2020
by
xuxinpc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收藏夹相关接口 移除校验
parent
5d86aa5a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
26 deletions
+12
-26
TempController.java
...gec/browserbackend/browser/controller/TempController.java
+6
-7
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+3
-16
ShopService.java
...com/edgec/browserbackend/browser/service/ShopService.java
+3
-3
No files found.
src/main/java/com/edgec/browserbackend/browser/controller/TempController.java
View file @
da7dcd0c
...
...
@@ -9,7 +9,6 @@ import com.edgec.browserbackend.common.commons.error.ClientRequestException;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.security.Principal
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -44,10 +43,10 @@ public class TempController {
* 店铺收藏夹
*/
@GetMapping
(
"/favorites/{shopId}"
)
public
ResultDto
getFavoritesByShopId
(
Principal
principal
,
@PathVariable
(
"shopId"
)
String
shopId
)
{
public
ResultDto
getFavoritesByShopId
(
@PathVariable
(
"shopId"
)
String
shopId
)
{
ResultDto
resultDto
=
new
ResultDto
();
try
{
List
<
FavoriteUrl
>
list
=
shopService
.
getFavoritesByShopId
(
principal
.
getName
(),
shopId
);
List
<
FavoriteUrl
>
list
=
shopService
.
getFavoritesByShopId
(
shopId
);
resultDto
.
setData
(
list
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
...
...
@@ -60,10 +59,10 @@ public class TempController {
* 店铺收藏夹 删除收藏
*/
@DeleteMapping
(
"/favorites/{shopId}"
)
public
ResultDto
deleteFavoritesByShopId
(
Principal
principal
,
@PathVariable
(
"shopId"
)
String
shopId
,
@RequestBody
FavoriteUrl
favoriteUrl
)
{
public
ResultDto
deleteFavoritesByShopId
(
@PathVariable
(
"shopId"
)
String
shopId
,
@RequestBody
FavoriteUrl
favoriteUrl
)
{
ResultDto
resultDto
=
new
ResultDto
();
try
{
resultDto
.
setData
(
shopService
.
deleteFavoritesByShopId
(
principal
.
getName
(),
shopId
,
favoriteUrl
));
resultDto
.
setData
(
shopService
.
deleteFavoritesByShopId
(
shopId
,
favoriteUrl
));
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
dealClientRequestException
(
resultDto
,
e
);
...
...
@@ -75,10 +74,10 @@ public class TempController {
* 店铺收藏夹 新增收藏
*/
@PostMapping
(
"/favorites/{shopId}"
)
public
ResultDto
saveFavoritesByShopId
(
Principal
principal
,
@PathVariable
(
"shopId"
)
String
shopId
,
@RequestBody
FavoriteUrl
favoriteUrl
)
{
public
ResultDto
saveFavoritesByShopId
(
@PathVariable
(
"shopId"
)
String
shopId
,
@RequestBody
FavoriteUrl
favoriteUrl
)
{
ResultDto
resultDto
=
new
ResultDto
();
try
{
resultDto
.
setData
(
shopService
.
saveFavoritesByShopId
(
principal
.
getName
(),
shopId
,
favoriteUrl
));
resultDto
.
setData
(
shopService
.
saveFavoritesByShopId
(
shopId
,
favoriteUrl
));
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
dealClientRequestException
(
resultDto
,
e
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
da7dcd0c
...
...
@@ -685,31 +685,18 @@ public class ShopServiceImpl implements ShopService {
}
@Override
public
List
<
FavoriteUrl
>
getFavoritesByShopId
(
String
name
,
String
shopId
)
{
UserShop
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
name
,
shopId
);
if
(
userShop
==
null
)
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
);
}
public
List
<
FavoriteUrl
>
getFavoritesByShopId
(
String
shopId
)
{
Shop
shop
=
shopRepository
.
findById
(
shopId
).
orElseThrow
(()
->
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
));
return
shop
.
getFavoritesUrls
();
}
@Override
public
boolean
saveFavoritesByShopId
(
String
name
,
String
shopId
,
FavoriteUrl
favoriteUrl
)
{
UserShop
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
name
,
shopId
);
if
(
userShop
==
null
)
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
);
}
public
boolean
saveFavoritesByShopId
(
String
shopId
,
FavoriteUrl
favoriteUrl
)
{
return
shopRepository
.
saveFavoritesUrls
(
shopId
,
favoriteUrl
);
}
@Override
public
boolean
deleteFavoritesByShopId
(
String
name
,
String
shopId
,
FavoriteUrl
favoriteUrl
)
{
UserShop
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
name
,
shopId
);
if
(
userShop
==
null
)
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
);
}
public
boolean
deleteFavoritesByShopId
(
String
shopId
,
FavoriteUrl
favoriteUrl
)
{
return
shopRepository
.
deleteFavoritesByShopId
(
shopId
,
favoriteUrl
);
}
...
...
src/main/java/com/edgec/browserbackend/browser/service/ShopService.java
View file @
da7dcd0c
...
...
@@ -40,9 +40,9 @@ public interface ShopService {
Integer
deleteShopCookieById
(
String
id
);
boolean
saveFavoritesByShopId
(
String
name
,
String
shopId
,
FavoriteUrl
favoriteUrl
);
boolean
saveFavoritesByShopId
(
String
shopId
,
FavoriteUrl
favoriteUrl
);
boolean
deleteFavoritesByShopId
(
String
name
,
String
shopId
,
FavoriteUrl
favoriteUrl
);
boolean
deleteFavoritesByShopId
(
String
shopId
,
FavoriteUrl
favoriteUrl
);
List
<
FavoriteUrl
>
getFavoritesByShopId
(
String
name
,
String
shopId
);
List
<
FavoriteUrl
>
getFavoritesByShopId
(
String
shopId
);
}
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