|
|
@@ -49,7 +49,7 @@ public class AirDropService {
|
|
|
if (collection.isSalable()) {
|
|
|
throw new BusinessException("请先设置藏品为不可购买");
|
|
|
}
|
|
|
- if (collection.getStock() < record.getUserIds().size()) {
|
|
|
+ if (!record.isIgnoreStockCheck() && collection.getStock() < record.getUserIds().size()) {
|
|
|
throw new BusinessException("藏品库存不足");
|
|
|
}
|
|
|
List<User> users = userRepo.findByIdInAndDelFalse(record.getUserIds());
|
|
|
@@ -57,10 +57,21 @@ public class AirDropService {
|
|
|
try {
|
|
|
if (collection.getType() == CollectionType.BLIND_BOX) {
|
|
|
BlindBoxItem winItem = collectionService.draw(collection.getId());
|
|
|
- assetService.createAsset(winItem, user, null, null, "空投",
|
|
|
- collectionService.getNextNumber(winItem.getCollectionId()), collection.getHoldDays());
|
|
|
+ if (record.isSimulateOrder()) {
|
|
|
+ assetService.createAsset(winItem, user, 0L, collection.getPrice(), "出售",
|
|
|
+ winItem.getTotal() > 1 ? collectionService.getNextNumber(winItem.getCollectionId()) : null,
|
|
|
+ collection.getHoldDays());
|
|
|
+ } else {
|
|
|
+ assetService.createAsset(winItem, user, null, null, "空投",
|
|
|
+ collectionService.getNextNumber(winItem.getCollectionId()), collection.getHoldDays());
|
|
|
+ }
|
|
|
} else {
|
|
|
- assetService.createAsset(collection, user, null, null, "空投", collectionService.getNextNumber(collection.getId()));
|
|
|
+ if (record.isSimulateOrder()) {
|
|
|
+ assetService.createAsset(collection, user, 0L, collection.getPrice(), "出售",
|
|
|
+ collection.getTotal() > 1 ? collectionService.getNextNumber(collection.getId()) : null);
|
|
|
+ } else {
|
|
|
+ assetService.createAsset(collection, user, null, null, "空投", collectionService.getNextNumber(collection.getId()));
|
|
|
+ }
|
|
|
}
|
|
|
collectionService.decreaseStock(collection.getId(), 1);
|
|
|
collectionService.increaseSale(collection.getId(), 1);
|