package com.ruoyi.web.controller.api; import com.ruoyi.common.core.domain.R; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.service.TAppUserVisitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 用户访问记录 * * @author xiaochen */ @RestController @RequestMapping("/appUserVisit") @Api(tags = "用户访问记录") @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class AppUserVisitController { private final TokenService tokenService; private final TAppUserVisitService appUserVisitService; @ApiOperation(value = "记录用户访问") @PostMapping("/record") public R recordVisit() { Integer userId = tokenService.getLoginUserApplet().getUserId(); appUserVisitService.recordVisit(userId); return R.ok(); } }