|
|
@ -4,11 +4,14 @@ import annotation.GlobalInterceptor;
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
import api.Result;
|
|
|
|
import api.Result;
|
|
|
|
import com.luoo.user.service.UserCollectInfoService;
|
|
|
|
import com.luoo.user.service.UserCollectInfoService;
|
|
|
|
|
|
|
|
import com.luoo.user.service.UserPointLogService;
|
|
|
|
|
|
|
|
import constants.TaskPointIdConstants;
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import util.JwtUtil;
|
|
|
|
import util.JwtUtil;
|
|
|
@ -17,11 +20,16 @@ import util.JwtUtil;
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/collect")
|
|
|
|
@RequestMapping("/collect")
|
|
|
|
public class UserCollectController {
|
|
|
|
public class UserCollectController {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private JwtUtil jwtUtil;
|
|
|
|
private JwtUtil jwtUtil;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private UserCollectInfoService userCollectInfoService;
|
|
|
|
private UserCollectInfoService userCollectInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private UserPointLogService userPointLogService;
|
|
|
|
|
|
|
|
|
|
|
|
//@ApiOperation(value = "1.喜欢歌曲/收藏期刊/关注/黑名单/点赞")
|
|
|
|
//@ApiOperation(value = "1.喜欢歌曲/收藏期刊/关注/黑名单/点赞")
|
|
|
|
@ApiOperation(value = "1.喜欢歌曲/收藏期刊/关注/黑名单")
|
|
|
|
@ApiOperation(value = "1.喜欢歌曲/收藏期刊/关注/黑名单")
|
|
|
|
@ApiImplicitParams({
|
|
|
|
@ApiImplicitParams({
|
|
|
@ -31,12 +39,18 @@ public class UserCollectController {
|
|
|
|
@ApiImplicitParam(name = "collectType", value = "0:歌曲,1:期刊,2:关注,3:黑名单,4:粉丝,5:点赞,6:专辑", required = true)})
|
|
|
|
@ApiImplicitParam(name = "collectType", value = "0:歌曲,1:期刊,2:关注,3:黑名单,4:粉丝,5:点赞,6:专辑", required = true)})
|
|
|
|
@PostMapping
|
|
|
|
@PostMapping
|
|
|
|
@GlobalInterceptor(checkAppUserLogin = true)
|
|
|
|
@GlobalInterceptor(checkAppUserLogin = true)
|
|
|
|
public Result<Void> addCollect(@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
public Result<Void> addCollect(
|
|
|
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
@VerifyParam(required = true) @RequestParam("objectId") String objectId,
|
|
|
|
@VerifyParam(required = true) @RequestParam("objectId") String objectId,
|
|
|
|
@VerifyParam(required = true) @RequestParam("collectType") Integer collectType) {
|
|
|
|
@VerifyParam(required = true) @RequestParam("collectType") Integer collectType) {
|
|
|
|
UserLoginDto loginDto = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
UserLoginDto loginDto = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
//userCollectService.saveCollect(loginDto.getUserId(), objectId, collectType);
|
|
|
|
//userCollectService.saveCollect(loginDto.getUserId(), objectId, collectType);
|
|
|
|
userCollectInfoService.saveCollect(loginDto.getUserId(), objectId, collectType);
|
|
|
|
userCollectInfoService.saveCollect(loginDto.getUserId(), objectId, collectType);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Objects.equals(collectType, 2)) {
|
|
|
|
|
|
|
|
// 初次关注某用户
|
|
|
|
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.SUCCESS_FOLLOW_ONE_USER, authorization);
|
|
|
|
|
|
|
|
}
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -49,7 +63,8 @@ public class UserCollectController {
|
|
|
|
@ApiImplicitParam(name = "collectType", value = "0:歌曲,1:期刊,2:关注,3:黑名单,4:粉丝,5:点赞,6:专辑", required = true)})
|
|
|
|
@ApiImplicitParam(name = "collectType", value = "0:歌曲,1:期刊,2:关注,3:黑名单,4:粉丝,5:点赞,6:专辑", required = true)})
|
|
|
|
@DeleteMapping
|
|
|
|
@DeleteMapping
|
|
|
|
@GlobalInterceptor(checkAppUserLogin = true)
|
|
|
|
@GlobalInterceptor(checkAppUserLogin = true)
|
|
|
|
public Result<Void> cancelCollect(@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
public Result<Void> cancelCollect(
|
|
|
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
@VerifyParam(required = true) @RequestParam("objectId") String objectId,
|
|
|
|
@VerifyParam(required = true) @RequestParam("objectId") String objectId,
|
|
|
|
@VerifyParam(required = true) @RequestParam("collectType") Integer collectType) {
|
|
|
|
@VerifyParam(required = true) @RequestParam("collectType") Integer collectType) {
|
|
|
|
UserLoginDto loginDto = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
UserLoginDto loginDto = jwtUtil.getUserLoginDto(authorization);
|
|
|
|