Browse Source

手机注册和邮箱注册接口增加判断是否已存在该用户。如果已存在该用户:手机注册接口返回null,邮箱注册接口返回false。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
636ffb4d7f
1 changed files with 54 additions and 5 deletions
  1. 54 5
      src/main/java/com/ekexiu/portal/service/SysService.java

+ 54 - 5
src/main/java/com/ekexiu/portal/service/SysService.java

@ -53,11 +53,11 @@ public class SysService {
53 53
54 54
	private String bindMobilePhoneReplaceKey;
55 55
	private String bindMobilePhoneContentTemplate;
56
	private long timeLimitWithBindMobilePhone = 60 * 1000;
56
	private long timeLimitWithBindMobilePhone =3 * 60 * 1000;
57 57
58 58
	private String phoneRetrievePasswordReplaceKey;
59 59
	private String phoneRetrievePasswordContentTemplate;
60
	private long timeLimitWithPhoneRetrievePassword = 60 * 1000;
60
	private long timeLimitWithPhoneRetrievePassword = 3 * 60 * 1000;
61 61
62 62
	private String mailRetrievePasswordContentTemplate;
63 63
	private String mailRetrievePasswordReplaceKey;
@ -66,7 +66,7 @@ public class SysService {
66 66
	
67 67
	private String regMobilePhoneReplaceKey;
68 68
	private String regMobilePhoneContentTemplate;
69
	private long timeLimitWithRegMobilePhone = 60 * 1000;
69
	private long timeLimitWithRegMobilePhone = 3 * 60 * 1000;
70 70
	
71 71
	public String getRegMailReplaceKey() {
72 72
		return regMailReplaceKey;
@ -262,6 +262,22 @@ public class SysService {
262 262
		this.mailservice = mailservice;
263 263
	}
264 264
265
	@Get
266
	@Path("/getUUID")
267
	public String getUUID(@JdbcConn Connection con, String pass) throws SQLException {
268
		return StringUtil.md5(pass);
269
	}
270
271
	/**
272
	 * 手机验证注册
273
	 * @param con
274
	 * @param state 发送手机验证码的返回值
275
	 * @param mobilePhone 验证的手机号
276
	 * @param validateCode 手机验证码
277
	 * @param password 注册密码
278
	 * @return
279
	 * @throws SQLException
280
	 */
265 281
	@Post
266 282
	@Path("/regmobile")
267 283
	public String regMobile(@JdbcConn(false) Connection con, String state, String mobilePhone, String validateCode, String password) throws SQLException {
@ -288,6 +304,15 @@ public class SysService {
288 304
		}
289 305
	}
290 306
	
307
	/**
308
	 * 邮箱验证注册
309
	 * @param con
310
	 * @param key 发送邮箱验证的返回值
311
	 * @param mail 验证的邮箱地址
312
	 * @param password 注册密码
313
	 * @return
314
	 * @throws SQLException
315
	 */
291 316
	@Post
292 317
	@Path("/regmail/{key}")
293 318
	public String regeMail(@JdbcConn(false) Connection con, @PathVar String key, String mail, String password) throws SQLException {
@ -311,10 +336,22 @@ public class SysService {
311 336
		}
312 337
	}
313 338
	
339
	/**
340
	 * 发送邮箱验证
341
	 * @param con
342
	 * @param mail 验证的邮箱地址
343
	 * @return
344
	 * @throws JfwBaseException
345
	 * @throws SQLException
346
	 */
314 347
	@Get
315 348
	@Path("/regmail")
316 349
	public boolean regMail(@JdbcConn(false) Connection con, String mail) throws JfwBaseException, SQLException {
317
350
		User user = this.userDao.queryByEmailOrMobilePhone(con, mail);
351
		if(null != user){
352
			return false;
353
		}
354
		
318 355
		StateCode<String, String> sc = new StateCode<String, String>();
319 356
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);
320 357
@ -494,10 +531,22 @@ public class SysService {
494 531
		return key;
495 532
	}
496 533
534
	/**
535
	 * 发送手机验证码
536
	 * @param con
537
	 * @param mobilePhone 验证的手机号
538
	 * @return
539
	 * @throws JfwBaseException
540
	 * @throws SQLException
541
	 */
497 542
	@Get
498 543
	@Path("/regmobilephone")
499 544
	public String regMobilePhone(@JdbcConn(false) Connection con, String mobilePhone) throws JfwBaseException, SQLException {
500
545
		User user = this.userDao.queryByEmailOrMobilePhone(con, mobilePhone);
546
		if(null != user){
547
			return null;
548
		}
549
		
501 550
		StateCode<String, String> sc = new StateCode<String, String>();
502 551
503 552
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);