Forráskód Böngészése

注册邀请码不存在时处理

anderx 7 éve%!(EXTRA string=óta)
szülő
commit
dc38b399f3

+ 4 - 0
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -158,6 +158,10 @@ public class UserRegisterController extends BaseController {
 			res.getError().add(buildError(ErrorConstants.MCODE_OVERTIME_ERROR, "手机验证码超时失效"));
 			return res;
 		}
+		if (userService.checkeToInviteCode(user.getBeInviteCode())) {
+			res.getError().add(buildError("邀请码不存在", "邀请码不存在"));
+			return res;
+		}
 		if (res.getError().isEmpty()) {
 			User us = new User();
 			us.setId(UUID.randomUUID().toString());

+ 2 - 0
src/main/java/com/goafanti/user/service/UserService.java

@@ -73,5 +73,7 @@ public interface UserService {
 	String updateGetInvitationCode(String uid);
 
 	void saveVoucher(User us);
+
+	boolean checkeToInviteCode(String beInviteCode);
 	
 }

+ 10 - 0
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -307,4 +307,14 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 			}
 		}
 	}
+
+	@Override
+	public boolean checkeToInviteCode(String beInviteCode) {
+		User user=userMapper.getToInviteCode(beInviteCode);
+		if (user==null) {
+			return true;
+		}
+		return false;
+		
+	}
 }