模拟登录第三方接口

This commit is contained in:
2026-06-03 17:38:21 +08:00
parent 6ce698eecc
commit 7b3879d6b6
13 changed files with 423 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import com.rj.dto.LbThirdIntegrationCredentialUpdateRequest;
import com.rj.dto.hxr.HxrAdminOrderApiContext;
import com.rj.dto.hxr.HxrAdminUserApiContext;
import com.rj.dto.hxr.HxrGoodsApiContext;
import com.rj.dto.hxr.HxrUserLoginApiContext;
import com.rj.entity.LbThirdIntegrationConfig;
import com.rj.mapper.LbThirdIntegrationConfigMapper;
import com.rj.service.ILbThirdIntegrationConfigService;
@@ -371,6 +372,31 @@ public class LbThirdIntegrationConfigServiceImpl
}
}
@Override
public Optional<HxrUserLoginApiContext> resolveUserLoginApiContext(String tenantId) {
if (!StringUtils.hasText(tenantId)) {
return Optional.empty();
}
LbThirdIntegrationConfig config = getByTenantIdOrNull(tenantId.trim());
if (config == null) {
return Optional.empty();
}
if (config.getEnabled() == null || config.getEnabled() != 1) {
return Optional.empty();
}
try {
String appStr = config.getGoodsApiAppStr();
return Optional.of(new HxrUserLoginApiContext(
LbThirdIntegrationConfigUtil.resolveLoginApiUrl(config),
LbThirdIntegrationConfigUtil.resolveGoodsApiOrigin(config),
LbThirdIntegrationConfigUtil.resolveGoodsApiReferer(config),
StringUtils.hasText(appStr) ? appStr.trim() : null));
} catch (IllegalStateException e) {
return Optional.empty();
}
}
@Override
public Optional<HxrAdminOrderApiContext> resolveAdminOrderApiContext(String tenantId) {
if (!StringUtils.hasText(tenantId)) {
@@ -523,6 +549,12 @@ public class LbThirdIntegrationConfigServiceImpl
if (!StringUtils.hasText(entity.getBuyApiPath())) {
entity.setBuyApiPath(LbThirdIntegrationConstants.DEFAULT_BUY_API_PATH);
}
if (!StringUtils.hasText(entity.getFansApiPath())) {
entity.setFansApiPath(LbThirdIntegrationConstants.DEFAULT_FANS_API_PATH);
}
if (!StringUtils.hasText(entity.getLoginApiPath())) {
entity.setLoginApiPath(LbThirdIntegrationConstants.DEFAULT_LOGIN_API_PATH);
}
if (entity.getOrderPageLimit() == null) {
entity.setOrderPageLimit(LbThirdIntegrationConstants.DEFAULT_ORDER_PAGE_LIMIT);
}
@@ -532,6 +564,9 @@ public class LbThirdIntegrationConfigServiceImpl
if (entity.getGoodsPageLimit() == null) {
entity.setGoodsPageLimit(LbThirdIntegrationConstants.DEFAULT_GOODS_PAGE_LIMIT);
}
if (entity.getFansPageLimit() == null) {
entity.setFansPageLimit(LbThirdIntegrationConstants.DEFAULT_FANS_PAGE_LIMIT);
}
if (!StringUtils.hasText(entity.getAuthType())) {
entity.setAuthType(LbThirdIntegrationConstants.AUTH_COOKIE_PHPSID);
}