Commit 58dbc884 authored by killer's avatar killer

销户

parent cdb21962
......@@ -233,5 +233,5 @@ public interface Constants {
// -- End -- 验证码常量组
/** 注销用户后再次允许注册时间间隔-天数 */
int DELETE_USER_AGAIN_REGISTER_INTERVAL = 90;
long DELETE_USER_AGAIN_REGISTER_INTERVAL = 90;
}
......@@ -270,7 +270,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
}
/* 销户时间小于90天不允许再次注册 */
int diffDay = DateUtils.dayDiff(new Date(), lastOne.get().getDeregisterTime());
long diffDay = DateUtils.dayDiff(new Date(), lastOne.get().getDeregisterTime());
if (DELETE_USER_AGAIN_REGISTER_INTERVAL >= diffDay) {
throw new UserRegisterLoginException("距离上次销户时间小于90天,无法再次注册");
}
......
......@@ -55,12 +55,7 @@ public class DateUtils {
* @param eDate end
* @return 时间差天数
*/
public static int dayDiff(Date bDate, Date eDate) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(bDate);
int bDay = calendar.get(Calendar.DAY_OF_YEAR);
calendar.setTime(eDate);
int eDay = calendar.get(Calendar.DAY_OF_YEAR);
return bDay - eDay;
public static long dayDiff(Date bDate, Date eDate) {
return ((bDate.getTime() - eDate.getTime()) / (1000 * 3600 * 24));
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment