修复(#79): 修复促销管理审查问题

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-05-27 06:09:22 -07:00
parent 9de7a69756
commit c18a6788c4
9 changed files with 217 additions and 25 deletions
@@ -2,12 +2,14 @@ package promo
import (
"context"
stderrors "errors"
"github.com/perfect-panel/server/internal/svc"
"github.com/perfect-panel/server/internal/types"
"github.com/perfect-panel/server/pkg/logger"
"github.com/perfect-panel/server/pkg/xerr"
"github.com/pkg/errors"
"gorm.io/gorm"
)
type DeletePriceLogic struct {
@@ -27,6 +29,10 @@ func NewDeletePriceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
func (l *DeletePriceLogic) DeletePrice(req *types.DeletePromoPriceRequest) error {
price, err := l.svcCtx.PromoModel.FindPrice(l.ctx, req.Id)
if err != nil {
if stderrors.Is(err, gorm.ErrRecordNotFound) {
l.Errorw("[DeletePromoPrice] Price Not Found", logger.Field("id", req.Id))
return errors.Wrapf(xerr.NewErrCodeMsg(404, "promo price not found"), "promo price not found: %d", req.Id)
}
l.Errorw("[DeletePromoPrice] Find Price Error", logger.Field("error", err.Error()))
return errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "find promo price error: %v", err.Error())
}