feat:重构倒计时相关内容,将倒计时逻辑放在后端进行
This commit is contained in:
+6
-3
@@ -1,6 +1,7 @@
|
||||
package com.guo.learningprogresstracker.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.protobuf.ServiceException;
|
||||
import com.guo.learningprogresstracker.dto.request.EndedStudySessionRequest;
|
||||
import com.guo.learningprogresstracker.dto.response.StudySessionResponse;
|
||||
import com.guo.learningprogresstracker.entity.CommonResult;
|
||||
@@ -49,7 +50,7 @@ public class StudySessionController {
|
||||
* 开始一个【学习会话】
|
||||
*/
|
||||
@PostMapping("/{sessionNum}/study-sessions/continue")
|
||||
public CommonResult<Void> startStudySession(@PathVariable("sessionNum") String sessionNum) throws ErrorParameterException {
|
||||
public CommonResult<Void> startStudySession(@PathVariable("sessionNum") String sessionNum) throws ErrorParameterException, ServiceException {
|
||||
studySessionsServiceImpl.continueStudySession(sessionNum);
|
||||
return CommonResult.success();
|
||||
}
|
||||
@@ -58,8 +59,10 @@ public class StudySessionController {
|
||||
* 暂停一个【学习会话】
|
||||
*/
|
||||
@PostMapping("/{sessionNum}/study-sessions/pause")
|
||||
public CommonResult<Void> pauseStudySession(@PathVariable("sessionNum") String sessionNum, @RequestParam(value = "endTime",required = false) LocalDateTime endTime) throws ErrorParameterException {
|
||||
studySessionsServiceImpl.pauseStudySession(sessionNum,endTime);
|
||||
public CommonResult<Void> pauseStudySession(@PathVariable("sessionNum") String sessionNum,
|
||||
@RequestParam(value = "endTime", required = false) LocalDateTime endTime)
|
||||
throws ErrorParameterException, ServiceException {
|
||||
studySessionsServiceImpl.pauseStudySession(sessionNum, endTime);
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.guo.learningprogresstracker.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.protobuf.ServiceException;
|
||||
import com.guo.learningprogresstracker.common.Ops;
|
||||
import com.guo.learningprogresstracker.dto.TaskInfo;
|
||||
import com.guo.learningprogresstracker.dto.response.StudySessionResponse;
|
||||
@@ -80,7 +81,7 @@ public class TaskController {
|
||||
*/
|
||||
@GetMapping("/{taskNum}/study-sessions/start-or-continue")
|
||||
public CommonResult<StudySessionResponse> startOrContinueStudySession(@NotEmpty(message = "taskNum不可为空")
|
||||
@PathVariable String taskNum) throws NotFindEntitiesException {
|
||||
@PathVariable String taskNum) throws NotFindEntitiesException, ServiceException {
|
||||
StudySessionResponse response = studySessionsServiceImpl.startOrContinueStudySession(taskNum);
|
||||
return CommonResult.success(response);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user