Skip to content

Commit

Permalink
Merge pull request #78 from Dapp-Learning-DAO/feature/arc_share
Browse files Browse the repository at this point in the history
feat(share):address
  • Loading branch information
arc0035 authored Dec 10, 2023
2 parents d2ee705 + 405cf58 commit 5f2b4ad
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
9 changes: 4 additions & 5 deletions interface/share.json
Original file line number Diff line number Diff line change
@@ -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": "主题",
Expand All @@ -11,8 +11,7 @@
"org": "所属组织",
"twitter": "分享人推特",
"sharingDoc": "分享链接",
"label": "标签类别",
"memberId": "分享人id"
"label": "标签类别"
},
"response":
{
Expand All @@ -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",
Expand All @@ -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":
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ public class UserSharingController {
* @return
*/
@PostMapping("create")
public BaseResponse<Long> createSharing(@RequestBody CreateSharingReq req){
return BaseResponse.successWithData(this.userSharingService.createSharing(req));
public BaseResponse<Long> 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();
}

/**
* 删除分享
*/
@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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -58,8 +58,8 @@ public class TbShare {
/**
* 分享人
*/
@Column(name = "member_id")
private long memberId;
@Column(name = "member_address")
private String memberAddress;

/**
* 文档连接
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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());
Expand All @@ -71,7 +71,7 @@ public long createSharing(CreateSharingReq req) {


@Override
public void updateSharing(UpdateSharingReq req) {
public void updateSharing(UpdateSharingReq req, String address) {
//Verify
Optional<TbShare> existed = this.sharingRepository.findById(req.getId());
if(!existed.isPresent()){
Expand Down Expand Up @@ -105,7 +105,7 @@ public void updateSharing(UpdateSharingReq req) {
}

@Override
public void deleteSharing(long shareId) {
public void deleteSharing(long shareId, String address) {
//Verify
Optional<TbShare> existed = this.sharingRepository.findById(shareId);
if(!existed.isPresent()){
Expand Down

0 comments on commit 5f2b4ad

Please sign in to comment.