diff --git a/src/main/java/com/zh/project0512/controller/CustomerActionNoteController.java b/src/main/java/com/zh/project0512/controller/CustomerActionNoteController.java new file mode 100644 index 0000000..67e5b67 --- /dev/null +++ b/src/main/java/com/zh/project0512/controller/CustomerActionNoteController.java @@ -0,0 +1,20 @@ +package com.zh.project0512.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *
+ * 前端控制器 + *
+ * + * @author zh + * @since 2022-05-30 + */ +@RestController +@RequestMapping("/customerActionNote") +public class CustomerActionNoteController { + +} diff --git a/src/main/java/com/zh/project0512/controller/ReferenceGroupController.java b/src/main/java/com/zh/project0512/controller/ReferenceGroupController.java index 0500c00..e1706fe 100644 --- a/src/main/java/com/zh/project0512/controller/ReferenceGroupController.java +++ b/src/main/java/com/zh/project0512/controller/ReferenceGroupController.java @@ -54,11 +54,14 @@ public class ReferenceGroupController { @NotNull(message = "name不能为空") @Schema(title = "分组名") private String name; + @NotNull(message = "封面不能为空") + @Schema(title = "封面地址") + private String coverUrl; } @Operation(summary = "新增分组") @PostMapping("/add") public Result add(@Validated @RequestBody AddRGParam param) { - referenceGroupService.save(new ReferenceGroup().setName(param.getName()).setCreatAt(LocalDateTime.now())); + referenceGroupService.save(new ReferenceGroup().setName(param.getName()).setCoverUrl(param.getCoverUrl()).setCreatAt(LocalDateTime.now())); return Result.success("添加完成!"); } @@ -81,16 +84,17 @@ public class ReferenceGroupController { @Min(value = 1, message = "id最小值为1") @Schema(title = "分组id") private Integer id; - @NotNull(message = "name不能为空") @Schema(title = "分组名") private String name; + @Schema(title = "封面地址") + private String coverUrl; } @Operation(summary = "更新分组") @PostMapping("/upd") public Result upd(@Validated @RequestBody UpdRGParam param) { UpdateWrapper- * 前端控制器 + * 前端控制器 *
* * @author zh @@ -25,19 +37,54 @@ import javax.validation.constraints.NotNull; */ @RestController @RequestMapping("/video") +@Tag(name = "视频") public class VideoController { + @Autowired + private IVideoService videoService; + @Autowired + private IUserService userService; @Data static class UserAddParam { - @NotNull(message = "id不能为空") - @Min(value = 1, message = "id最小值为1") - @Schema(title = "平台",description = "1抖音;2快手") + @NotNull(message = "任务id不能为空") private Integer id; + @NotNull(message = "type不能为空") + @Min(value = 1, message = "视频范围为[1.抖音,2.快手]") + @Max(value = 2, message = "视频范围为[1.抖音,2.快手]") + @Schema(title = "平台", description = "1抖音;2快手") + private Integer type; + @NotNull(message = "视频地址不能为空") + private String url; } @Operation(summary = "用户上传") @PostMapping("userAdd") - public Result userAdd(@Validated @RequestBody UserAddParam param) { - return Result.success(); + @tokenValid + public Result userAdd(@Validated @RequestBody UserAddParam param, @RequestHeader("token") @Parameter(name = "登录token") String token) { + Claims claims = new JwtUtil().parseJWT(token); + Integer useId = userService.selByOpenid(claims.getId()).getId(); + if (useId == null) { + 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("添加完成!"); + } + + @Operation(summary = "用户上传记录") + @PostMapping("addedRecord") + @tokenValid + public Result addedRecord(@RequestBody(required = false) JSONObject obj, @RequestHeader("token") @Parameter(name = "登录token") String token) { + Claims claims = new JwtUtil().parseJWT(token); + Integer useId = userService.selByOpenid(claims.getId()).getId(); + if (useId == null) { + return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该用户"); + } + QueryWrapper