|
|
@@ -1,5 +1,6 @@
|
|
|
package com.izouma.nineth.service;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.kevinsawicki.http.HttpRequest;
|
|
|
import com.izouma.nineth.domain.AirDrop;
|
|
|
@@ -9,6 +10,7 @@ import com.izouma.nineth.dto.PageQuery;
|
|
|
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.IdentityAuthRepo;
|
|
|
import com.izouma.nineth.repo.UserRepo;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
@@ -26,6 +28,7 @@ public class IdentityAuthService {
|
|
|
private UserRepo userRepo;
|
|
|
private AdapayService adapayService;
|
|
|
private AirDropService airDropService;
|
|
|
+ private AirDropRepo airDropRepo;
|
|
|
|
|
|
public Page<IdentityAuth> all(PageQuery pageQuery) {
|
|
|
return identityAuthRepo.findAll(JpaUtils.toSpecification(pageQuery, IdentityAuth.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
@@ -60,18 +63,25 @@ public class IdentityAuthService {
|
|
|
if (user.getInvitor() != null) {
|
|
|
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(user.getInvitor()), 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);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- if (user1.getInviteNum() / 10 > user1.getInviteAirDrop()) {
|
|
|
- airDropService.create(AirDrop.builder()
|
|
|
- .name("邀请新人得空投奖励")
|
|
|
- .type(AirDropType.asset)
|
|
|
- .collectionId(1187810L)
|
|
|
- .phone(List.of(user1.getPhone()))
|
|
|
- .userIds(List.of(user.getInvitor()))
|
|
|
- .projectId(1)
|
|
|
- .build());
|
|
|
- user1.setInviteAirDrop(user1.getInviteAirDrop() + 1);
|
|
|
}
|
|
|
+
|
|
|
userRepo.save(user1);
|
|
|
});
|
|
|
}
|