Skip to content

Commit

Permalink
Merge branch 'main' of github.com:leeqiang250/billion
Browse files Browse the repository at this point in the history
* 'main' of github.com:leeqiang250/billion:
  修改operation记录
  optservice
  operation
  deadts
  • Loading branch information
leeqiang250 committed Oct 28, 2022
2 parents 36f3c47 + 84ce818 commit 9d636e0
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 33 deletions.
167 changes: 166 additions & 1 deletion doc-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -865,4 +865,169 @@ data说明:unSale为未售卖,onSale为售卖中
"BoxTakerEvent", "盲盒吃单"
"BoxBidEvent", "盲盒拍卖报价"
"BoxCancelEvent", "盲盒取消挂单"
"BoxOpenEvent", "开盲盒"
"BoxOpenEvent", "开盲盒"


### 查询我的出售记录接口

| 方法 | GET |
|----|----|
| 路径 |/aptos/kiko/v1/operation//getSaleRecord/{account} |

`{
"code": 200,
"ts": 1666749260915,
"msg": "success",
"data": [
{
"id": 321,
"chain": "aptos",
"maker": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTMintEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
},
{
"id": 322,
"chain": "aptos",
"maker": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTDepositEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
},
{
"id": 323,
"chain": "aptos",
"maker": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTWithDrawEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
},
{
"id": 348,
"chain": "aptos",
"maker": "0x6aa217b5b89f6ba3ed515fa7df7761e3b9908330fb85c1bfd362a7e6939fb16c",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTDepositEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
}
]
}`

### 查询我的购买记录接口

| 方法 | GET |
|----|----|
| 路径 |/aptos/kiko/v1/operation/getBuyRecord/{account} |

`{
"code": 200,
"ts": 1666749260915,
"msg": "success",
"data": [
{
"id": 321,
"chain": "aptos",
"maker": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTMintEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
},
{
"id": 322,
"chain": "aptos",
"maker": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTDepositEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
},
{
"id": 323,
"chain": "aptos",
"maker": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTWithDrawEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
},
{
"id": 348,
"chain": "aptos",
"maker": "0x6aa217b5b89f6ba3ed515fa7df7761e3b9908330fb85c1bfd362a7e6939fb16c",
"bidder": null,
"orderId": null,
"traType": null,
"type": "NFTDepositEvent",
"tokenId": "0xa9e93a5297a5ee85445c52daabf0d7a8cf92f770a12e3a621690d050b2bd7e5d@0xe5908de7a7b0313030313131323533@0x30382de68f8fe8bfb03230303030303037313234@0",
"tokenAmount": 1,
"bidToken": null,
"bidTokenAmount": null,
"price": "0",
"state": null,
"ts": "",
"url": "http://52.77.131.111:8890/aptos/kiko/v1/image/281"
}
]
}`
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ public MyBoxDto getBoxById(Context context, String boxGroupId, String account, S
myBoxDto.setBidPrice(market.getBidAmount());
myBoxDto.setTs(market.getTs());
myBoxDto.setOwner(market.getMaker());
myBoxDto.setDeadTs(market.getDeadTs());
myBoxDto.setAuctionPrice(market.getBidAmount());
if (StringUtils.isNotEmpty(market.getBidToken())) {
String[] tokenInfo = market.getBidToken().split("::");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.billion.service.aptos.kiko;

import com.aptos.request.v1.model.Event;
import com.aptos.request.v1.model.Response;
import com.aptos.request.v1.model.Transaction;
import com.baomidou.mybatisplus.extension.service.IService;
import com.billion.model.dto.Context;
Expand Down Expand Up @@ -39,20 +38,30 @@ public interface OperationService extends IService<Operation> {
Operation addNftBidOpt(Transaction transaction, Event event, MarketBidEvent nftBidEvent);

Operation addNftCancelOpt(Transaction transaction, Event event, MarketCancelEvent nftCancelEvent);
/**
* addOpenBoxOpt
* @param openBoxEvent
* @param transaction
*/
public void addOpenBoxOpt(OpenBoxEvent openBoxEvent, Transaction transaction);

void addOpenBoxOpt(OpenBoxEvent openBoxEvent, Transaction transaction);

/**
* getListById
* @param context
* @param tokenId
* @return
*/
public List<OperationDto> getListById(Context context, String tokenId);
List<OperationDto> getListById(Context context, String tokenId);

public List<OperationDto> getSaleRecord(Context context, String account);
public List<OperationDto> getBuyRecord(Context context, String account);
/**
* getSaleRecord
* @param context
* @param account
* @return
*/
List<OperationDto> getSaleRecord(Context context, String account);

/**
* getBuyRecord
* @param context
* @param account
* @return
*/
List<OperationDto> getBuyRecord(Context context, String account);
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Operation addBoxMakerOpt(Transaction transaction, Event event, BoxMakerEv
.tokenId(event.getType().split("<")[1].split(">")[0].split(",")[0].trim())
.tokenAmount(boxMakerEvent.getAmount())
.price(boxMakerEvent.getPrice())
.bidToken(EMPTY)
.bidToken(event.getType().split("<")[1].split(">")[0].split(",")[1].trim())
.bidTokenAmount(EMPTY)
.state(OperationTraStateType.SELL.getType())
.ts(boxMakerEvent.getTs())
Expand Down Expand Up @@ -412,35 +412,47 @@ public List<OperationDto> getSaleRecord(Context context, String account) {
QueryWrapper<Operation> operationQueryWrapper = new QueryWrapper<>();
operationQueryWrapper.lambda().eq(Operation::getChain, context.getChain());
operationQueryWrapper.lambda().eq(Operation::getMaker, account);
operationQueryWrapper.lambda().ne(Operation::getState, OperationTraStateType.SELL_CANCEL.getType());
operationQueryWrapper.lambda().and(wrapper -> {
wrapper.and(w1 -> {
w1.or(w2 -> {
w2.eq(Operation::getType, OperationType.BOX_MAKER_EVENT.getType())
.and(w3 -> {
w3.eq(Operation::getState, OperationTraStateType.SELL.getType());
});
});
w1.or(w4 -> {
w4.eq(Operation::getType, OperationType.BOX_MAKER_EVENT.getType())
.and(w5 -> {
w5.eq(Operation::getState, OperationTraStateType.DONE.getType());
});
w2.eq(Operation::getType, OperationType.BOX_MAKER_EVENT.getType());
});
w1.or(w6 -> {
w6.eq(Operation::getType, OperationType.NFT_MAKER_EVENT.getType())
.and(w7 -> {
w7.eq(Operation::getState, OperationTraStateType.SELL.getType());
});
});
w1.or(w8 -> {
w8.eq(Operation::getType, OperationType.NFT_MAKER_EVENT.getType())
.and(w9 -> {
w9.eq(Operation::getState, OperationTraStateType.DONE.getType());
});
w1.or(w4 -> {
w4.eq(Operation::getType, OperationType.NFT_MAKER_EVENT.getType());
});
});
});

// operationQueryWrapper.lambda().and(wrapper -> {
// wrapper.and(w1 -> {
// w1.or(w2 -> {
// w2.eq(Operation::getType, OperationType.BOX_MAKER_EVENT.getType())
// .and(w3 -> {
// w3.eq(Operation::getState, OperationTraStateType.SELL.getType());
// });
// });
// w1.or(w4 -> {
// w4.eq(Operation::getType, OperationType.BOX_MAKER_EVENT.getType())
// .and(w5 -> {
// w5.eq(Operation::getState, OperationTraStateType.DONE.getType());
// });
// });
// w1.or(w6 -> {
// w6.eq(Operation::getType, OperationType.NFT_MAKER_EVENT.getType())
// .and(w7 -> {
// w7.eq(Operation::getState, OperationTraStateType.SELL.getType());
// });
// });
// w1.or(w8 -> {
// w8.eq(Operation::getType, OperationType.NFT_MAKER_EVENT.getType())
// .and(w9 -> {
// w9.eq(Operation::getState, OperationTraStateType.DONE.getType());
// });
// });
// });
// });

operationQueryWrapper.lambda().orderByDesc(Operation::getId);
var operationList = this.list(operationQueryWrapper);

Expand Down

0 comments on commit 9d636e0

Please sign in to comment.