package cc.mrbird.febs.auth.manager;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.uuid.UUID;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.*;
import com.ruoyi.system.api.model.LoginUser;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static com.ruoyi.common.core.web.domain.AjaxResult.DATA_TAG;

/**
 * 用户业务逻辑
 *
 * @author MrBird
 */
@Service
@RequiredArgsConstructor
public class UserManager {

    private final RemoteUserDataExchangeService remoteUserDataExchangeService;

    @Autowired
    private RedisService redisService;
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @return 用户
     */
    public R<LoginUser> findByName(String username) {
        // 数据交换平台查询用户信息
        return remoteUserDataExchangeService.getUserInfo(username, SecurityConstants.INNER);
    }

    /**
     * 通过电话查询用户信息
     *
     * @param mobile 电话
     * @return 用户
     */
    public R<LoginUser> findByPhone(String mobile) {
        return null;
    }
}
