|
|
@@ -10,11 +10,9 @@ import com.huifu.adapay.model.AdapayCommon;
|
|
|
import com.huifu.adapay.model.SettleAccount;
|
|
|
import com.izouma.nineth.config.AdapayProperties;
|
|
|
import com.izouma.nineth.config.Constants;
|
|
|
-import com.izouma.nineth.domain.Follow;
|
|
|
-import com.izouma.nineth.domain.IdentityAuth;
|
|
|
-import com.izouma.nineth.domain.Invite;
|
|
|
-import com.izouma.nineth.domain.User;
|
|
|
+import com.izouma.nineth.domain.*;
|
|
|
import com.izouma.nineth.dto.*;
|
|
|
+import com.izouma.nineth.enums.AirDropType;
|
|
|
import com.izouma.nineth.enums.AuthStatus;
|
|
|
import com.izouma.nineth.enums.AuthorityName;
|
|
|
import com.izouma.nineth.event.AccountCreatedEvent;
|
|
|
@@ -57,24 +55,24 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
@AllArgsConstructor
|
|
|
public class UserService {
|
|
|
- private UserRepo userRepo;
|
|
|
- private WxMaService wxMaService;
|
|
|
- private WxMpService wxMpService;
|
|
|
- private SmsService smsService;
|
|
|
- private StorageService storageService;
|
|
|
- private JwtTokenUtil jwtTokenUtil;
|
|
|
- private CaptchaService captchaService;
|
|
|
- private FollowService followService;
|
|
|
- private FollowRepo followRepo;
|
|
|
- private IdentityAuthRepo identityAuthRepo;
|
|
|
- private SysConfigService sysConfigService;
|
|
|
- private CollectionService collectionService;
|
|
|
- private AdapayService adapayService;
|
|
|
- private UserBankCardRepo userBankCardRepo;
|
|
|
- private CacheService cacheService;
|
|
|
- private InviteRepo inviteRepo;
|
|
|
- private NFTService nftService;
|
|
|
- private AdapayProperties adapayProperties;
|
|
|
+ private UserRepo userRepo;
|
|
|
+ private WxMaService wxMaService;
|
|
|
+ private WxMpService wxMpService;
|
|
|
+ private SmsService smsService;
|
|
|
+ private StorageService storageService;
|
|
|
+ private JwtTokenUtil jwtTokenUtil;
|
|
|
+ private CaptchaService captchaService;
|
|
|
+ private FollowService followService;
|
|
|
+ private FollowRepo followRepo;
|
|
|
+ private IdentityAuthRepo identityAuthRepo;
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
+ private AirDropService airDropService;
|
|
|
+ private AdapayService adapayService;
|
|
|
+ private UserBankCardRepo userBankCardRepo;
|
|
|
+ private CacheService cacheService;
|
|
|
+ private InviteRepo inviteRepo;
|
|
|
+ private NFTService nftService;
|
|
|
+ private AdapayProperties adapayProperties;
|
|
|
|
|
|
@CacheEvict(value = "user", key = "#user.username")
|
|
|
public User update(User user) {
|
|
|
@@ -155,7 +153,7 @@ public class UserService {
|
|
|
return user;
|
|
|
}
|
|
|
|
|
|
- public User phoneRegister(String phone, String code, String password, String inviteCode) {
|
|
|
+ public User phoneRegister(String phone, String code, String password, String inviteCode, Long invitor) {
|
|
|
String name = "9th_" + RandomStringUtils.randomAlphabetic(8);
|
|
|
Invite invite = null;
|
|
|
if (StringUtils.isNotBlank(inviteCode)) {
|
|
|
@@ -172,10 +170,36 @@ public class UserService {
|
|
|
.invitorPhone(Optional.ofNullable(invite).map(Invite::getPhone).orElse(null))
|
|
|
.invitorName(Optional.ofNullable(invite).map(Invite::getName).orElse(null))
|
|
|
.inviteCode(Optional.ofNullable(invite).map(Invite::getCode).orElse(null))
|
|
|
+ .invitor(invitor)
|
|
|
.build());
|
|
|
if (invite != null) {
|
|
|
inviteRepo.increaseNum(invite.getId());
|
|
|
}
|
|
|
+ if (invitor != null) {
|
|
|
+ userRepo.findByIdAndDelFalse(invitor).ifPresent(user1 -> {
|
|
|
+ user1.setInviteNum(user1.getInviteNum() + 1);
|
|
|
+ userRepo.save(user1);
|
|
|
+ if (user1.getInviteNum() >= 15) {
|
|
|
+ airDropService.create(AirDrop.builder()
|
|
|
+ .name("宇宙熊-致敬奥运-纯金款")
|
|
|
+ .type(AirDropType.asset)
|
|
|
+ .collectionId(8472L)
|
|
|
+ .phone(List.of(user1.getPhone()))
|
|
|
+ .userIds(List.of(invitor))
|
|
|
+ .projectId(1)
|
|
|
+ .build());
|
|
|
+ } else if (user1.getInviteNum() >= 5) {
|
|
|
+ airDropService.create(AirDrop.builder()
|
|
|
+ .name("宇宙熊-致敬奥运-纯黄款")
|
|
|
+ .type(AirDropType.asset)
|
|
|
+ .collectionId(8406L)
|
|
|
+ .phone(List.of(user1.getPhone()))
|
|
|
+ .userIds(List.of(invitor))
|
|
|
+ .projectId(1)
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
return user;
|
|
|
}
|
|
|
|