From 405cf58262f261efb387f144bd33eb93cd00be13 Mon Sep 17 00:00:00 2001 From: aaron Date: Sun, 10 Dec 2023 23:28:32 +0800 Subject: [PATCH] feat(share):address --- interface/share.json | 9 ++++----- .../sharing/controller/UserSharingController.java | 12 ++++++------ .../dl/officialsite/sharing/model/db/TbShare.java | 8 ++++---- .../sharing/service/IUserSharingService.java | 6 +++--- .../service/impl/DefaultSharingServiceImpl.java | 8 ++++---- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/interface/share.json b/interface/share.json index 938b3bca..5895cf4b 100644 --- a/interface/share.json +++ b/interface/share.json @@ -1,6 +1,6 @@ [ { - "url": "http://43.135.22.107:8080/share/usershare/create", + "url": "http://43.135.22.107:8080/share/usershare/create?address=0xabc", "method": "POST", "body": { "theme": "主题", @@ -11,8 +11,7 @@ "org": "所属组织", "twitter": "分享人推特", "sharingDoc": "分享链接", - "label": "标签类别", - "memberId": "分享人id" + "label": "标签类别" }, "response": { @@ -22,7 +21,7 @@ } }, { - "url": "http:/43.135.22.107:8080/share/usershare/update", + "url": "http:/43.135.22.107:8080/share/usershare/update?address=0xabc", "method": "POST", "body": { "id":"分享id,如111", @@ -44,7 +43,7 @@ } }, { - "url": "http://43.135.22.107:8080/share/usershare/delete?shareId=111", + "url": "http://43.135.22.107:8080/share/usershare/delete?shareId=111&address=0xabc", "method": "POST", "response": { diff --git a/src/main/java/com/dl/officialsite/sharing/controller/UserSharingController.java b/src/main/java/com/dl/officialsite/sharing/controller/UserSharingController.java index 75bf6c89..7f802ec8 100644 --- a/src/main/java/com/dl/officialsite/sharing/controller/UserSharingController.java +++ b/src/main/java/com/dl/officialsite/sharing/controller/UserSharingController.java @@ -30,16 +30,16 @@ public class UserSharingController { * @return */ @PostMapping("create") - public BaseResponse createSharing(@RequestBody CreateSharingReq req){ - return BaseResponse.successWithData(this.userSharingService.createSharing(req)); + public BaseResponse createSharing(@RequestBody CreateSharingReq req, @RequestParam("address") String address){ + return BaseResponse.successWithData(this.userSharingService.createSharing(req, address)); } /** * 修改分享 */ @PostMapping("update") - public BaseResponse updateSharing(@RequestBody UpdateSharingReq req){ - this.userSharingService.updateSharing(req); + public BaseResponse updateSharing(@RequestBody UpdateSharingReq req, @RequestParam("address") String address){ + this.userSharingService.updateSharing(req, address); return BaseResponse.success(); } @@ -47,8 +47,8 @@ public BaseResponse updateSharing(@RequestBody UpdateSharingReq req){ * 删除分享 */ @PostMapping("delete") - public BaseResponse deleteSharing(@RequestParam("shareId") long shareId){ - this.userSharingService.deleteSharing(shareId); + public BaseResponse deleteSharing(@RequestParam("shareId") long shareId, @RequestParam("address") String address){ + this.userSharingService.deleteSharing(shareId, address); return BaseResponse.success(); } diff --git a/src/main/java/com/dl/officialsite/sharing/model/db/TbShare.java b/src/main/java/com/dl/officialsite/sharing/model/db/TbShare.java index 82e32da4..004e40bf 100644 --- a/src/main/java/com/dl/officialsite/sharing/model/db/TbShare.java +++ b/src/main/java/com/dl/officialsite/sharing/model/db/TbShare.java @@ -26,12 +26,12 @@ public class TbShare { private String theme; /** - * 分享日期 + * 分享日期,2020-12-02 */ private String date; /** - * 分享时间(UTC+8) + * 分享时间 20:00(UTC+8) */ private String time; @@ -58,8 +58,8 @@ public class TbShare { /** * 分享人 */ - @Column(name = "member_id") - private long memberId; + @Column(name = "member_address") + private String memberAddress; /** * 文档连接 diff --git a/src/main/java/com/dl/officialsite/sharing/service/IUserSharingService.java b/src/main/java/com/dl/officialsite/sharing/service/IUserSharingService.java index de38d9ca..6d07da69 100644 --- a/src/main/java/com/dl/officialsite/sharing/service/IUserSharingService.java +++ b/src/main/java/com/dl/officialsite/sharing/service/IUserSharingService.java @@ -16,17 +16,17 @@ public interface IUserSharingService { * @param req * @return */ - long createSharing(CreateSharingReq req); + long createSharing(CreateSharingReq req, String address); /** * 修改分享 */ - void updateSharing(UpdateSharingReq req); + void updateSharing(UpdateSharingReq req, String address); /** * 删除分享 */ - void deleteSharing(long shareId); + void deleteSharing(long shareId,String address); /** diff --git a/src/main/java/com/dl/officialsite/sharing/service/impl/DefaultSharingServiceImpl.java b/src/main/java/com/dl/officialsite/sharing/service/impl/DefaultSharingServiceImpl.java index eee1258a..af0a3d6e 100644 --- a/src/main/java/com/dl/officialsite/sharing/service/impl/DefaultSharingServiceImpl.java +++ b/src/main/java/com/dl/officialsite/sharing/service/impl/DefaultSharingServiceImpl.java @@ -41,7 +41,7 @@ public class DefaultSharingServiceImpl implements IUserSharingService { private HttpServletRequest request; @Override - public long createSharing(CreateSharingReq req) { + public long createSharing(CreateSharingReq req, String address) { /** * 登陆用户转member */ @@ -61,7 +61,7 @@ public long createSharing(CreateSharingReq req) { entity.setPresenter(req.getPresenter()); entity.setOrg(req.getOrg()); entity.setTwitter(req.getTwitter()); - entity.setMemberId(req.getMemberId()); + entity.setMemberAddress(address); entity.setSharingDoc(req.getSharingDoc()); entity.setLabel(req.getLabel()); entity.setLockStatus(SharingLockStatus.UNLOCKED.getCode()); @@ -71,7 +71,7 @@ public long createSharing(CreateSharingReq req) { @Override - public void updateSharing(UpdateSharingReq req) { + public void updateSharing(UpdateSharingReq req, String address) { //Verify Optional existed = this.sharingRepository.findById(req.getId()); if(!existed.isPresent()){ @@ -105,7 +105,7 @@ public void updateSharing(UpdateSharingReq req) { } @Override - public void deleteSharing(long shareId) { + public void deleteSharing(long shareId, String address) { //Verify Optional existed = this.sharingRepository.findById(shareId); if(!existed.isPresent()){