|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.kevinsawicki.http.HttpRequest;
|
|
|
import com.izouma.nineth.domain.AirDrop;
|
|
|
+import com.izouma.nineth.domain.Collection;
|
|
|
import com.izouma.nineth.domain.IdentityAuth;
|
|
|
import com.izouma.nineth.domain.User;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
@@ -11,6 +12,7 @@ import com.izouma.nineth.enums.AirDropType;
|
|
|
import com.izouma.nineth.enums.AuthStatus;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.AirDropRepo;
|
|
|
+import com.izouma.nineth.repo.CollectionRepo;
|
|
|
import com.izouma.nineth.repo.IdentityAuthRepo;
|
|
|
import com.izouma.nineth.repo.UserRepo;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
@@ -29,6 +31,7 @@ public class IdentityAuthService {
|
|
|
private AdapayService adapayService;
|
|
|
private AirDropService airDropService;
|
|
|
private AirDropRepo airDropRepo;
|
|
|
+ private CollectionRepo collectionRepo;
|
|
|
|
|
|
public Page<IdentityAuth> all(PageQuery pageQuery) {
|
|
|
return identityAuthRepo.findAll(JpaUtils.toSpecification(pageQuery, IdentityAuth.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
@@ -64,22 +67,25 @@ public class IdentityAuthService {
|
|
|
userRepo.findByIdAndDelFalse(user.getInvitor()).ifPresent(user1 -> {
|
|
|
user1.setInviteNum(user1.getInviteNum() + 1);
|
|
|
if (user1.getInviteNum() >= 10) {
|
|
|
- List<Long> userIds = List.of(user.getInvitor());
|
|
|
- String name = "邀请新人得空投奖励";
|
|
|
- List<AirDrop> airDrops = airDropRepo.findAllByUserIdsAndName(String.valueOf(userIds), name);
|
|
|
- if (CollUtil.isEmpty(airDrops)) {
|
|
|
- airDropService.create(AirDrop.builder()
|
|
|
- .name(name)
|
|
|
- .type(AirDropType.asset)
|
|
|
- .collectionId(1187810L)
|
|
|
- .phone(List.of(user1.getPhone()))
|
|
|
- .userIds(userIds)
|
|
|
- .projectId(1)
|
|
|
- .build());
|
|
|
- user1.setInviteAirDrop(user1.getInviteAirDrop() + 1);
|
|
|
+ // 藏品数量
|
|
|
+ Collection collection = collectionRepo.findById(1187810L)
|
|
|
+ .orElseThrow(new BusinessException("无藏品"));
|
|
|
+ if (collection.getStock() > 0) {
|
|
|
+ List<Long> userIds = List.of(user.getInvitor());
|
|
|
+ String name = "邀请新人得空投奖励";
|
|
|
+ List<AirDrop> airDrops = airDropRepo.findAllByUserIdsAndName(String.valueOf(userIds), name);
|
|
|
+ if (CollUtil.isEmpty(airDrops)) {
|
|
|
+ airDropService.create(AirDrop.builder()
|
|
|
+ .name(name)
|
|
|
+ .type(AirDropType.asset)
|
|
|
+ .collectionId(1187810L)
|
|
|
+ .phone(List.of(user1.getPhone()))
|
|
|
+ .userIds(userIds)
|
|
|
+ .projectId(1)
|
|
|
+ .build());
|
|
|
+ user1.setInviteAirDrop(user1.getInviteAirDrop() + 1);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
userRepo.save(user1);
|