家庭组 权益修改
Build docker and publish / build (20.15.1) (push) Successful in 8m16s

This commit is contained in:
2026-03-04 22:02:42 -08:00
parent 3594097d47
commit 4349a7ea2f
28 changed files with 960 additions and 96 deletions
@@ -7,6 +7,7 @@ import (
"time"
"github.com/hibiken/asynq"
commonLogic "github.com/perfect-panel/server/internal/logic/common"
"github.com/perfect-panel/server/internal/model/order"
"github.com/perfect-panel/server/internal/model/user"
"github.com/perfect-panel/server/pkg/constant"
@@ -43,6 +44,9 @@ func (l *RedeemCodeLogic) RedeemCode(req *types.RedeemCodeRequest) (resp *types.
logger.Error("current user is not found in context")
return nil, errors.Wrapf(xerr.NewErrCode(xerr.InvalidAccess), "Invalid Access")
}
if err = commonLogic.DenyIfFamilyMemberReadonly(l.ctx, l.svcCtx.DB, u.Id); err != nil {
return nil, err
}
// 使用Redis分布式锁防止并发重复兑换
lockKey := fmt.Sprintf("redemption_lock:%d:%s", u.Id, req.Code)
@@ -221,4 +225,4 @@ func (l *RedeemCodeLogic) RedeemCode(req *types.RedeemCodeRequest) (resp *types.
return &types.RedeemCodeResponse{
Message: "Redemption successful, processing...",
}, nil
}
}