This commit is contained in:
2026-02-01 19:37:40 +08:00
parent 5942de22ad
commit a14f1dcf2a

View File

@@ -9,6 +9,7 @@ import (
"ycc-server/app/main/api/internal/config"
"ycc-server/app/main/model"
"ycc-server/common/xerr"
"ycc-server/pkg/lzkit/crypto"
"ycc-server/pkg/lzkit/lzUtils"
@@ -191,7 +192,12 @@ func (s *WhitelistService) ProcessOfflineFeature(
return false, 0, false, err
}
// 2. 检查是否已有白名单
// 2. 不支持下架的模块whitelist_price < 0 表示该模块不开放下架功能
if feature.WhitelistPrice < 0 {
return false, 0, false, errors.Wrapf(xerr.NewErrMsg("该模块不支持下架"), "")
}
// 3. 检查是否已有白名单
exists, err := s.CheckWhitelistExists(ctx, idCard, feature.Id)
if err != nil {
return false, 0, false, err
@@ -203,7 +209,7 @@ func (s *WhitelistService) ProcessOfflineFeature(
price := feature.WhitelistPrice
// 3. 免费下架:直接创建白名单记录
// 4. 免费下架:直接创建白名单记录whitelist_price = 0
if price <= 0 {
if err := s.EnsureFreeWhitelist(ctx, session, idCard, feature, userId, orderId); err != nil {
return false, 0, false, err
@@ -211,13 +217,13 @@ func (s *WhitelistService) ProcessOfflineFeature(
return false, 0, true, nil
}
// 4. 付费下架:检查是否已有支付成功的订单
// 5. 付费下架:检查是否已有支付成功的订单
paidOrderId, err := s.findPaidWhitelistOrder(ctx, userId, idCard, feature.Id)
if err != nil {
return false, 0, false, err
}
// 5. 如果已有支付成功订单,补创建白名单记录
// 6. 如果已有支付成功订单,补创建白名单记录
if paidOrderId != "" {
if err := s.createWhitelistFromPaidOrder(ctx, session, idCard, feature, userId, orderId, paidOrderId, price); err != nil {
return false, 0, false, err
@@ -225,7 +231,7 @@ func (s *WhitelistService) ProcessOfflineFeature(
return false, price, true, nil
}
// 6. 需要支付
// 7. 需要支付
return true, price, false, nil
}