fixbugs
This commit is contained in:
parent
b2b3844a20
commit
c6776b6361
|
|
@ -16,7 +16,7 @@ import org.springframework.util.StringUtils;
|
||||||
@Component
|
@Component
|
||||||
public class JdApiCommon {
|
public class JdApiCommon {
|
||||||
private final OShopService shopService;
|
private final OShopService shopService;
|
||||||
private final OShopPlatformService platformService;
|
// private final OShopPlatformService platformService;
|
||||||
// private final ServerConfig serverConfig;
|
// private final ServerConfig serverConfig;
|
||||||
/**
|
/**
|
||||||
* 更新前的检查
|
* 更新前的检查
|
||||||
|
|
@ -35,31 +35,31 @@ public class JdApiCommon {
|
||||||
if (shop.getType() != EnumShopType.JD.getIndex() && shop.getType() != EnumShopType.JDVC.getIndex()) {
|
if (shop.getType() != EnumShopType.JD.getIndex() && shop.getType() != EnumShopType.JDVC.getIndex()) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是JD店铺");
|
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");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||||
}
|
}
|
||||||
if (!StringUtils.hasText(platform.getAppSecret())) {
|
if (!StringUtils.hasText(shop.getAppSecret())) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
||||||
}
|
}
|
||||||
if (!StringUtils.hasText(platform.getRedirectUri())) {
|
// if (!StringUtils.hasText(platform.getRedirectUri())) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到RedirectUri");
|
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到RedirectUri");
|
||||||
}
|
// }
|
||||||
if (!StringUtils.hasText(platform.getServerUrl())) {
|
// if (!StringUtils.hasText(platform.getServerUrl())) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ServerUrl");
|
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ServerUrl");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
|
if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到SellerUserId");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到SellerUserId");
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopApiParams params = new ShopApiParams();
|
ShopApiParams params = new ShopApiParams();
|
||||||
params.setAppKey(platform.getAppKey());
|
params.setAppKey(shop.getAppKey());
|
||||||
params.setAppSecret(platform.getAppSecret());
|
params.setAppSecret(shop.getAppSecret());
|
||||||
params.setAccessToken(shop.getAccessToken());
|
params.setAccessToken(shop.getAccessToken());
|
||||||
params.setRedirectUri(platform.getRedirectUri());
|
params.setRedirectUri(shop.getApiRedirectUrl());
|
||||||
params.setServerUrl(platform.getServerUrl());
|
params.setServerUrl(shop.getApiRequestUrl());
|
||||||
params.setSellerId(shop.getSellerId());
|
params.setSellerId(shop.getSellerId());
|
||||||
if (!StringUtils.hasText(shop.getAccessToken())) {
|
if (!StringUtils.hasText(shop.getAccessToken())) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import org.springframework.util.StringUtils;
|
||||||
@Component
|
@Component
|
||||||
public class PddApiCommon {
|
public class PddApiCommon {
|
||||||
private final OShopService shopService;
|
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, "参数错误,请设置抖店平台店铺ID(shopId)");
|
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,请设置抖店平台店铺ID(shopId)");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
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");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||||
}
|
}
|
||||||
if (!StringUtils.hasText(platform.getAppSecret())) {
|
if (!StringUtils.hasText(shop.getAppSecret())) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
||||||
}
|
}
|
||||||
// if (!StringUtils.hasText(platform.getRedirectUri())) {
|
// if (!StringUtils.hasText(platform.getRedirectUri())) {
|
||||||
|
|
@ -60,11 +60,11 @@ public class PddApiCommon {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
ShopApiParams params = new ShopApiParams();
|
ShopApiParams params = new ShopApiParams();
|
||||||
params.setAppKey(platform.getAppKey());
|
params.setAppKey(shop.getAppKey());
|
||||||
params.setAppSecret(platform.getAppSecret());
|
params.setAppSecret(shop.getAppSecret());
|
||||||
params.setAccessToken(shop.getAccessToken());
|
params.setAccessToken(shop.getAccessToken());
|
||||||
params.setRedirectUri(platform.getRedirectUri());
|
params.setRedirectUri(shop.getApiRedirectUrl());
|
||||||
params.setServerUrl(platform.getServerUrl());
|
params.setServerUrl(shop.getApiRequestUrl());
|
||||||
params.setSellerId(shop.getSellerId());
|
params.setSellerId(shop.getSellerId());
|
||||||
|
|
||||||
if (!StringUtils.hasText(shop.getAccessToken())) {
|
if (!StringUtils.hasText(shop.getAccessToken())) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import org.springframework.util.StringUtils;
|
||||||
@Component
|
@Component
|
||||||
public class TaoApiCommon {
|
public class TaoApiCommon {
|
||||||
private final OShopService shopService;
|
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, "参数错误,店铺不是淘系店铺");
|
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");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||||
}
|
}
|
||||||
if(!StringUtils.hasText(platform.getAppSecret())) {
|
if(!StringUtils.hasText(shop.getAppSecret())) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
||||||
}
|
}
|
||||||
if(!StringUtils.hasText(platform.getServerUrl())) {
|
// if(!StringUtils.hasText(platform.getServerUrl())) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ServerUrl");
|
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ServerUrl");
|
||||||
}
|
// }
|
||||||
if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
|
if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
|
||||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到SellerUserId");
|
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到SellerUserId");
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopApiParams params = new ShopApiParams();
|
ShopApiParams params = new ShopApiParams();
|
||||||
params.setAppKey(platform.getAppKey());
|
params.setAppKey(shop.getAppKey());
|
||||||
params.setAppSecret(platform.getAppSecret());
|
params.setAppSecret(shop.getAppSecret());
|
||||||
params.setAccessToken(shop.getAccessToken());
|
params.setAccessToken(shop.getAccessToken());
|
||||||
// params.setRedirectUri(serverConfig.getUrl()+"/taoapi2/tao_oauth");
|
// params.setRedirectUri(serverConfig.getUrl()+"/taoapi2/tao_oauth");
|
||||||
params.setRedirectUri(platform.getRedirectUri());
|
params.setRedirectUri(shop.getApiRedirectUrl());
|
||||||
params.setServerUrl(platform.getServerUrl());
|
params.setServerUrl(shop.getApiRequestUrl());
|
||||||
|
|
||||||
if (!StringUtils.hasText(shop.getAccessToken())) {
|
if (!StringUtils.hasText(shop.getAccessToken())) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue