|
|
|
@ -4,8 +4,10 @@ package com.zh.project0512.controller.wxApp;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.zh.project0512.annotation.tokenValid;
|
|
|
|
|
import com.zh.project0512.model.UserTask;
|
|
|
|
|
import com.zh.project0512.model.Video;
|
|
|
|
|
import com.zh.project0512.service.IUserService;
|
|
|
|
|
import com.zh.project0512.service.IUserTaskService;
|
|
|
|
|
import com.zh.project0512.service.IVideoService;
|
|
|
|
|
import com.zh.project0512.utils.JwtUtil;
|
|
|
|
|
import com.zh.project0512.utils.MybatisPlusUtil;
|
|
|
|
@ -42,6 +44,8 @@ public class VideoUController {
|
|
|
|
|
private IVideoService videoService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IUserService userService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IUserTaskService userTaskService;
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
|
static class UserAddParam {
|
|
|
|
@ -65,6 +69,14 @@ public class VideoUController {
|
|
|
|
|
if (useId == null) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该用户");
|
|
|
|
|
}
|
|
|
|
|
Integer taskStatus = userTaskService.userTaskStatus(useId, param.getId());
|
|
|
|
|
if(taskStatus ==null){
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "用户未接受任务");
|
|
|
|
|
}else if(taskStatus == 0){
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "任务未开始");
|
|
|
|
|
}else if(taskStatus == 2){
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "任务已结束");
|
|
|
|
|
}
|
|
|
|
|
videoService.save(new Video().setUserId(useId).setTaskId(param.getId()).setType(param.getType()).setUrl(param.getUrl()).setCreatAt(LocalDateTime.now()));
|
|
|
|
|
return Result.success("添加完成!");
|
|
|
|
|
}
|
|
|
|
|