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
import com.kwan.springbootkwan.service.CsdnService;
import lombok.extern.slf4j.Slf4j;
7
import org.apache.ibatis.annotations.Param;
8 9 10 11 12 13 14 15 16 17 18
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
19
    private CsdnService csdnService;
20 21 22
    @Autowired
    private CsdnLikeService csdnLikeService;

23 24 25 26 27
    @GetMapping("/isLike")
    public Result isLike(@Param("articleId") String articleId, @Param("userName") String userName) {
        return Result.ok(csdnLikeService.isLike(articleId, userName));
    }

28 29 30 31
    @GetMapping("/singleLike")
    public Result singleLike(@Param("articleId") String articleId) {
        return Result.ok(csdnLikeService.like(articleId));
    }
32

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

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