This commit is contained in:
Richie 2025-05-20 20:35:01 +08:00
parent b2b3844a20
commit c6776b6361
3 changed files with 33 additions and 33 deletions

View File

@ -16,7 +16,7 @@ import org.springframework.util.StringUtils;
@Component
public class JdApiCommon {
private final OShopService shopService;
private final OShopPlatformService platformService;
// private final OShopPlatformService platformService;
// private final ServerConfig serverConfig;
/**
* 更新前的检查
@ -35,31 +35,31 @@ public class JdApiCommon {
if (shop.getType() != EnumShopType.JD.getIndex() && shop.getType() != EnumShopType.JDVC.getIndex()) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误店铺不是JD店铺");
}
OShopPlatform platform = platformService.selectById(EnumShopType.JD.getIndex());
// OShopPlatform platform = platformService.selectById(EnumShopType.JD.getIndex());
if (!StringUtils.hasText(platform.getAppKey())) {
if (!StringUtils.hasText(shop.getAppKey())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误没有找到AppKey");
}
if (!StringUtils.hasText(platform.getAppSecret())) {
if (!StringUtils.hasText(shop.getAppSecret())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到AppSercet");
}
if (!StringUtils.hasText(platform.getRedirectUri())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到RedirectUri");
}
if (!StringUtils.hasText(platform.getServerUrl())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到ServerUrl");
}
// if (!StringUtils.hasText(platform.getRedirectUri())) {
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到RedirectUri");
// }
// if (!StringUtils.hasText(platform.getServerUrl())) {
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到ServerUrl");
// }
if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到SellerUserId");
}
ShopApiParams params = new ShopApiParams();
params.setAppKey(platform.getAppKey());
params.setAppSecret(platform.getAppSecret());
params.setAppKey(shop.getAppKey());
params.setAppSecret(shop.getAppSecret());
params.setAccessToken(shop.getAccessToken());
params.setRedirectUri(platform.getRedirectUri());
params.setServerUrl(platform.getServerUrl());
params.setRedirectUri(shop.getApiRedirectUrl());
params.setServerUrl(shop.getApiRequestUrl());
params.setSellerId(shop.getSellerId());
if (!StringUtils.hasText(shop.getAccessToken())) {

View File

@ -16,7 +16,7 @@ import org.springframework.util.StringUtils;
@Component
public class PddApiCommon {
private final OShopService shopService;
private final OShopPlatformService platformService;
// private final OShopPlatformService platformService;
/**
* 更新前的检查
@ -40,12 +40,12 @@ public class PddApiCommon {
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误请设置抖店平台店铺IDshopId");
// }
OShopPlatform platform = platformService.getById(EnumShopType.PDD.getIndex());
// OShopPlatform platform = platformService.getById(EnumShopType.PDD.getIndex());
if (!StringUtils.hasText(platform.getAppKey())) {
if (!StringUtils.hasText(shop.getAppKey())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误没有找到AppKey");
}
if (!StringUtils.hasText(platform.getAppSecret())) {
if (!StringUtils.hasText(shop.getAppSecret())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到AppSercet");
}
// if (!StringUtils.hasText(platform.getRedirectUri())) {
@ -60,11 +60,11 @@ public class PddApiCommon {
// }
ShopApiParams params = new ShopApiParams();
params.setAppKey(platform.getAppKey());
params.setAppSecret(platform.getAppSecret());
params.setAppKey(shop.getAppKey());
params.setAppSecret(shop.getAppSecret());
params.setAccessToken(shop.getAccessToken());
params.setRedirectUri(platform.getRedirectUri());
params.setServerUrl(platform.getServerUrl());
params.setRedirectUri(shop.getApiRedirectUrl());
params.setServerUrl(shop.getApiRequestUrl());
params.setSellerId(shop.getSellerId());
if (!StringUtils.hasText(shop.getAccessToken())) {

View File

@ -15,7 +15,7 @@ import org.springframework.util.StringUtils;
@Component
public class TaoApiCommon {
private final OShopService shopService;
private final OShopPlatformService platformService;
// private final OShopPlatformService platformService;
/**
* 更新前的检查
@ -37,28 +37,28 @@ public class TaoApiCommon {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是淘系店铺");
}
OShopPlatform platform = platformService.selectById(EnumShopType.TAO.getIndex());
// OShopPlatform platform = platformService.selectById(EnumShopType.TAO.getIndex());
if(!StringUtils.hasText(platform.getAppKey())) {
if(!StringUtils.hasText(shop.getAppKey())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误没有找到AppKey");
}
if(!StringUtils.hasText(platform.getAppSecret())) {
if(!StringUtils.hasText(shop.getAppSecret())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到AppSercet");
}
if(!StringUtils.hasText(platform.getServerUrl())) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到ServerUrl");
}
// if(!StringUtils.hasText(platform.getServerUrl())) {
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到ServerUrl");
// }
if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误没有找到SellerUserId");
}
ShopApiParams params = new ShopApiParams();
params.setAppKey(platform.getAppKey());
params.setAppSecret(platform.getAppSecret());
params.setAppKey(shop.getAppKey());
params.setAppSecret(shop.getAppSecret());
params.setAccessToken(shop.getAccessToken());
// params.setRedirectUri(serverConfig.getUrl()+"/taoapi2/tao_oauth");
params.setRedirectUri(platform.getRedirectUri());
params.setServerUrl(platform.getServerUrl());
params.setRedirectUri(shop.getApiRedirectUrl());
params.setServerUrl(shop.getApiRequestUrl());
if (!StringUtils.hasText(shop.getAccessToken())) {