Antiloveg 8 years ago
parent
commit
b2826c63be

+ 7 - 2
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -187,10 +187,15 @@ public class UserApiController extends BaseApiController {
 		}
 		User user = userService.selectByPrimaryKey(TokenManager.getUserId());
 		if (mobile.equals(user.getMobile())) {
-			res.getError().add(buildError(ErrorConstants.MOBILE_SAME_ERROR, "新手机号必须和原手机号不同!"));
+			res.getError().add(buildError(ErrorConstants.MOBILE_SAME_ERROR));
 			return res;
 		}
-		if (res.getError().isEmpty() && TokenManager.isLogin()) {
+		User u = userService.selectByMobieAndType(mobile, user.getType());	
+		if (null != u){
+			res.getError().add(buildError(ErrorConstants.DUNPLICATE_KAY_ERROR, "", mobile));
+			return res;
+		}
+		if (res.getError().isEmpty()) {
 			user.setMobile(mobile);
 			res.setData(userService.updateByPrimaryKey(user));
 		}

+ 2 - 0
src/main/resources/props/error.properties

@@ -88,3 +88,5 @@ OVER_MAX_WRONG_COUNT=\u8f93\u5165\u9519\u8bef\u91d1\u989d\u6b21\u6570\u8fc7\u591
 WRONG_MONEY=\u8f93\u5165\u6253\u6b3e\u91d1\u989d\u9519\u8bef\uff0c\u60a8\u8fd8\u6709{0}\u6b21\u673a\u4f1a\uff01
 
 M_CODE_ERROR=\u624b\u673a\u9a8c\u8bc1\u7801\u83b7\u53d6\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\uff01
+
+MOBILE_SAME_ERROR=\u65b0\u624b\u673a\u53f7\u5fc5\u987b\u548c\u539f\u624b\u673a\u53f7\u4e0d\u540c\uff01