package org.dromara.zhishu.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/zhishu/userInfo")
public class UserInfoController {

    @SaIgnore
    @GetMapping(value = "/getUserId")
    public Long getUserId(@RequestParam("token") String token){
        LoginUser user = LoginHelper.getLoginUser(token);
        return user.getUserId();
    }
}
