“mitao”
2026-01-04 6ff2e616cd1c1e986735c5a8c1f991ab9dfe5ec4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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<Void> recordVisit() {
        Integer userId = tokenService.getLoginUserApplet().getUserId();
        appUserVisitService.recordVisit(userId);
        return R.ok();
    }
}