优化管理后台

This commit is contained in:
2026-09-14 01:16:47 +08:00
parent 3e31cccae3
commit b80e7495b9
5 changed files with 68 additions and 5 deletions
+13
View File
@@ -82,6 +82,19 @@ func (d *GoodsDao) GoodsGetByCode(ctx context.Context, code string) (*mysqlmodel
return &goods, nil
}
// GoodsGetByProductID 按虚拟支付道具 ID 查询商品(用于道具 ID 唯一性校验,不含软删)
func (d *GoodsDao) GoodsGetByProductID(ctx context.Context, productID string) (*mysqlmodel.Goods, error) {
ctx, span := global.Tracer.Start(ctx, "mysqldao.GoodsGetByProductID")
defer span.End()
var goods mysqlmodel.Goods
if err := d.db.WithContext(ctx).Where("product_id = ?", productID).First(&goods).Error; err != nil {
span.RecordError(err)
return nil, err
}
return &goods, nil
}
// GoodsCreate 创建商品
func (d *GoodsDao) GoodsCreate(ctx context.Context, goods *mysqlmodel.Goods) error {
ctx, span := global.Tracer.Start(ctx, "mysqldao.GoodsCreate")