|
|
@@ -126,7 +126,7 @@ public class UserService {
|
|
|
return user;
|
|
|
}
|
|
|
|
|
|
- public User loginMa(String code, Long parent) {
|
|
|
+ public User loginMa(String code, Long parent, Boolean expert) {
|
|
|
try {
|
|
|
WxMaJscode2SessionResult result = wxMaService.jsCode2SessionInfo(code);
|
|
|
String openId = result.getOpenid();
|
|
|
@@ -135,11 +135,17 @@ public class UserService {
|
|
|
if (userInfo != null) {
|
|
|
// 插入上级
|
|
|
if (ObjectUtil.isNotNull(parent)) {
|
|
|
- Long parent1 = this.getParent(parent, userInfo);
|
|
|
- if (ObjectUtil.isNotNull(parent1)) {
|
|
|
+// Long parent1 = this.getParent(parent, userInfo);
|
|
|
+ // 邀请成为创客
|
|
|
+ if (expert && !userInfo.isVip()) {
|
|
|
+ userInfo.setVip(true);
|
|
|
+ userInfo.setMember(Member.EXPERT);
|
|
|
+ }
|
|
|
+ // 成为他的上级
|
|
|
+ if (ObjectUtil.isNull(userInfo.getParent())) {
|
|
|
userInfo.setParent(parent);
|
|
|
- userRepo.saveAndFlush(userInfo);
|
|
|
}
|
|
|
+ userRepo.saveAndFlush(userInfo);
|
|
|
}
|
|
|
userInfo.setSessionKey(sessionKey);
|
|
|
return userInfo;
|
|
|
@@ -155,18 +161,13 @@ public class UserService {
|
|
|
.teamFounder(false)
|
|
|
.sessionKey(sessionKey)
|
|
|
.member(Member.NORMAL)
|
|
|
-// .promote(BigDecimal.ZERO)
|
|
|
-// .maker(BigDecimal.ZERO)
|
|
|
.withdraw(BigDecimal.ZERO)
|
|
|
.cacheAmount(BigDecimal.ZERO)
|
|
|
.build();
|
|
|
- // 插入上级
|
|
|
-// if (ObjectUtil.isNotNull(parent)) {
|
|
|
-// Long parent1 = this.getParent(parent, userInfo);
|
|
|
-// if (ObjectUtil.isNotNull(parent1)) {
|
|
|
-// userInfo.setParent(parent);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (ObjectUtil.isNotEmpty(parent) && expert) {
|
|
|
+ userInfo.setVip(true);
|
|
|
+ userInfo.setMember(Member.EXPERT);
|
|
|
+ }
|
|
|
userInfo = userRepo.saveAndFlush(userInfo);
|
|
|
log.info("loginMa {}", userInfo.getCreatedAt());
|
|
|
return userInfo;
|