perf:登录日志保存用户名
This commit is contained in:
@@ -11,8 +11,8 @@ spring:
|
|||||||
platform:
|
platform:
|
||||||
wxmp:
|
wxmp:
|
||||||
global:
|
global:
|
||||||
app-id: wx7830e1085881b432
|
app-id: wxa0343fe519824651
|
||||||
app-secret: d7757f980b38b5bd8125d45767c40e04
|
app-secret: 776f089ba70bcd66455a7c7893f810b9
|
||||||
|
|
||||||
tiesheng:
|
tiesheng:
|
||||||
token:
|
token:
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.tiesheng.core.config.web;
|
package com.tiesheng.core.config.web;
|
||||||
|
|
||||||
|
import com.tiesheng.core.config.web.bean.CurrentWebUser;
|
||||||
|
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@@ -10,4 +12,13 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnMissingBean(value = TieshengWebConfigurer.class, ignored = DefaultWebConfigurer.class)
|
@ConditionalOnMissingBean(value = TieshengWebConfigurer.class, ignored = DefaultWebConfigurer.class)
|
||||||
public class DefaultWebConfigurer implements TieshengWebConfigurer {
|
public class DefaultWebConfigurer implements TieshengWebConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CurrentWebUser getCurrentUserName() {
|
||||||
|
CurrentWebUser webUser = new CurrentWebUser();
|
||||||
|
webUser.setId(TsTokenConfig.getWithoutThr().getId());
|
||||||
|
webUser.setName(webUser.getId());
|
||||||
|
return webUser;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.tiesheng.core.config.web;
|
|||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.tiesheng.core.config.web.bean.CurrentWebUser;
|
import com.tiesheng.core.config.web.bean.CurrentWebUser;
|
||||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import com.tiesheng.util.exception.ApiRespEnum;
|
import com.tiesheng.util.exception.ApiRespEnum;
|
||||||
@@ -26,12 +25,7 @@ public interface TieshengWebConfigurer {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
default CurrentWebUser getCurrentUserName() {
|
CurrentWebUser getCurrentUserName();
|
||||||
CurrentWebUser webUser = new CurrentWebUser();
|
|
||||||
webUser.setId(TsTokenConfig.getWithoutThr().getId());
|
|
||||||
webUser.setName(webUser.getId());
|
|
||||||
return webUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -67,10 +67,14 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
HttpServletRequest request = ServletKit.getRequest();
|
HttpServletRequest request = ServletKit.getRequest();
|
||||||
String ip = ServletUtil.getClientIP(request);
|
String ip = ServletUtil.getClientIP(request);
|
||||||
|
|
||||||
|
|
||||||
CoreLogLogin login = new CoreLogLogin();
|
CoreLogLogin login = new CoreLogLogin();
|
||||||
login.setUserId(platformUnique.getUserId());
|
login.setUserId(platformUnique.getUserId());
|
||||||
login.setPlatform(platformUnique.getPlatform());
|
login.setPlatform(platformUnique.getPlatform());
|
||||||
|
|
||||||
|
CurrentWebUser currentWebUser = tieshengWebConfigurer.getCurrentUserName();
|
||||||
|
login.setUserName(currentWebUser.getName());
|
||||||
|
|
||||||
login.setIp(ip);
|
login.setIp(ip);
|
||||||
DataBlock dataBlock = Ip2Region.getInstance().btreeSearch(ip);
|
DataBlock dataBlock = Ip2Region.getInstance().btreeSearch(ip);
|
||||||
login.setAddress(dataBlock.getRegion());
|
login.setAddress(dataBlock.getRegion());
|
||||||
|
|||||||
Reference in New Issue
Block a user