从第三方获取用户优惠券
This commit is contained in:
@@ -12,6 +12,7 @@ import com.rj.dto.hxr.HxrAdminUserApiContext;
|
||||
import com.rj.dto.hxr.HxrBuyerOrderApiContext;
|
||||
import com.rj.dto.hxr.HxrFansApiContext;
|
||||
import com.rj.dto.hxr.HxrGoodsApiContext;
|
||||
import com.rj.dto.hxr.HxrMoneyCouponApiContext;
|
||||
import com.rj.dto.hxr.HxrUserLoginApiContext;
|
||||
import com.rj.entity.LbThirdIntegrationConfig;
|
||||
import com.rj.mapper.LbThirdIntegrationConfigMapper;
|
||||
@@ -466,6 +467,37 @@ public class LbThirdIntegrationConfigServiceImpl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<HxrMoneyCouponApiContext> resolveMoneyCouponApiContext(String tenantId, String token) {
|
||||
if (!StringUtils.hasText(tenantId) || !StringUtils.hasText(token)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
LbThirdIntegrationConfig config = getByTenantIdOrNull(tenantId.trim());
|
||||
if (config == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (config.getEnabled() == null || config.getEnabled() != 1) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
String appStr = config.getGoodsApiAppStr();
|
||||
if (!StringUtils.hasText(appStr)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
try {
|
||||
return Optional.of(new HxrMoneyCouponApiContext(
|
||||
LbThirdIntegrationConfigUtil.resolveMoneyCouponApiBaseUrl(config),
|
||||
LbThirdIntegrationConfigUtil.resolveMoneyCouponListLimit(config),
|
||||
LbThirdIntegrationConfigUtil.resolveGoodsApiOrigin(config),
|
||||
LbThirdIntegrationConfigUtil.resolveGoodsApiReferer(config),
|
||||
token.trim(),
|
||||
appStr.trim()));
|
||||
} catch (IllegalStateException e) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<HxrAdminOrderApiContext> resolveAdminOrderApiContext(String tenantId) {
|
||||
return resolveAdminOrderApiContext(tenantId, false);
|
||||
|
||||
Reference in New Issue
Block a user