package com.tzld.piaoquan.api.model.config;


import com.tzld.piaoquan.api.common.exception.CommonException;
import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount;

import java.util.Objects;

public class LoginUserContext {
    private final static ThreadLocal<ContentPlatformAccount> USER_THREAD_LOCAL = new ThreadLocal<>();
    private LoginUserContext() {
    }

    public static void setLoginUser(ContentPlatformAccount user) {
        USER_THREAD_LOCAL.set(user);
    }

    public static ContentPlatformAccount getUser() {
        return USER_THREAD_LOCAL.get();
    }

    public static void remove() {
        USER_THREAD_LOCAL.remove();
    }
}