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
2d5f6c08
Commit
2d5f6c08
authored
Aug 04, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取与删除cookie
parent
8626022c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
ShopController.java
...gec/browserbackend/browser/controller/ShopController.java
+22
-0
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+13
-0
ShopService.java
...com/edgec/browserbackend/browser/service/ShopService.java
+4
-0
No files found.
src/main/java/com/edgec/browserbackend/browser/controller/ShopController.java
View file @
2d5f6c08
...
...
@@ -232,6 +232,28 @@ public class ShopController {
}
/**
* 获取cookie
*/
@GetMapping
(
"/cookie/{shopId}"
)
public
ResultDto
getShopCookie
(
@PathVariable
String
shopId
)
{
String
cookie
=
shopService
.
queryShopCookieById
(
shopId
);
ResultDto
resultDto
=
new
ResultDto
();
resultDto
.
setStatus
(
0
);
resultDto
.
setData
(
cookie
);
return
resultDto
;
}
/**
* 删除cookie
*/
@DeleteMapping
(
"/cookie/{shopId}"
)
public
void
delShopCookie
(
@PathVariable
String
shopId
)
{
shopService
.
deleteShopCookieById
(
shopId
);
}
private
void
dealClientRequestException
(
ResultDto
resultDto
,
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
2d5f6c08
...
...
@@ -649,6 +649,19 @@ public class ShopServiceImpl implements ShopService {
return
result
;
}
@Override
public
String
queryShopCookieById
(
String
id
)
{
Shop
shop
=
shopRepository
.
findById
(
id
).
orElseThrow
(()
->
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
));
return
shop
.
getShopCookie
();
}
@Override
public
void
deleteShopCookieById
(
String
id
)
{
Shop
shop
=
shopRepository
.
findById
(
id
).
orElseThrow
(()
->
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
));
shop
.
setShopCookie
(
""
);
shopRepository
.
save
(
shop
);
}
private
String
getShopId
(
String
username
,
ShopResultDto
shopResultDto
)
{
Shop
shop
=
new
Shop
();
shopResultDto
.
setOwner
(
username
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/ShopService.java
View file @
2d5f6c08
...
...
@@ -34,4 +34,8 @@ public interface ShopService {
List
<
String
>
getBatchShopUsers
(
String
username
,
List
<
String
>
shopIds
);
Integer
dealDirtyData
();
String
queryShopCookieById
(
String
id
);
void
deleteShopCookieById
(
String
id
);
}
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