CsdnController.java 1.4 KB
Newer Older
1 2 3
package com.kwan.springbootkwan.controller;

import com.kwan.springbootkwan.entity.Result;
4
import com.kwan.springbootkwan.service.CsdnLikeService;
5 6 7
import com.kwan.springbootkwan.service.CsdnService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
8
import org.apache.ibatis.annotations.Param;
9 10 11 12 13 14 15 16 17 18 19
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
20
    private CsdnService csdnService;
21 22 23 24 25 26 27 28
    @Autowired
    private CsdnLikeService csdnLikeService;

    @ApiOperation(value = "单人点赞", notes = "单人点赞")
    @GetMapping("/singleLike")
    public Result singleLike(@Param("articleId") String articleId) {
        return Result.ok(csdnLikeService.like(articleId));
    }
29

30 31 32
    @ApiOperation(value = "单人三连", notes = "单人三连")
    @GetMapping("/singleTriplet")
    public Result singleTriplet(@Param("username") String username) {
33 34
        csdnService.singleArticle(username);
        return Result.ok("三连完成");
35 36 37 38 39 40 41
    }

    @ApiOperation(value = "多人三连", notes = "多人三连")
    @GetMapping("/multiTriplet")
    public Result multiTriplet() {
        csdnService.multiTriplet();
        return Result.ok("三连完成");
42 43
    }
}