|
|
@@ -75,6 +75,7 @@ public class UserService {
|
|
|
private final OrderInfoRepo orderInfoRepo;
|
|
|
private final CommissionRecordRepo commissionRecordRepo;
|
|
|
private final AttractionsRepo attractionsRepo;
|
|
|
+ private final SysConfigService sysConfigService;
|
|
|
|
|
|
public Page<User> all(PageQuery pageQuery) {
|
|
|
pageQuery.setSort("createdAt,desc");
|
|
|
@@ -146,10 +147,11 @@ public class UserService {
|
|
|
if (ObjectUtil.isNull(userInfo.getParent())) {
|
|
|
userInfo.setParent(parent);
|
|
|
}
|
|
|
- // 邀请成为创客
|
|
|
+ // 邀请成为黄金佳人 就改变上级为邀请者
|
|
|
if (expert && !userInfo.isVip()) {
|
|
|
userInfo.setVip(true);
|
|
|
userInfo.setMember(Member.EXPERT);
|
|
|
+ userInfo.setParent(parent);
|
|
|
}
|
|
|
userRepo.saveAndFlush(userInfo);
|
|
|
}
|
|
|
@@ -512,6 +514,29 @@ public class UserService {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ 身份升级
|
|
|
+ */
|
|
|
+ public void upgrade(Long parent) {
|
|
|
+ long num = userRepo.countByParentAndDelFalse(parent);
|
|
|
+ // 成为钻石合伙人
|
|
|
+ int upgradePartner = sysConfigService.getInt("UPGRADE_PARTNER");
|
|
|
+ if (num > upgradePartner) {
|
|
|
+ User user = userRepo.findById(parent).orElseThrow(new BusinessException("无上级"));
|
|
|
+ user.setMember(Member.PARTNER);
|
|
|
+ userRepo.save(user);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 成为钻石佳人
|
|
|
+ int upgradeBigExpert = sysConfigService.getInt("UPGRADE_BIG_EXPERT");
|
|
|
+ if (num > upgradeBigExpert) {
|
|
|
+ User user = userRepo.findById(parent).orElseThrow(new BusinessException("无上级"));
|
|
|
+ user.setMember(Member.BIG_EXPERT);
|
|
|
+ userRepo.save(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public String shareImg(Long userId) throws IOException, WxErrorException {
|
|
|
User user = userRepo.findById(userId).orElseThrow(new BusinessException("用户不存在"));
|
|
|
if (!(StringUtils.isNotEmpty(user.getShareImg()) && user.getShareImg().contains("/v2/"))) {
|