修改--修改订单剩余时间的计算方式
This commit is contained in:
parent
43d63b57c4
commit
9fd0012d44
@ -1360,38 +1360,45 @@ public class AppSystemController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------设置订单剩余时间---------------------------------------------------------------------
|
||||
LocalDateTime now = orderListDto.getStartTime();
|
||||
Duration duration = Duration.between(now, orderListDto.getEndTime());
|
||||
// 只有当订单还未结束时才设置剩余时间
|
||||
if(orderListDto.getStatus().equals("0")){
|
||||
//------------------------------------------设置订单剩余时间---------------------------------------------------------------------
|
||||
LocalDateTime now = orderListDto.getStartTime();
|
||||
Duration duration = Duration.between(now, orderListDto.getEndTime());
|
||||
|
||||
|
||||
// 分解单位(同上)
|
||||
long days = duration.toDays();
|
||||
long hours = duration.toHours() % 24;
|
||||
long minutes = duration.toMinutes() % 60;
|
||||
long seconds = duration.getSeconds() % 60;
|
||||
// 分解单位(同上)
|
||||
long days = duration.toDays();
|
||||
long hours = duration.toHours() % 24;
|
||||
long minutes = duration.toMinutes() % 60;
|
||||
long seconds = duration.getSeconds() % 60;
|
||||
|
||||
String s = "剩余";
|
||||
if (days > 0){
|
||||
s = s + days + "天";
|
||||
}
|
||||
if (hours > 0){
|
||||
s = s + hours + "小时";
|
||||
}
|
||||
if (minutes > 0){
|
||||
s = s + minutes + "分";
|
||||
}
|
||||
if (seconds > 0){
|
||||
s = s + seconds + "秒";
|
||||
}
|
||||
|
||||
if (s.equals("剩余")){
|
||||
s = "订单已结束展示";
|
||||
}
|
||||
|
||||
|
||||
orderListDto.setRemainTimeString(s);
|
||||
//----------------------------------------------------------------设置订单剩余时间end--------------------------------------------------------------
|
||||
|
||||
String s = "剩余";
|
||||
if (days > 0){
|
||||
s = s + days + "天";
|
||||
}
|
||||
if (hours > 0){
|
||||
s = s + hours + "小时";
|
||||
else{
|
||||
orderListDto.setRemainTimeString("订单已结束展示");
|
||||
}
|
||||
if (minutes > 0){
|
||||
s = s + minutes + "分";
|
||||
}
|
||||
if (seconds > 0){
|
||||
s = s + seconds + "秒";
|
||||
}
|
||||
|
||||
if (s.equals("剩余")){
|
||||
s = "订单已结束展示";
|
||||
}
|
||||
|
||||
|
||||
orderListDto.setRemainTimeString(s);
|
||||
//----------------------------------------------------------------设置订单剩余时间end--------------------------------------------------------------
|
||||
|
||||
orderListDto.setOrderInfoList(orderInfoList);
|
||||
|
||||
@ -2467,10 +2474,10 @@ public class AppSystemController extends BaseController {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
|
||||
throw new CaptchaException();
|
||||
}
|
||||
else{
|
||||
// 登录成功删除验证码
|
||||
redisCache.deleteObject(verifyKey);
|
||||
}
|
||||
// else{
|
||||
// // 登录成功删除验证码
|
||||
// redisCache.deleteObject(verifyKey);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public class BaiduSMS {
|
||||
|
||||
SendMessageV3Request request = new SendMessageV3Request();
|
||||
request.setMobile(phone);
|
||||
request.setSignatureId("sms-sign-MiTUWW85061");
|
||||
request.setSignatureId("sms-sign-fgYPCP37534");
|
||||
request.setTemplate("sms-tmpl-iLlROF73209");
|
||||
Map<String, String> contentVar = new HashMap<>();
|
||||
contentVar.put("SMSvCode", code);
|
||||
|
||||
@ -198,8 +198,8 @@ public class CaptchaController {
|
||||
String countKey = CacheConstants.CAPTCHA_CODE_KEY_COUNT + phone;
|
||||
// 生成短信验证码
|
||||
Random random = new Random();
|
||||
// String testCode = String.format("%04d", random.nextInt(10000)); // 0000-9999
|
||||
String testCode = "1234"; // 0000-9999
|
||||
String testCode = String.format("%04d", random.nextInt(10000)); // 0000-9999
|
||||
// String testCode = "1234"; // 0000-9999
|
||||
// Constants.CAPTCHA_EXPIRATION 为验证码过期时间,这里是5
|
||||
redisCache.setCacheObject(verifyKey, testCode, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
|
||||
@ -207,8 +207,8 @@ public class CaptchaController {
|
||||
redisCache.setCacheObject(countKey, 0, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
|
||||
// 发送验证码
|
||||
// boolean flag = BaiduSMS.sendSMS(phone, testCode, "5");
|
||||
boolean flag = true;
|
||||
boolean flag = BaiduSMS.sendSMS(phone, testCode, "5");
|
||||
// boolean flag = true;
|
||||
if (flag) {
|
||||
log.info("发送短信验证码成功:"+phone);
|
||||
System.out.println("发送短信验证码成功"+testCode);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user