优化管理后台
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user