无关风月
2024-07-05 cb7edabb2232bc9901725d562a2b4ec56d174a07
ruoyi-service/ruoyi-management/src/main/java/com/ruoyi/management/controller/TUserController.java
@@ -94,8 +94,27 @@
        userInfoVO.setTodayHours(data1.getTodayHours());
        userInfoVO.setWeekHours(data1.getWeekHours());
        userInfoVO.setMonthHours(data1.getMonthHours());
        PageInfo<TGameRecord> gameRecords = data1.getGameRecords();
        List<TGameRecord> records = gameRecords.getRecords();
        for (TGameRecord record : records) {
            String s = convertSecondsToHoursMinutes(record.getUseTime());
            record.setUseTime1(s);
        }
        userInfoVO.setGameRecords(data1.getGameRecords());
        return AjaxResult.success(userInfoVO);
    }
    public static String convertSecondsToHoursMinutes(int seconds) {
        int hours = seconds / 3600;
        int minutes = (seconds % 3600) / 60;
        if (hours == 0){
            if (minutes == 0){
                return String.format("%d秒", seconds);
            }else{
                return String.format("%d分钟", minutes);
            }
        }else{
            return String.format("%d小时%d分钟", hours, minutes);
        }
    }
    public static String convertToChineseOrdinal(int number) {
        if (number <= 0 || number > 50) {
@@ -171,6 +190,7 @@
            return AjaxResult.error("新密码不能与旧密码相同");
        }
        one.setPassword(SecurityUtils.encryptPassword(password));
        sysUserService.updateById(one);
        return AjaxResult.success();
    }
    @GetMapping("/sendPhoneCode")