package com.jilongda.applet.utils;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.jilongda.applet.model.TAppUser;
|
import com.jilongda.applet.service.TAppUserService;
|
import com.jilongda.common.model.TUser;
|
import com.jilongda.common.security.JwtTokenUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
public class LoginInfoUtil {
|
|
@Autowired
|
private TAppUserService appUserService;
|
|
|
public Integer getUserId(){
|
// String username = JwtTokenUtils.getUsername();
|
// TAppUser appUser = appUserService.getOne(new QueryWrapper<TAppUser>().eq("openId", username).eq("isDelete",0));
|
return 1;
|
}
|
|
public TAppUser getLoginUser(){
|
String username = JwtTokenUtils.getUsername();
|
TAppUser TAppUser = appUserService.getOne(new QueryWrapper<TAppUser>().eq("openId", username).eq("isDelete",0));
|
return TAppUser;
|
}
|
|
/**
|
* @description 注销
|
* @author jqs
|
* @date 2024/4/18 10:26
|
* @param
|
* @return void
|
*/
|
public void logoff(){
|
String username = JwtTokenUtils.getUsername();
|
TAppUser userName = appUserService.getOne(new QueryWrapper<TAppUser>().eq("openId", username).eq("isDelete",0));
|
userName.setIsDelete(true);
|
appUserService.saveOrUpdate(userName);
|
}
|
|
public Boolean checkPhoneExits(String phone){
|
TAppUser userName = appUserService.getOne(new QueryWrapper<TAppUser>().eq("openId", phone).eq("isDelete",0));
|
if(userName!=null){
|
return true;
|
}else{
|
return false;
|
}
|
}
|
}
|