修改空指针报错的问题

This commit is contained in:
gong
2025-12-19 09:56:34 +08:00
parent 809fa0d4cf
commit e959e47e36
3 changed files with 6 additions and 7 deletions

View File

@@ -47,8 +47,8 @@ public class PpPackageServiceImpl extends ServiceImpl<PpPackageMapper, PpPackage
private ShopConfigService shopConfigService;
@Override
public Integer getPackagePromotionSwitch() {
Integer isPackagePromotion = shopConfigService.getById(StpKit.USER.getShopId()).getIsPackagePromotion();
public Integer getPackagePromotionSwitch(Long shopId) {
Integer isPackagePromotion = shopConfigService.getById(shopId).getIsPackagePromotion();
return isPackagePromotion == null ? SystemConstants.OneZero.ZERO : isPackagePromotion;
}
@@ -153,8 +153,8 @@ public class PpPackageServiceImpl extends ServiceImpl<PpPackageMapper, PpPackage
Long shopId = StpKit.USER.getShopId();
// 如果没有开启操作,直接返回空数据
ShopConfig shopConfig = shopConfigService.getById(shopId);
if (SystemConstants.OneZero.ZERO == shopConfig.getIsPackagePromotion()) {
Integer promotionSwitch = getPackagePromotionSwitch(shopId);
if (SystemConstants.OneZero.ZERO == promotionSwitch) {
log.info("没有开启套餐推广");
return new Page<>();
}