瀏覽代碼

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

zzy.zhiyuan.foxmail 8 年之前
父節點
當前提交
636ffb4d7f
共有 1 個文件被更改,包括 54 次插入5 次删除
  1. 54 5
      src/main/java/com/ekexiu/portal/service/SysService.java

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

53
53
54
	private String bindMobilePhoneReplaceKey;
54
	private String bindMobilePhoneReplaceKey;
55
	private String bindMobilePhoneContentTemplate;
55
	private String bindMobilePhoneContentTemplate;
56
	private long timeLimitWithBindMobilePhone = 60 * 1000;
56
	private long timeLimitWithBindMobilePhone =3 * 60 * 1000;
57
57
58
	private String phoneRetrievePasswordReplaceKey;
58
	private String phoneRetrievePasswordReplaceKey;
59
	private String phoneRetrievePasswordContentTemplate;
59
	private String phoneRetrievePasswordContentTemplate;
60
	private long timeLimitWithPhoneRetrievePassword = 60 * 1000;
60
	private long timeLimitWithPhoneRetrievePassword = 3 * 60 * 1000;
61
61
62
	private String mailRetrievePasswordContentTemplate;
62
	private String mailRetrievePasswordContentTemplate;
63
	private String mailRetrievePasswordReplaceKey;
63
	private String mailRetrievePasswordReplaceKey;
66
	
66
	
67
	private String regMobilePhoneReplaceKey;
67
	private String regMobilePhoneReplaceKey;
68
	private String regMobilePhoneContentTemplate;
68
	private String regMobilePhoneContentTemplate;
69
	private long timeLimitWithRegMobilePhone = 60 * 1000;
69
	private long timeLimitWithRegMobilePhone = 3 * 60 * 1000;
70
	
70
	
71
	public String getRegMailReplaceKey() {
71
	public String getRegMailReplaceKey() {
72
		return regMailReplaceKey;
72
		return regMailReplaceKey;
262
		this.mailservice = mailservice;
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
	@Post
281
	@Post
266
	@Path("/regmobile")
282
	@Path("/regmobile")
267
	public String regMobile(@JdbcConn(false) Connection con, String state, String mobilePhone, String validateCode, String password) throws SQLException {
283
	public String regMobile(@JdbcConn(false) Connection con, String state, String mobilePhone, String validateCode, String password) throws SQLException {
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
	@Post
316
	@Post
292
	@Path("/regmail/{key}")
317
	@Path("/regmail/{key}")
293
	public String regeMail(@JdbcConn(false) Connection con, @PathVar String key, String mail, String password) throws SQLException {
318
	public String regeMail(@JdbcConn(false) Connection con, @PathVar String key, String mail, String password) throws SQLException {
311
		}
336
		}
312
	}
337
	}
313
	
338
	
339
	/**
340
	 * 发送邮箱验证
341
	 * @param con
342
	 * @param mail 验证的邮箱地址
343
	 * @return
344
	 * @throws JfwBaseException
345
	 * @throws SQLException
346
	 */
314
	@Get
347
	@Get
315
	@Path("/regmail")
348
	@Path("/regmail")
316
	public boolean regMail(@JdbcConn(false) Connection con, String mail) throws JfwBaseException, SQLException {
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
		StateCode<String, String> sc = new StateCode<String, String>();
355
		StateCode<String, String> sc = new StateCode<String, String>();
319
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);
356
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);
320
357
494
		return key;
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
	@Get
542
	@Get
498
	@Path("/regmobilephone")
543
	@Path("/regmobilephone")
499
	public String regMobilePhone(@JdbcConn(false) Connection con, String mobilePhone) throws JfwBaseException, SQLException {
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
		StateCode<String, String> sc = new StateCode<String, String>();
550
		StateCode<String, String> sc = new StateCode<String, String>();
502
551
503
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);
552
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);