package com.kwan.springbootkwan.controller; import com.kwan.springbootkwan.entity.Result; import com.kwan.springbootkwan.service.CsdnService; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Slf4j @RestController @RequestMapping("/csdn") public class CsdnController { @Autowired private CsdnService service; @ApiOperation(value = "获取数据", notes = "获取数据") @GetMapping("/list") public Result get() { final String articleId = service.list(); System.out.println(articleId); final Boolean articleInfo = service.getArticleInfo(articleId); if (!articleInfo) { //进行点赞和评论 service.like(articleId); service.comment(articleId); } return Result.ok("流程处理完成"); } }