This commit is contained in:
none
2023-03-24 11:54:29 +08:00
parent 761458c370
commit f42c5a4236
4 changed files with 7 additions and 9 deletions

View File

@@ -70,7 +70,12 @@ public class UserLearnDurationStatsServiceImpl extends ServiceImpl<UserLearnDura
@Override
public Integer todayUserDuration(Integer userId) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return getBaseMapper().getUserDateDuration(userId, simpleDateFormat.format(new Date()));
String today = simpleDateFormat.format(new Date());
UserLearnDurationStats stats = getOne(query().getWrapper().eq("user_id", userId).eq("created_date", today));
if (stats == null) {
return 0;
}
return stats.getDuration();
}
@Override