package com.fs.live.controller;

import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.R;
import com.fs.common.core.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app/live/liveData")
public class LiveDataController extends BaseController {

    @Autowired
    private RedisCache redisCache;

    /**
     * 点赞
     * */
    @GetMapping("/like/{liveId}")
    public R like(@PathVariable("liveId") Long liveId) {
        //直播间总点赞数
        Long increment = redisCache.incr("live:like:" + liveId, 1);

        return R.ok().put("like",increment);
    }
}
