发券,过期发券验证

This commit is contained in:
李子铭 2025-03-24 17:50:43 +08:00
parent a17ead31f1
commit 3ac5a26048
3 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package repoimpl
import ( import (
"context" "context"
"errors"
"gorm.io/gorm" "gorm.io/gorm"
"time" "time"
"unicode/utf8" "unicode/utf8"
@ -34,6 +35,9 @@ func (p *OrderNotifyRepoImpl) GetByID(ctx context.Context, id uint64) (*bo.Order
tx := p.DB(ctx).Where(model.OrderNotify{ID: id}).First(&info) tx := p.DB(ctx).Where(model.OrderNotify{ID: id}).First(&info)
if tx.Error != nil { if tx.Error != nil {
if errors.Is(tx.Error, gorm.ErrRecordNotFound) {
return nil, err2.ErrorDbNotFound("orderNotify数据不存在")
}
return nil, tx.Error return nil, tx.Error
} }

View File

@ -92,6 +92,7 @@ func (r *ProductRepoImpl) getByProductNo(ctx context.Context, item *model.Produc
if errors.Is(tx.Error, gorm.ErrRecordNotFound) { if errors.Is(tx.Error, gorm.ErrRecordNotFound) {
return nil, err2.ErrorDbNotFound("商品数据不存在") return nil, err2.ErrorDbNotFound("商品数据不存在")
} }
sqlDB, _ := db.DB() sqlDB, _ := db.DB()
log.Warnf("product当前打开连接数:%d,空闲连接数:%d", sqlDB.Stats().OpenConnections, sqlDB.Stats().Idle) log.Warnf("product当前打开连接数:%d,空闲连接数:%d", sqlDB.Stats().OpenConnections, sqlDB.Stats().Idle)

View File

@ -2,6 +2,7 @@ package repoimpl
import ( import (
"context" "context"
"errors"
"gorm.io/gorm" "gorm.io/gorm"
"time" "time"
"unicode/utf8" "unicode/utf8"
@ -34,6 +35,9 @@ func (p *WechatNotifyRegisterTagRepoImpl) GetByStockIdAndMchId(ctx context.Conte
tx := p.DB(ctx).Where(model.WechatNotifyRegisterTag{StockCreatorMchID: stockCreatorMchID, StockID: stockId}).First(&info) tx := p.DB(ctx).Where(model.WechatNotifyRegisterTag{StockCreatorMchID: stockCreatorMchID, StockID: stockId}).First(&info)
if tx.Error != nil { if tx.Error != nil {
if errors.Is(tx.Error, gorm.ErrRecordNotFound) {
return nil, err2.ErrorDbNotFound("notifyTag数据不存在")
}
return nil, tx.Error return nil, tx.Error
} }