Sfoglia il codice sorgente

解决运营界面添加用户手机号和邮箱时手机号不能为空的问题。

zzy.zhiyuan.foxmail 8 anni fa
parent
commit
ad6bd3c9ef

+ 0 - 12
src/main/java/com/ekexiu/portal/service/InitUserService.java

@ -52,12 +52,6 @@ public class InitUserService {
52 52
	@Path("/user")
53 53
	public void modifyMobilePhone(@JdbcConn(true) Connection con,String id,@Nullable String mobilePhone,
54 54
			@Nullable String email)throws SQLException{
55
		if(mobilePhone.isEmpty()){
56
			mobilePhone = null;
57
		}
58
		if(email.isEmpty()){
59
			email = null;
60
		}
61 55
		Random rd = new Random();
62 56
		int code = rd.nextInt(1000000);
63 57
		String inviteCode = String.format("%06d", code);
@ -80,12 +74,6 @@ public class InitUserService {
80 74
	@Put
81 75
	@Path("/user")
82 76
	public void modifyMobilePhone(@JdbcConn(true) Connection con ,@RequestBody User user)throws SQLException{
83
		if(user.getMobilePhone().isEmpty()){
84
			user.setMobilePhone(null);
85
		}
86
		if(user.getEmail().isEmpty()){
87
			user.setEmail(null);
88
		}
89 77
		this.userDao.updateMobilePhone(con, user.getMobilePhone(), user.getId());
90 78
		this.userDao.updateEmail(con, user.getEmail(), user.getId());
91 79
		Professor professor = this.professorDao.queryOne(con, user.getId());

+ 12 - 8
src/main/webapp/page/bindMobilePhone.html

@ -71,13 +71,16 @@
71 71
    		$("#id").val(uid);
72 72
    		var mp = null;
73 73
    		var mail = null;
74
    		var inCode = null;
75 74
    		if(uid){
76 75
    			$("#button").on("click",function(){
77 76
        			var sData ={};
78 77
        			sData.id = uid;
79
        			sData.mobilePhone = $("#mp").val();
80
        			sData.email = $("#mail").val();
78
        			if(!$("#mp").val()==""){
79
        				sData.mobilePhone = $("#mp").val();
80
        			}
81
        			if(!$("#mail").val()==""){
82
        				sData.email = $("#mail").val();
83
        			}
81 84
        			$.ajax("../ajax/init/user",{
82 85
        				type:mp||mail?"PUT":"POST",
83 86
        				success:function(rdata){
@ -87,8 +90,8 @@
87 90
        	    				alert(rdata.msg);
88 91
        	    			}	
89 92
        				},
90
        				data:mp?JSON.stringify(sData):sData,
91
        				contentType:mp?"application/json":"application/x-www-form-urlencoded",
93
        				data:mp||mail?JSON.stringify(sData):sData,
94
        				contentType:mp||mail?"application/json":"application/x-www-form-urlencoded",
92 95
        				dataType:"json"    				
93 96
        			});        			
94 97
        		});
@ -97,16 +100,17 @@
97 100
        		        			
98 101
        			if($data.success){
99 102
        				if($data.data){
100
        					mp =$data.data.mobilePhone;
103
        					mp = $data.data.mobilePhone;
104
        					mail = $data.data.email;
101 105
        					$("#mp").val(mp);
102
        					$("#mail").val($data.data.email);
106
        					$("#mail").val(mail);
103 107
        					$("#inCode").val($data.data.inviteCode);
104 108
        					console.log(mp);
105 109
        				}
106 110
        			}else{
107 111
        				alert($data.msg);
108 112
        			}
109
        		})	;
113
        		});
110 114
    		}
111 115
   		
112 116