CustomerMomentCollectController.java 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package com.ylx.moment.controller;
  2. import com.ylx.common.core.domain.R;
  3. import com.ylx.moment.domain.dto.CustomerMomentDTO;
  4. import com.ylx.moment.service.MomentCollectService;
  5. import io.swagger.annotations.Api;
  6. import io.swagger.annotations.ApiOperation;
  7. import lombok.extern.slf4j.Slf4j;
  8. import org.springframework.security.access.prepost.PreAuthorize;
  9. import org.springframework.validation.annotation.Validated;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import javax.annotation.Resource;
  15. @RestController
  16. @RequestMapping("/customer/moment")
  17. @Api(tags = {"客户端动态模块"})
  18. @Slf4j
  19. @PreAuthorize("@customerAuth.isCustomer()")
  20. public class CustomerMomentCollectController {
  21. @Resource
  22. private MomentCollectService momentCollectService;
  23. @ApiOperation("切换动态收藏状态")
  24. @PostMapping("/collect/toggle")
  25. public R<Boolean> toggleCollect(@Validated @RequestBody CustomerMomentDTO dto) {
  26. boolean isCollected = momentCollectService.toggleCollect(dto);
  27. return R.ok(isCollected);
  28. }
  29. }