| 1234567891011121314151617181920212223242526272829303132333435 |
- package com.ylx.moment.controller;
- import com.ylx.common.core.domain.R;
- import com.ylx.moment.domain.dto.CustomerMomentDTO;
- import com.ylx.moment.service.MomentCollectService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- @RestController
- @RequestMapping("/customer/moment")
- @Api(tags = {"客户端动态模块"})
- @Slf4j
- @PreAuthorize("@customerAuth.isCustomer()")
- public class CustomerMomentCollectController {
- @Resource
- private MomentCollectService momentCollectService;
- @ApiOperation("切换动态收藏状态")
- @PostMapping("/collect/toggle")
- public R<Boolean> toggleCollect(@Validated @RequestBody CustomerMomentDTO dto) {
- boolean isCollected = momentCollectService.toggleCollect(dto);
- return R.ok(isCollected);
- }
- }
|